/* ============================================================
   BELIM – Menu Page
   Mobile-first, print-menu aesthetic, dense & functional
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  --bg: #F5F0E6;
  --bg-card: #FDFBF6;
  --bg-hover: #F0EBE0;
  --text-primary: #55624D;
  --text-secondary: #79806F;
  --text-muted: #9A9E92;
  --accent: #C8A67A;
  --accent-light: #D9C9A8;
  --accent-dark: #A8864F;
  --divider: #D9D3C8;
  --divider-light: #E8E3D9;
  --white: #FFFFFF;
  --olive-deep: #3D4635;
  --badge-fav: #C8A67A;
  --badge-popular: #8B6E4E;
  --badge-veg: #5A7247;
  --badge-nonveg: #8B4D3B;
  --badge-new: #6B7A5C;

  --font-heading: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 50px;

  --header-height: 56px;
  --search-height: 48px;
  --catnav-height: 44px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: calc(var(--header-height) + var(--search-height) + var(--catnav-height) + 24px);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { border: none; cursor: pointer; font-family: inherit; background: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 4px; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--divider-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header__inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  color: var(--text-primary);
}

.header__back svg {
  width: 20px; height: 20px;
  fill: var(--text-primary);
}

.header__brand-logo {
  display: flex;
  align-items: center;
  height: 36px;
}

.header__brand-logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

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

.header__icon-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.header__icon-btn:hover { background: var(--bg-hover); }

.header__icon-btn svg {
  width: 20px; height: 20px;
  fill: var(--text-primary);
}

/* ============================================================
   SEARCH BAR (sticky below header)
   ============================================================ */
.search-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 99;
  background: var(--bg);
  padding: 8px 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.search-bar__field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: var(--search-height);
  transition: border-color 0.2s;
}

.search-bar__field:focus-within {
  border-color: var(--accent);
}

.search-bar__field svg {
  width: 18px; height: 18px;
  fill: var(--text-muted);
  flex-shrink: 0;
}

.search-bar__input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.87rem;
  color: var(--text-primary);
}

.search-bar__input::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.search-bar__clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--divider-light);
}

.search-bar__clear.visible { display: flex; }

.search-bar__clear svg {
  width: 14px; height: 14px;
  fill: var(--text-secondary);
}

/* ============================================================
   QUICK FILTERS
   ============================================================ */
.filters {
  max-width: 640px;
  margin: 0 auto;
  padding: 6px 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filters__row {
  display: flex;
  gap: 7px;
  white-space: nowrap;
}

.filter-pill {
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: var(--radius-pill);
  transition: all 0.15s;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.filter-pill.active {
  background: var(--olive-deep);
  color: var(--white);
  border-color: var(--olive-deep);
}

/* ============================================================
   FAVORITES SECTION
   ============================================================ */
.favorites {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 4px;
}

.favorites__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--olive-deep);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.favorites__title span {
  font-size: 0.9rem;
}

.favorites__scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.favorites__scroll::-webkit-scrollbar { display: none; }

.fav-card {
  flex-shrink: 0;
  width: 145px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--divider-light);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}

.fav-card:hover {
  border-color: var(--accent);
}

.fav-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  background: rgba(200, 166, 122, 0.12);
  padding: 2px 6px;
  border-radius: 3px;
}

.fav-card__name {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--olive-deep);
  line-height: 1.25;
  margin-bottom: 6px;
  min-height: 2.5em;
}

