/* ============================================================
   LEMON TREE RESTAURANT — css/menu.css
   Menu page only.

   Desktop: fixed sidebar LEFT + 2-column card grid RIGHT
   Mobile:  horizontal scrollable pill tabs TOP + 1-column grid BELOW
   ============================================================ */


/* ── BRANCH SELECTOR BAR ──
   Sticky below the nav bar. Customer picks branch here.
── */
.branch-bar {
  background: var(--green);
  padding: 10px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: var(--nav-h);        /* sits directly below nav */
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  flex-wrap: wrap;
}

.branch-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.branch-selector {
  background: var(--lemon);
  color: var(--green);
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 200px;
  font-family: inherit;
}

.branch-bar-note {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-left: auto;
  white-space: nowrap;
}

/* Combined sticky offset: nav (64px) + branch bar (~45px) */
:root { --branch-bar-h: 45px; }


/* ── OUTER MENU LAYOUT ──
   Flex row on desktop: sidebar | content
   Flex column on mobile: tabs | content
── */
.menu-layout {
  display: flex;
  flex-direction: row;
  min-height: calc(100vh - var(--nav-h) - var(--branch-bar-h));
  padding-bottom: 80px; /* space above cart bar */
}


/* ════════════════════════════════
   DESKTOP SIDEBAR
   Fixed-width column on the left.
   Scrolls independently.
════════════════════════════════ */
.menu-sidebar {
  width: 185px;
  flex-shrink: 0;
  background: #fafafa;
  border-right: 1.5px solid var(--border-c);
  padding: 16px 0;

  /* Stick below nav + branch bar */
  position: sticky;
  top: calc(var(--nav-h) + var(--branch-bar-h));
  height: calc(100vh - var(--nav-h) - var(--branch-bar-h));
  overflow-y: auto;

  scrollbar-width: thin;
  scrollbar-color: var(--lemon) transparent;
}

.menu-sidebar::-webkit-scrollbar       { width: 4px; }
.menu-sidebar::-webkit-scrollbar-thumb { background: var(--lemon); border-radius: 4px; }

.sidebar-title {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 700;
  padding: 0 16px 12px;
  display: block;
}

/* Each category button */
.sidebar-cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-cat-btn:hover {
  background: var(--lemon-soft);
}

.sidebar-cat-btn.active {
  background: var(--lemon);
  border-left-color: var(--green);
}

.sidebar-cat-label {
  font-size: 13px;
  color: var(--text-mid);
  flex: 1;
  font-weight: 500;
  text-align: left;
}

.sidebar-cat-btn:hover .sidebar-cat-label,
.sidebar-cat-btn.active  .sidebar-cat-label {
  color: var(--green);
  font-weight: 600;
}

.sidebar-cat-count {
  font-size: 10px;
  color: var(--text-soft);
  background: #ebebeb;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.sidebar-cat-btn.active .sidebar-cat-count {
  background: rgba(39,119,34,0.15);
  color: var(--green);
}


/* ════════════════════════════════
   MAIN CONTENT AREA
════════════════════════════════ */
.menu-content {
  flex: 1;
  padding: 20px 24px;
  min-width: 0; /* prevent flex overflow */
}

/* Search bar */
.menu-search-bar { margin-bottom: 18px; }

.menu-search-input {
  width: 100%;
  padding: 11px 18px;
  border-radius: 24px;
  border: 1.5px solid var(--border-c);
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.menu-search-input:focus { border-color: var(--green); }

/* Category title + count above item grid */
.menu-cat-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--lemon);
}

.menu-cat-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.menu-cat-count {
  font-size: 12px;
  color: var(--text-soft);
}


/* ════════════════════════════════
   MENU ITEMS GRID
   2 columns desktop, 1 column mobile.
   Items stack vertically — page scrolls as needed.
════════════════════════════════ */
.menu-items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}


/* ════════════════════════════════
   INDIVIDUAL MENU CARD
   Horizontal layout:
   [IMAGE] [code / name / desc / price + button]
════════════════════════════════ */
.menu-card {
  display: flex;
  flex-direction: row;      /* image LEFT, body RIGHT */
  align-items: stretch;
  background: #fff;
  border: 1.5px solid var(--border-c);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 100px;
}

.menu-card:hover {
  border-color: var(--lemon);
  box-shadow: var(--shadow-sm);
}

.menu-card-unavailable {
  opacity: 0.45;
  pointer-events: none;
}

/* ── LEFT: food image ──
   Fixed square. object-fit:cover fills the frame for ANY image size.
   Portrait, landscape, square — all look consistent.
── */
.menu-card-img {
  width: 100px;
  min-width: 100px;    /* never shrink below this */
  height: 100px;
  border-radius: 0;    /* card already has radius */
  flex-shrink: 0;
  align-self: stretch;
}

.menu-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lemon-soft);
  color: var(--text-soft);
  font-size: 11px;
}

