/* Ko'uzi Online Ordering System Styles */

/* Order System Container */
.order-system-wrapper {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Order Content Layout */
.order-content {
  display: flex;
  min-height: 600px;
}

.menu-section {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  max-height: 900px;
}

.cart-section {
  width: 400px;
  background: #fafafa;
  border-left: 2px solid #e0e0e0;
  padding: 40px 30px;
  position: sticky;
  top: 0;
  height: fit-content;
  max-height: 900px;
  overflow-y: auto;
}

/* Menu Categories */
.menu-category {
  margin-bottom: 50px;
}

.menu-category h3 {
  color: #b89159;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 25px;
  padding-bottom: 12px;
  border-bottom: 3px solid #b89159;
}

/* Menu Items */
/* ------------------------------------------------------------------
   Menu rows — compact list, not cards.
   Cards read as "separate object"; 55 of them stacked is noise and
   roughly doubles the height. A divided list halves the scroll and
   scans far better, because names are left-aligned instead of centred.
   ------------------------------------------------------------------ */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 0;
  border: none;
  border-bottom: 1px solid #f1ede6;
  border-radius: 0;
  transition: background-color .18s;
  cursor: pointer;
  background: white;
  min-height: 56px;
}

.menu-item:first-child { border-top: 1px solid #f1ede6; }

.menu-item:hover {
  background: #fdfaf4;
}

.menu-item.selected {
  background: #fdfaf4;
  box-shadow: inset 3px 0 0 #b89159;
}

.menu-item.selected {
  border-color: #b89159;
  background: rgba(184, 145, 89, 0.05);
  border-width: 2px;
}

.menu-item.special-set {
  background: rgba(184, 145, 89, 0.08);
  border: 2px solid #b89159;
}

.menu-item-checkbox {
  /* Visually hidden but still in the DOM: it holds the selected state that
     every cart handler reads. .add-btn is what the customer actually sees. */
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.menu-item-info {
  flex: 1;
}

.menu-item-name {
  font-weight: 400;
  color: #1a1a1a;
  font-size: 0.95rem;
  line-height: 1.34;
  text-align: left;

  /* No line-clamp. An earlier version truncated every name to two lines with
     an ellipsis to keep rows a uniform height, which looked tidy and was the
     wrong trade: "Nigiri sint-jacobsschelp, gelakt met citroen yuzu" became
     "Nigiri sint-jacobsschelp, gelakt met…" and the customer could not see
     what they were ordering. Full text wins over a neat grid on the one
     screen where the decision is actually made. */
}

.menu-item-price {
  font-weight: 700;
  color: #1a1a1a;
  font-size: 0.95rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-right: 0;
}

/* Quantity Controls */
.quantity-control {
  display: none;
  align-items: center;
  gap: 12px;
}

.menu-item.selected .quantity-control {
  display: flex;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border: 2px solid #b89159;
  background: white;
  color: #b89159;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: bold;
  font-size: 1.1rem;
}

.qty-btn:hover {
  background: #b89159;
  color: white;
  transform: scale(1.1);
}

.qty-display {
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  font-size: 1.1rem;
}

/* Cart Items */
.cart-item {
  padding: 18px;
  margin-bottom: 12px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

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

.cart-item-name {
  font-weight: 500;
  color: #333;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #d32f2f;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0;
  margin-left: 12px;
  transition: all 0.2s;
}

.cart-item-remove:hover {
  transform: scale(1.2);
}

.cart-item-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: #666;
}

.cart-item-price {
  font-weight: 600;
  color: #b89159;
  font-size: 1.05rem;
}

/* Cart Summary */
.cart-summary {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 3px solid #b89159;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.cart-summary-row.total {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* Buttons */
#orderBtn {
  width: 100%;
  padding: 18px;
  background: #b89159;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1.15rem;
  cursor: pointer;
  margin-top: 25px;
  transition: all 0.3s;
  letter-spacing: 1.5px;
  opacity: 0.5;
}

#orderBtn:not(:disabled) {
  opacity: 1;
  cursor: pointer;
}

#orderBtn:not(:disabled):hover {
  background: #d4a76a;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(184, 145, 89, 0.4);
}