.fav-card__price {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.fav-card__price span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* ============================================================
   CATEGORY NAVIGATOR (sticky)
   ============================================================ */
.cat-nav {
  position: sticky;
  top: calc(var(--header-height) + var(--search-height) + 16px);
  z-index: 98;
  background: var(--bg);
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
  border-bottom: 1px solid var(--divider-light);
}

.cat-nav__row {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cat-nav__row::-webkit-scrollbar { display: none; }

.cat-nav__item {
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.cat-nav__item:hover {
  color: var(--text-primary);
}

.cat-nav__item.active {
  color: var(--olive-deep);
  border-bottom-color: var(--accent);
}

.cat-nav__emoji {
  margin-right: 4px;
  font-size: 0.8rem;
}

/* ============================================================
   MENU ACCORDION
   ============================================================ */
.menu-section {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 80px;
}

/* Each accordion category */
.accordion {
  border-bottom: 1px solid var(--divider);
}

.accordion:last-child {
  border-bottom: none;
}

.accordion__header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--olive-deep);
  text-align: left;
  transition: color 0.15s;
  gap: 4px;
}

.accordion__header:hover {
  color: var(--accent-dark);
}

.accordion__emoji {
  font-size: 1.1rem;
  margin-right: 6px;
  line-height: 1;
}

.accordion__name {
  flex: 1;
}

.accordion__count {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 8px;
}

.accordion__chevron {
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.accordion__chevron svg {
  width: 16px; height: 16px;
  fill: var(--text-muted);
}

.accordion.open .accordion__chevron {
  transform: rotate(180deg);
}

/* Accordion body */
.accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion.open .accordion__body {
  max-height: 3000px; /* large enough */
}

.accordion__body-inner {
  padding-bottom: 12px;
}

/* Sub-category header */
.subcategory {
  margin-bottom: 6px;
}

.subcategory__header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--divider-light);
  margin-bottom: 2px;
}

.subcategory__name {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  font-style: italic;
}

