:root {
  --bg: #fffbf7;
  --surface: #ffffff;
  --surface-alt: #fdf3f6;
  --ink: #2a181d;
  --muted: #766067;
  --accent: #c84b6b;
  --accent-dark: #a63754;
  --accent-soft: #fce9ef;
  --gold: #d4a359;
  --whatsapp: #1fa855;
  --border: #efe1e5;
  --shadow-sm: 0 2px 10px rgba(42, 24, 29, 0.05);
  --shadow-md: 0 10px 30px rgba(42, 24, 29, 0.1);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --nav-height: 66px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Top Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 251, 247, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px 12px;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fce5ec, #f7d2be);
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-tag {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
}

.icon-btn.primary-tint {
  background: var(--accent-soft);
  border-color: #f4cdd8;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.badge[hidden] {
  display: none;
}

.search-wrap {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 13px;
  font-size: 0.95rem;
  opacity: 0.65;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 38px 0 38px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 75, 107, 0.12);
}

.clear-search {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}

/* Main Content */
.main-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px 24px;
}

/* Smart Suggester Card */
.suggester-card {
  scroll-margin-top: 130px;
  background: linear-gradient(160deg, #ffffff 0%, #fff4f7 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.suggester-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.suggester-header h1 {
  margin: 0 0 4px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.text-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 0;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--ink);
}

.filter-hint {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.76rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.chip:hover {
  border-color: #dfabb9;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 75, 107, 0.25);
}

.chip-count {
  font-size: 0.72rem;
  opacity: 0.75;
  font-weight: 500;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.suggester-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-status {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.suggester-cta-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
}

.full-width {
  width: 100%;
}

/* Gallery Controls */
.gallery-controls {
  scroll-margin-top: 130px;
  margin-bottom: 12px;
}

.active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-count {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.sort-row select {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Cake Grid (Mobile-first 2 columns) */
.cake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cake-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.cake-card:active {
  transform: scale(0.985);
}

.cake-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #f5ecee;
  overflow: hidden;
}

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

.card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.card-fav-btn.saved {
  color: var(--accent);
}

.card-color-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink);
}

.card-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.cake-card-body {
  padding: 9px 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cake-card-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cake-card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty & Load More */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.empty-emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.load-more-wrap {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.store-footer {
  margin-top: 28px;
  padding: 16px 8px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

/* Modal / Bottom Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 14, 19, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop[hidden] {
  display: none;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #dfd0d4;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.sheet-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.modal-hero {
  position: relative;
  background: #f6ecef;
  max-height: 52vh;
  overflow: hidden;
}

.modal-hero img {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  margin: 0 auto;
}

.fav-fab {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-md);
  font-size: 1.25rem;
  cursor: pointer;
}

.fav-fab.saved {
  color: var(--accent);
}

.modal-body {
  padding: 16px;
}

.modal-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.color-dot-lg {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.modal-id {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.modal-title {
  margin: 0 0 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.25;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
}

.order-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.order-box h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

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

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

.field span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 10px;
  font-size: 0.86rem;
}

.order-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  margin-top: 6px;
}

/* Similar Cakes */
.similar-section h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.similar-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.similar-row::-webkit-scrollbar {
  display: none;
}

.similar-card {
  flex: 0 0 118px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.similar-card img {
  width: 118px;
  height: 128px;
  object-fit: cover;
}

.similar-card span {
  display: block;
  padding: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Drawer */
.drawer-body {
  padding: 16px;
}

.drawer-body h2 {
  margin: 0 0 14px;
  font-family: "Playfair Display", Georgia, serif;
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.drawer-item img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.drawer-item-info {
  flex: 1;
  min-width: 0;
}

.drawer-item-info strong {
  display: block;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item-info small {
  color: var(--muted);
  font-size: 0.74rem;
}

.drawer-remove {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
}

.drawer-footer {
  margin-top: 16px;
}

/* Mobile Bottom Nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 1.15rem;
}

/* Responsive Breakpoints */
@media (min-width: 640px) {
  .main-content {
    padding: 18px 20px 32px;
  }

  .suggester-card {
    padding: 22px;
  }

  .suggester-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .cake-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .sheet {
    border-radius: 24px;
    max-height: 88vh;
  }
}

@media (min-width: 960px) {
  body {
    padding-bottom: 32px;
  }

  .bottom-nav {
    display: none;
  }

  .cake-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}