#clearCartBtn {
  display: none;
  width: 100%;
  padding: 12px;
  background: white;
  color: #d32f2f;
  border: 2px solid #d32f2f;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.3s;
}

#clearCartBtn:hover {
  background: #d32f2f;
  color: white;
}

/* Badge */
.badge-count {
  background: #d32f2f;
  color: white;
  border-radius: 50%;
  padding: 3px 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Order Form Modal */
.order-form-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  overflow-y: auto;
  padding: 40px 20px;
}

.order-form-modal.active {
  display: block;
}

.order-form-content {
  background: white;
  margin: 0 auto;
  padding: 0;
  border-radius: 12px;
  max-width: 700px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
}

.order-form-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #b89159;
  padding: 30px;
  border-radius: 12px 12px 0 0;
  text-align: center;
}

.order-form-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: 2px;
}

.order-form-body {
  padding: 40px;
}

.order-summary-box {
  background: #fafafa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  margin-bottom: 30px;
  max-height: 300px;
  overflow-y: auto;
}

.order-summary-box h4 {
  color: #b89159;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.order-summary-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.95rem;
}

.order-summary-item:last-child {
  border-bottom: none;
}

.order-summary-total {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #b89159;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.3rem;
  color: #1a1a1a;
}

.order-form-group {
  margin-bottom: 20px;
}

.order-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.order-form-group input,
.order-form-group textarea,
.order-form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.order-form-group input:focus,
.order-form-group textarea:focus,
.order-form-group select:focus {
  outline: none;
  border-color: #b89159;
  box-shadow: 0 0 0 3px rgba(184, 145, 89, 0.1);
}

.order-form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.order-form-group .required {
  color: #d32f2f;
}

.order-form-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.order-form-actions button {
  flex: 1;
  padding: 15px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.btn-submit-order {
  background: #b89159;
  color: white;
}

.btn-submit-order:hover {
  background: #d4a76a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(184, 145, 89, 0.4);
}

.btn-cancel-order {
  background: white;
  color: #666;
  border: 2px solid #ddd;
}

.btn-cancel-order:hover {
  background: #f5f5f5;
  border-color: #999;
}

.order-close {
  position: absolute;
  right: 20px;
  top: 20px;
  color: #b89159;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 28px;
  text-align: center;
  transition: all 0.2s;
}

.order-close:hover {
  color: #d4a76a;
  transform: scale(1.2);
}

/* Loading State */
.order-loading {
  text-align: center;
  padding: 20px;
}

.order-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #b89159;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.order-message {
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
}

.order-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.order-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.order-message.active {
  display: block;
}