.subcategory__note {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Menu items */
.menu-item {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  transition: background 0.1s;
  border-radius: 3px;
}

.menu-item__main {
  display: flex;
  align-items: baseline;
  width: 100%;
  gap: 6px;
}

.menu-item__desc {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 4px;
  max-width: 90%;
}

.menu-item:hover {
  background: var(--bg-hover);
  margin: 0 -4px;
  padding: 6px 4px;
}

.menu-item__name {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.menu-item__badges {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.menu-item__badge {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badgePop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.badge--favorite {
  background: rgba(200, 166, 122, 0.15);
  color: var(--accent-dark);
}

.badge--bestseller {
  background: rgba(139, 110, 78, 0.12);
  color: var(--badge-popular);
  border: 1.5px solid rgba(139, 110, 78, 0.1);
}

.fire-emoji {
  display: inline-block;
  transform-origin: bottom center;
  animation: fireFlicker 1s infinite alternate ease-in-out;
}

@keyframes fireFlicker {
  0% {
    transform: scale(0.95) rotate(-3deg);
    filter: drop-shadow(0 0 1px rgba(255, 100, 0, 0.3));
  }
  50% {
    transform: scale(1.15) rotate(4deg) skewX(2deg);
    filter: drop-shadow(0 0 3px rgba(255, 165, 0, 0.7));
  }
  100% {
    transform: scale(0.9) rotate(-4deg) skewX(-1deg);
    filter: drop-shadow(0 0 1px rgba(255, 69, 0, 0.4));
  }
}

.badge--veg {
  background: rgba(90, 114, 71, 0.12);
  color: var(--badge-veg);
}

.badge--nonveg {
  background: rgba(139, 77, 59, 0.12);
  color: var(--badge-nonveg);
}

.badge--new {
  background: rgba(107, 122, 92, 0.12);
  color: var(--badge-new);
}

.menu-item__dots {
  flex: 1;
  border-bottom: 1px dotted var(--divider);
  min-width: 12px;
  margin-bottom: 4px;
}

.menu-item__price {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.menu-item__price-sep {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 2px;
}

/* Subcategory note (like add whipped cream) */
.subcategory__addon {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0 4px;
}

/* ============================================================
   NO RESULTS
   ============================================================ */
.no-results {
  text-align: center;
  padding: 48px 20px;
  display: none;
}

.no-results.visible {
  display: block;
}

.no-results__emoji {
  font-size: 2rem;
  margin-bottom: 12px;
}

.no-results__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--olive-deep);
  margin-bottom: 6px;
}

.no-results__text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================
   FOOTER CTA
   ============================================================ */
.menu-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.menu-footer__card {
  background: var(--olive-deep);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
}

.menu-footer__title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: #F5F0E6;
  margin-bottom: 8px;
}

.menu-footer__text {
  font-size: 0.78rem;
  color: rgba(245, 240, 230, 0.6);
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.menu-footer__btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.menu-footer__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
  transition: all 0.15s;
}

.menu-footer__btn--primary {
  background: var(--accent);
  color: var(--olive-deep);
}

.menu-footer__btn--primary:hover {
  background: var(--accent-light);
}

.menu-footer__btn--outline {
  background: transparent;
  color: rgba(245, 240, 230, 0.7);
  border: 1px solid rgba(245, 240, 230, 0.2);
}

.menu-footer__btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-footer__btn svg {
  width: 14px; height: 14px;
  fill: currentColor;
}

/* ============================================================
   SEARCH ACTIVE STATE
   ============================================================ */
.menu-section[data-search-active="true"] .accordion {
  border-bottom: none;
}

.menu-section[data-search-active="true"] .accordion__header {
  display: none;
}

.menu-section[data-search-active="true"] .accordion__body {
  max-height: 3000px;
}

.menu-section[data-search-active="true"] .subcategory__header {
  display: none;
}

.menu-section[data-search-active="true"] .subcategory__addon {
  display: none;
}

/* Hidden items during filter/search */
.menu-item.hidden { display: none; }
.accordion.hidden { display: none; }
.subcategory.hidden { display: none; }
.fav-card.hidden { display: none; }

/* ============================================================
   DESKTOP CENTERING (still mobile-first)
   ============================================================ */
@media (min-width: 641px) {
  .header__inner,
  .search-bar,
  .filters,
  .favorites,
  .cat-nav,
  .menu-section,
  .menu-footer {
    max-width: 640px;
  }
  
  body {
    background: #ECE7DD;
  }

  .header {
    background: #ECE7DD;
  }

  .search-bar {
    background: #ECE7DD;
  }

  .cat-nav {
    background: #ECE7DD;
  }

  .menu-wrapper {
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(61, 70, 53, 0.08);
  }

  .header,
  .search-bar,
  .filters,
  .favorites,
  .cat-nav,
  .menu-section,
  .menu-footer {
    max-width: 100%;
  }
}

/* Small tweaks for very small screens */
@media (max-width: 360px) {
  .fav-card { width: 130px; padding: 10px; }
  .fav-card__name { font-size: 0.78rem; }
  .menu-item__name { max-width: 48%; font-size: 0.8rem; }
  .menu-item__price { font-size: 0.76rem; }
  .cat-nav__item { padding: 10px 10px; font-size: 0.68rem; }
}

/* ============================================================
   SOCIAL PROOF TOAST POPUP
   ============================================================ */
.toast-popup {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  background: var(--olive-deep);
  border: 1px solid rgba(200, 166, 122, 0.25);
  border-left: 4px solid var(--accent);
  box-shadow: 0 8px 30px rgba(61, 70, 53, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 18px 14px 14px;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(120px) scale(0.9);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  cursor: pointer;
}

.toast-popup.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  animation: toastGlowPulse 2s infinite alternate ease-in-out;
}

.toast-popup__content {
  font-size: 0.78rem;
  color: #FAF8F3;
  line-height: 1.45;
  flex: 1;
}

.toast-popup__content strong {
  color: var(--accent);
}

.toast-popup__close {
  font-size: 1.2rem;
  color: rgba(245, 240, 230, 0.5);
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  background: none;
  border: none;
  padding: 0 4px;
}

.toast-popup__close:hover {
  color: var(--accent);
  transform: scale(1.15);
}

@keyframes toastGlowPulse {
  0% {
    box-shadow: 0 8px 30px rgba(61, 70, 53, 0.25);
    border-color: rgba(200, 166, 122, 0.25);
  }
  100% {
    box-shadow: 0 12px 35px rgba(61, 70, 53, 0.4), 0 0 15px 4px rgba(200, 166, 122, 0.35);
    border-color: rgba(200, 166, 122, 0.6);
  }
}

@media (max-width: 480px) {
  .toast-popup {
    left: 16px;
    right: 16px;
    bottom: 80px; /* Floating safely above the sticky footer CTA card */
    max-width: none;
  }
}

/* ============================================================
   STORY & BEANS SECTIONS
   ============================================================ */
.menu-story-section {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.story-card, .beans-card {
  background: var(--bg-card);
  border: 1px solid var(--divider-light);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}

.story-card__title, .beans-card__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--divider-light);
  padding-bottom: 6px;
}

.story-card__text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.bean-profile {
  margin-top: 16px;
}

.bean-profile:not(:last-child) {
  border-bottom: 1px dashed var(--divider-light);
  padding-bottom: 16px;
}

.bean-profile__name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 6px;
}

.bean-profile__name span {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 450;
  display: inline-block;
  margin-left: 4px;
}

.bean-profile__text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