/* ── RIGHT: text body ── */
.menu-card-body {
  flex: 1;
  padding: 10px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Tags row */
.menu-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* Item code */
.menu-card-code {
  font-size: 10px;
  color: var(--text-soft);
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

/* Item name */
.menu-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.35;
  margin-bottom: 4px;
}

/* Description — max 2 lines */
.menu-card-desc {
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Price + add button row */
.menu-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.menu-card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
}

/* Circular + button */
.btn-add-cart {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lemon);
  color: var(--green);
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
  font-family: inherit;
}

.btn-add-cart:hover {
  background: var(--green);
  color: #fff;
  transform: scale(1.1);
}

.unavailable-label {
  font-size: 11px;
  color: var(--text-soft);
  background: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
}


/* ════════════════════════════════
   CART DRAWER
   Slides in from the right on "View Order" click.
════════════════════════════════ */
.cart-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
}
.cart-drawer-overlay.open { display: block; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 95vw;
  height: 100vh;
  background: #fff;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
}
.cart-drawer.open { right: 0; }

.cart-drawer-header {
  background: var(--green);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.cart-drawer-title { font-size: 16px; font-weight: 700; color: #fff; }

.cart-drawer-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.cart-drawer-close:hover { background: rgba(255,255,255,0.15); }

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.cart-empty-msg {
  text-align: center;
  color: var(--text-soft);
  padding: 48px 16px;
}

.cart-item-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-c);
}

.cart-item-img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--lemon-soft);
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 2px; }
.cart-item-price { font-size: 12px; color: var(--text-soft); }

.cart-item-qty { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border-c);
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  transition: all 0.15s;
}
.qty-btn:hover { background: var(--lemon); border-color: var(--lemon); }

.qty-num { font-size: 14px; font-weight: 700; min-width: 18px; text-align: center; }

.cart-item-subtotal {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  min-width: 64px;
  text-align: right;
  flex-shrink: 0;
}

.cart-drawer-footer {
  border-top: 2px solid var(--border-c);
  padding: 16px 20px;
  flex-shrink: 0;
  background: #fafafa;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.cart-total-label   { font-size: 15px; font-weight: 600; }
.cart-total-amount  { font-size: 20px; font-weight: 800; color: var(--green); }

.cart-action-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-action-btns .btn {
  justify-content: center;
  font-size: 14px;
  padding: 13px;
}

.cart-clear-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  margin-top: 8px;
  width: 100%;
  font-family: inherit;
  text-decoration: underline;
}
.cart-clear-btn:hover { color: #c0392b; }


/* ════════════════════════════════
   MOBILE — ≤ 900px
   Sidebar → horizontal scrollable pill tabs at top.
   Grid → 1 column.
════════════════════════════════ */
@media (max-width: 900px) {

  /* Stack layout vertically */
  .menu-layout {
    flex-direction: column;
    padding-bottom: 120px;
  }

  /* ── Sidebar → horizontal pill tab bar ── */
  .menu-sidebar {
    /* Override all desktop sticky/scroll settings */
    position: sticky;
    top: var(--nav-h);
    height: auto;          /* let it grow to fit pills */
    width: 100%;
    min-width: 0;

    /* Horizontal scroll */
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;

    padding: 8px 10px;
    gap: 6px;
    border-right: none;
    border-bottom: 2px solid var(--lemon);
    background: #fff;
    z-index: 90;

    /* Hide scrollbar — pills indicate scroll */
    scrollbar-width: none;
  }
  .menu-sidebar::-webkit-scrollbar { display: none; }

  /* Hide "Categories" label on mobile */
  .sidebar-title { display: none; }

  /* Each pill */
  .sidebar-cat-btn {
    flex-shrink: 0;
    width: auto;
    white-space: nowrap;
    padding: 7px 14px;
    border-radius: 20px;
    border-left: none !important;
    /* Reset desktop border-left active style */
    border: 1.5px solid var(--border-c);
    background: #fff;
  }

  .sidebar-cat-btn:hover {
    background: var(--lemon-soft);
    border-color: var(--lemon);
  }

  .sidebar-cat-btn.active {
    background: var(--green);
    border-color: var(--green);
  }

  .sidebar-cat-btn.active .sidebar-cat-label {
    color: #fff;
    font-weight: 700;
  }

  /* Hide count badge on mobile pills — saves space */
  .sidebar-cat-count { display: none; }

  /* Content area */
  .menu-content {
    padding: 14px 16px;
  }

  /* Remove the pseudo-element hint text — it causes the blank flash */
  .menu-content::before { display: none; }

  /* 1 column on mobile */
  .menu-items-grid {
    grid-template-columns: 1fr;
  }

  /* Branch bar stays below nav */
  .branch-bar {
    padding: 10px 16px;
  }

  .branch-bar-note { display: none; }

  /* Cart drawer full width on mobile */
  .cart-drawer {
    width: 100%;
    right: -100%;
  }
}


/* ════════════════════════════════
   SMALL MOBILE — ≤ 480px
════════════════════════════════ */
@media (max-width: 480px) {
  .menu-card-img {
    width: 80px;
    min-width: 80px;
    height: 80px;
  }

  .menu-cat-title { font-size: 17px; }

  .menu-content { padding: 12px; }
}