/* Responsive Design */
@media (max-width: 991px) {
  .order-content {
    flex-direction: column !important;
  }
  
  .cart-section {
    width: 100% !important;
    border-left: none !important;
    border-top: 3px solid #b89159;
    position: relative !important;
    max-height: none !important;
  }
  
  .menu-section {
    max-height: none !important;
  }

  .order-form-content {
    width: 95%;
    margin: 10px auto;
  }

  .order-form-body {
    padding: 25px;
  }

  .order-form-actions {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  /* Row sizing now lives in the base rules — the old overrides here made
     rows TALLER on mobile, which was backwards. */
  .menu-section {
    padding: 20px;
  }

  .cart-section {
    padding: 25px 20px;
  }

  .order-form-header h2 {
    font-size: 1.4rem;
  }

  .order-form-body {
    padding: 20px;
  }
}


/* --- the visible add control (replaces the hidden checkbox) --- */
.add-btn {
  flex: none;
  width: 34px; height: 34px;
  border: 1.5px solid #b89159;
  border-radius: 8px;
  color: #b89159;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  transition: background-color .15s, color .15s;
}
.menu-item:hover .add-btn { background: #b89159; color: #fff; }
.menu-item.selected .add-btn { display: none; }

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

.menu-item-badge {
  display: inline-block;
  font-size: 0.62rem; font-weight: 700; letter-spacing: .08em;
  color: #b89159; margin-bottom: 1px;
}

/* Stepper sits in the same slot as .add-btn, so selecting an item
   never changes the row height and the list does not jump. */
.menu-item.selected .quantity-control { display: flex; }
.quantity-control { gap: 9px; }
.qty-btn {
  width: 30px; height: 30px;
  border: none; background: #1a1a1a; color: #b89159;
  border-radius: 7px; font-size: 17px; line-height: 1;
}
.qty-display {
  min-width: 16px; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 600;
}

/* Desktop keeps a little more air — the density matters most on a phone. */
@media (min-width: 992px) {
  .menu-item { padding: 13px 16px; min-height: 62px; }
  .menu-item-name  { font-size: 1rem; }
  .menu-item-price { font-size: 1.05rem; }
}


/* ==================================================================
   MENU TOOLBAR — search + category jump
   Sticky on mobile so both stay reachable while scrolling a long list.
   ================================================================== */
.menu-toolbar {
  position: sticky;
  /* Sits below the fixed navbar (65px) rather than under it. */
  top: 64px;
  z-index: 20;
  background: #fff;
  padding: 10px 0 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #efe9df;
}

/* position:sticky only sticks within its nearest SCROLLING ancestor.
   .menu-section carries overflow-y:auto (needed on desktop, where the list
   scrolls inside a 900px box), which made the toolbar stick to that box
   instead of the screen — and since the section has no max-height on mobile
   it never scrolls, so the toolbar simply scrolled away with the page.
   Releasing the overflow on mobile hands sticky back to the viewport. */
/* Phones: names now wrap to their full length instead of being clipped at two
   lines, so a long description adds height. A slightly smaller face and tighter
   leading buy most of that back without hurting readability — these are dish
   names read at arm's length, not body copy. */
@media (max-width: 991px) {
  /* Reclaim the side margins.
     .menu-section carries padding:40px, a desktop value that was never
     overridden for phones. Stacked with the container gutter and the row's
     own padding that was ~66px of dead space on each side of a 390px screen
     — a third of the width — which is why long dish names had nowhere to go.
     The row keeps its 14px, so text still has breathing room off the edge.
     padding-right needs !important: the markup sets it inline. */
  .menu-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* The wrapper around the order area is an unclassed div, so it has to be
     reached through the child it contains. :has() is supported everywhere
     current; where it is not, nothing matches and only the 40px above is
     reclaimed, which is the bulk of the gain anyway. */
  .container-fluid:has(> .order-content) {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Bootstrap's row padding (15px) and column gutter (12px) are another 27px
     each side. They exist to separate columns, and on a phone the columns are
     stacked, so they are separating nothing. The row keeps its own 14px, which
     is what actually holds the text off the edge. */
  .menu-section .row {
    padding-left: 0;
    padding-right: 0;
  }
  .menu-section [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
  }

  .menu-item-name {
    font-size: 0.875rem;
    line-height: 1.28;
  }
  .menu-item {
    /* was a fixed-ish row; let it grow with the text */
    align-items: flex-start;
    padding-top: 11px;
    padding-bottom: 11px;
  }
  .menu-item-price,
  .menu-item .add-btn,
  .menu-item .quantity-control {
    /* keep the controls visually centred against the first line of the name */
    margin-top: 1px;
  }
}

@media (max-width: 991px) {
  .menu-section {
    overflow: visible !important;
    max-height: none !important;
  }
}

/* The toolbar is mobile-only.
   On desktop the menu already sits beside the cart panel with the whole list
   in view, so search and category jumps add nothing — and they add real
   problems: .menu-section scrolls internally there, so sticky and the jump
   targets both have to work against a container instead of the window. Two
   code paths for a feature that earns its keep on one of them is a bad
   trade, so desktop simply does not get it. */
@media (min-width: 992px) {
  .menu-toolbar { display: none; }
}

.menu-filter {
  width: 100%;
  border: 1px solid #e3ddd2;
  background: #faf8f5;
  border-radius: 9px;
  padding: 11px 14px;
  /* 16px minimum, or iOS zooms in on focus and never zooms back out */
  font-size: 16px;
  color: #1a1a1a;
}
.menu-filter:focus {
  outline: 2px solid #b89159;
  outline-offset: -1px;
  background: #fff;
}

.menu-tabs {
  display: flex;
  gap: 6px;
  margin-top: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.menu-tabs::-webkit-scrollbar { display: none; }

.menu-tab {
  flex: none;
  border: 1px solid #e3ddd2;
  background: #fff;
  color: #6d6a63;
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.menu-tab:hover { color: #1a1a1a; border-color: #b89159; }
.menu-tab.active { background: #1a1a1a; color: #b89159; border-color: #1a1a1a; }

.menu-noresult {
  margin: 18px 0 4px;
  text-align: center;
  color: #6d6a63;
  font-size: .95rem;
}

/* A dish hidden by the search filter */
.menu-item.filtered-out { display: none; }
/* A whole category block with nothing left in it */
.menu-group-empty { display: none !important; }

/* ==================================================================
   STICKY CART BAR (mobile only)
   The running total lives further down the page; on a phone that means
   scrolling back to check it. This keeps it in view while browsing.
   ================================================================== */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1035;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #1a1a1a;
  color: #fff;
  transform: translateY(110%);
  transition: transform .22s ease;
  box-shadow: 0 -6px 22px rgba(0,0,0,.22);
}
.cart-bar.visible { transform: translateY(0); }
.cart-bar__count {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #b89159;
  color: #1a1a1a;
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.cart-bar__sum { flex: 1; font-size: .78rem; line-height: 1.25; color: #c9c9c9; }
.cart-bar__sum b {
  display: block;
  font-size: .98rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.cart-bar__go {
  background: #b89159;
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 10px 17px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
}

/* Desktop already shows the cart panel beside the menu, so the bar
   would be redundant there. */
@media (min-width: 992px) {
  .cart-bar { display: none; }
}


/* ==================================================================
   CART BAR CLEARANCE
   The bar is fixed and 66px tall, so anything anchored to the bottom
   of the screen ends up underneath it. Two things did:

   - #backToTop sat at bottom:40px with z-index 999 against the bar's
     1035, so it was drawn behind the bar and unclickable.
   - The order list ended with 20px of padding, which is not enough to
     scroll the final dish clear of the bar — the last item on the menu
     could never be read or added.

   Both are corrected only while the bar is actually up, so nothing
   moves for a visitor who has not started an order.
   ================================================================== */
/* Moved off the element's style attribute so the rule below can win.
   Only display: none stays inline, because jQuery's fadeIn/fadeOut owns it. */
#backToTop {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 999;
  width: 48px;
  height: 48px;
  font-size: 18px;
  line-height: 1;
  background-color: #1a1a1a;
  color: #b89159;
  border: 1px solid #b89159;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  transition: bottom .28s cubic-bezier(.4, 0, .2, 1), background-color .3s ease;
}

@media (max-width: 991.98px) {
  /* 40px from the right edge is a lot of inset on a phone. */
  #backToTop { right: 16px; bottom: 22px; }
}

body.cart-bar-open #backToTop { bottom: 82px; }

@media (max-width: 991.98px) {
  body.cart-bar-open #backToTop { bottom: 80px; }
}

body.cart-bar-open .menu-section {
  padding-bottom: 86px;
}


/* ==================================================================
   MODAL SCROLL LOCK
   Pinning the body rather than setting overflow:hidden on it. Both
   html and body are height:100%, so overflow:hidden on the body
   propagates to the viewport and throws the scroll position away —
   which then trips the navbar's fade-on-scroll and leaves the burger
   invisible after the modal closes. See kouziLockScroll().
   `top` is set inline to the negative of the saved scroll offset.
   ================================================================== */
body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}
