:root {
  color-scheme: light;
  --cream: #f7f1e8;
  --warm-white: #fbf8f3;
  --beige: #e9ddcf;
  --nude: #d8c6b5;
  --soft-brown: #a48b7f;
  --ink: #3b2f2a;
  --muted: #7b6a60;
  --accent: #cfae9a;
  --shadow-soft: 0 20px 40px rgba(70, 50, 40, 0.12);
  --shadow-card: 0 12px 24px rgba(62, 46, 39, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 0.25s ease;
  font-family: "Poppins", "SF Pro Display", "Inter", "Segoe UI", sans-serif;
}

html {
  scroll-behavior: smooth;
}

[data-theme="dark"] {
  color-scheme: dark;
  --cream: #1f1916;
  --warm-white: #241d1a;
  --beige: #2a221e;
  --nude: #3a2f29;
  --soft-brown: #d6c3b6;
  --ink: #f6eee8;
  --muted: #c7b5aa;
  --accent: #d2b7a2;
  --shadow-soft: 0 22px 50px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 16px 28px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(140deg, #f4ede5 0%, #fdfaf7 40%, #f0e5da 100%);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 56px;
  transition: background var(--transition), color var(--transition);
}

[data-theme="dark"] body {
  background: radial-gradient(circle at top, #2d2420 0%, #16110f 60%);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.65;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(220, 189, 170, 0.8), rgba(220, 189, 170, 0));
  top: -40px;
  left: 12%;
}

.orb-2 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(198, 170, 149, 0.7), rgba(198, 170, 149, 0));
  bottom: -80px;
  right: 8%;
  animation-delay: 2s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(240, 221, 205, 0.9), rgba(240, 221, 205, 0));
  top: 45%;
  right: 40%;
  animation-delay: 4s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  background: linear-gradient(180deg, rgba(255, 252, 249, 0.9) 0%, rgba(248, 241, 233, 0.94) 100%);
  border-radius: 36px;
  padding: 18px 18px 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

[data-theme="dark"] .app-shell {
  background: linear-gradient(180deg, rgba(32, 25, 22, 0.92), rgba(28, 21, 18, 0.95));
  border-color: rgba(255, 255, 255, 0.06);
}

.top-bar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: var(--radius-lg);
  background: rgba(250, 243, 235, 0.75);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 24px rgba(80, 60, 48, 0.08);
  z-index: 5;
}

[data-theme="dark"] .top-bar {
  background: rgba(42, 34, 29, 0.8);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 12px;
  background: var(--warm-white);
  border: 1px solid var(--beige);
  border-radius: var(--radius-md);
  padding: 6px;
  width: 190px;
  box-shadow: var(--shadow-card);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

[data-theme="dark"] .dropdown-menu {
  background: rgba(42, 34, 29, 0.95);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.dropdown-menu.active {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.dropdown-item:hover {
  background: var(--cream);
  color: var(--soft-brown);
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.dropdown-item svg {
  color: var(--muted);
  transition: color var(--transition);
}

.dropdown-item:hover svg {
  color: var(--soft-brown);
}

.top-bar h1 {
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  letter-spacing: 0.2px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

[data-theme="dark"] .icon-button {
  background: rgba(255, 255, 255, 0.08);
}

.icon-button:hover {
  transform: translateY(-1px) scale(1.02);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.profile-card {
  background: var(--warm-white);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

[data-theme="dark"] .profile-card {
  background: rgba(32, 25, 22, 0.9);
}

.profile-meta {
  margin-top: -2px;
}

.profile-media {
  position: relative;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: linear-gradient(135deg, #f7e8df, #d6c1b3);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar.has-image img {
  display: block;
}

.avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(210, 180, 160, 0.6);
  pointer-events: none;
}

.profile-meta h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.profile-meta p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editable {
  outline: 1px dashed rgba(170, 140, 120, 0.5);
  border-radius: 8px;
  padding: 4px 6px;
}

.pill {
  border-radius: 999px;
  border: none;
  padding: 6px 14px;
  background: var(--accent);
  color: #2d201a;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(90, 70, 60, 0.15);
}

.pill.ghost {
  background: transparent;
  border: 1px solid rgba(160, 130, 115, 0.35);
  color: var(--ink);
}

.icon-group {
  display: flex;
  gap: 8px;
}

.tiny-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

[data-theme="dark"] .tiny-button {
  background: rgba(255, 255, 255, 0.1);
}

.tiny-button svg {
  width: 16px;
  height: 16px;
}

.tiny-button.danger {
  color: #8b5c50;
}

.storefront {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.storefront-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warm-white);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 8px 16px rgba(90, 70, 60, 0.08);
}

.search-field svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 0.92rem;
  color: var(--ink);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chip-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip-row::-webkit-scrollbar {
  height: 0;
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(170, 140, 120, 0.35);
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.chip.active {
  background: var(--accent);
  color: #2d201a;
  border-color: transparent;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--warm-white);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: 0 8px 14px rgba(88, 65, 52, 0.08);
}

.stat-card p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.stat-card h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.section-heading h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.section-heading p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  background: var(--warm-white);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-card);
  animation: rise 0.4s ease both;
}

.product-thumb {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #f2e4d9, #d9c1b1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--muted);
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-details h4 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}

.product-details p {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.product-price {
  font-weight: 600;
  font-size: 0.82rem;
}

.product-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.product-actions .pill {
  padding: 4px 10px;
  font-size: 0.72rem;
}

.product-actions .tiny-button {
  width: 30px;
  height: 30px;
}

.admin-panel {
  background: var(--warm-white);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.toggle input {
  accent-color: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.field label {
  font-size: 0.78rem;
  color: var(--muted);
}

.field input,
.field select {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(170, 140, 120, 0.25);
  padding: 10px 12px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.image-preview {
  height: 70px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(170, 140, 120, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.edit-mode .product-card {
  outline: 1px dashed rgba(160, 130, 115, 0.35);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) translateX(0px);
  }
  50% {
    transform: translateY(-16px) translateX(10px);
  }
}

@media (min-width: 768px) {
  body {
    padding: 48px 24px 64px;
  }

  .app-shell {
    padding: 22px 22px 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.discount-badge {
  background: #ffebee;
  color: #c62828;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.price-container {
  display: flex;
  flex-direction: column;
}

.original-price-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.original-price {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.7;
  line-height: 1;
}

.product-number {
  color: var(--soft-brown);
  font-weight: 600;
  margin-right: 4px;
}

.product-thumb {
  position: relative;
}

.product-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.03);
  pointer-events: none;
  z-index: 1;
}

.thumb-zoom-icon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* Image Modal/Lightbox */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease forwards;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 10, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.image-modal-content {
  position: relative;
  z-index: 101;
  background: var(--warm-white);
  border-radius: var(--radius-xl);
  padding: 16px;
  width: min(100%, 380px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

[data-theme="dark"] .image-modal-content {
  background: #241d1a;
  border-color: rgba(255, 255, 255, 0.06);
}

.image-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.image-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.image-modal-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.image-modal-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.image-modal.closing {
  animation: fadeOut 0.2s ease forwards;
}

.image-modal.closing .image-modal-content {
  animation: scaleOut 0.2s ease forwards;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}
