/* ======================================================
   TELEGRAM FOOD ORDER APP - STABLE FULL CSS
   OLD SIMPLE CHECKOUT VERSION
   ------------------------------------------------------
   - Checkout page scrolls normally
   - Place Order and Back buttons scroll with the checkout form
   - Full-width action buttons like your reference image
====================================================== */

/* =========================
   THEME VARIABLES
========================= */

:root {
  color-scheme: dark light;

  --bg: #0b0b10;
  --bg-soft-1: rgba(52, 211, 153, 0.18);
  --bg-soft-2: rgba(96, 165, 250, 0.18);

  --card: rgba(255, 255, 255, 0.09);
  --card-light: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.14);

  --text: #ffffff;
  --muted: #b8b8c8;

  --accent: #34d399;
  --accent-text: #06110d;

  --sheet-bg: #15151d;
}

/* =========================
   RESET
========================= */

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  background:
    radial-gradient(circle at 10% 10%, var(--bg-soft-1), transparent 30%),
    radial-gradient(circle at 90% 15%, var(--bg-soft-2), transparent 30%),
    var(--bg);
}

h1,
h2,
p {
  margin-top: 0;
}

/* =========================
   APP
========================= */

.app {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px 18px 120px;
}

/* =========================
   HEADER
========================= */

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

  gap: 16px;
  margin-bottom: 18px;
}

.subtitle {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   CATEGORY TABS
========================= */

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;

  padding-bottom: 8px;
  margin-bottom: 18px;

  scrollbar-width: none;
}

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

.tab {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 10px;

  padding: 13px 18px;

  border-radius: 18px;
  border: 1px solid var(--line);

  background: var(--card-light);
  color: var(--text);

  font-weight: 800;
  white-space: nowrap;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.22s ease,
    border-color 0.22s ease;
}

.tab:active {
  transform: scale(0.96);
}

.tab.active {
  background: rgba(52, 211, 153, 0.24);
  border-color: rgba(52, 211, 153, 0.55);
}

.tab-icon {
  width: 22px;
  height: 22px;

  object-fit: contain;
  flex-shrink: 0;
}

/* =========================
   MENU GRID
========================= */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 28px 14px;
  align-items: stretch; /* ADD THIS — forces equal height per row */
}

/* =========================

   MENU CARD

========================= */

.card {
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: 150px;
  padding: 72px 15px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  animation: fadeUp 0.35s ease both;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.card:active {

  transform: scale(0.97);

}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card button {
  margin-top: 0; /* remove old margin-top: auto */
  width: 100%;
}

/* =========================
   FOOD IMAGE
========================= */

.food-icon {
  position: absolute;

  top: -30px;
  left: 50%;

  transform: translateX(-50%);

  width: 92px;
  height: 92px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  border: 0;
  box-shadow: none;

  z-index: 5;
}

.food-icon img {
  width: 92px;
  height: 92px;

  object-fit: contain;
  display: block;

  background: transparent;
  border: 0;
  box-shadow: none;

  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.25));

  transition: transform 0.25s ease;
}

.card:active .food-icon img {
  transform: scale(1.08) rotate(-2deg);
}

/* =========================

   FOOD TEXT

========================= */

.food-name {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  flex: 1; /* ADD THIS — name grows to fill space */
  display: flex;
  align-items: center;
  justify-content: center;
}

.food-price {
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  padding: 10px 0; /* consistent spacing above and below */
}

/* =========================
   BUTTONS
========================= */

button,
.btn {
  appearance: none;
  -webkit-appearance: none;

  border: 0;
  outline: none;

  font-family: inherit;
}

.btn {
  border-radius: 16px;

  padding: 12px 14px;

  font-weight: 800;
  cursor: pointer;

  color: var(--text);

  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease;
}

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

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

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

.btn-secondary {
  background: var(--card);
  color: var(--text);

  border: 1px solid var(--line);
}

.btn-full {
  width: 100%;

}

.menu-grid .btn {
  padding: 10px 12px;
  border-radius: 14px;
}

/* =========================
   FULL-WIDTH ACTION BUTTONS
   Add to Cart / Checkout / Place Order / Back
========================= */

#addCustomizedBtn,
#checkoutBtn,
#placeOrderBtn,
#backToCartBtn {
  width: 100%;
  height: 50px;

  padding: 0 22px;

  border-radius: 20px;

  font-size: 18px;
  font-weight: 900;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   FLOATING CART BAR
========================= */

.cart-bar {
  position: fixed;

  left: 18px;
  right: 18px;
  bottom: 18px;

  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 13px;

  background: rgba(20, 20, 28, 0.92);

  border: 1px solid var(--line);
  border-radius: 22px;

  color: var(--text);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);

  animation: slideUp 0.45s ease both;
}

.cart-bar strong,
.cart-bar span,
#cartCount,
#cartTotal {
  color: var(--text);
  opacity: 1;
  visibility: visible;
}

#cartTotal {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.cart-bar span,
.small {
  display: block;

  font-size: 13px;
  color: var(--muted);
}

/* Cart button */

.cart-bar .btn {
  min-width: 140px;
  height: 58px;

  padding: 0 26px;

  border-radius: 20px;

  font-size: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;
}

/* =========================
   MODALS
========================= */

.modal {
  display: none;

  position: fixed;
  inset: 0;

  padding: 18px;

  z-index: 100;

  align-items: flex-end;
  justify-content: center;

  background: rgba(0, 0, 0, 0.68);
}

.modal.open {
  display: flex;
}

.sheet {
  width: 100%;
  max-width: 540px;

  max-height: 88vh;

  margin: 0 auto;

  padding: 18px;

  overflow-y: auto;

  background: var(--sheet-bg);

  border: 1px solid var(--line);
  border-radius: 28px;

  color: var(--text);

  animation: modalUp 0.28s ease both;
}

.sheet-flex {
  display: flex;
  flex-direction: column;
}

.sheet-content {
  flex: 1;
}

/* Modal footer scrolls together with content in old checkout layout */
.sheet-footer {
  display: grid;
  gap: 10px;

  margin-top: 16px;
}

/* =========================
   CART ITEMS
========================= */

.cart-row,
.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;
}

.cart-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.total-row {
  padding: 14px 0 4px;
}

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

.item-base-price {
  color: var(--accent);

  font-size: 13px;
  font-weight: 900;

  margin-left: 6px;

  white-space: nowrap;
}

.cart-row .small b {
  color: var(--text);
}

/* Quantity buttons */

.qty {
  display: flex;
  align-items: center;

  gap: 8px;
}

.qty .btn {
  width: 34px;
  height: 34px;

  padding: 0;

  border-radius: 12px;
}

/* =========================
   FORM ELEMENTS
========================= */

label {
  color: var(--muted);

  font-size: 13px;
  font-weight: 800;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-light);
  color: var(--text);
  margin: 7px 0 12px;
  font: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

select option {
  color: #111827;
  background: #ffffff;
}

textarea {
  min-height: 78px;
  height: auto;

  resize: none;

  padding-top: 13px;
  padding-bottom: 13px;
}

.note-box {
  margin-top: 12px;
}

.note-box textarea {
  min-height: 64px;
  margin-bottom: 0;
}

#specialRequest {
  min-height: 72px;
}

#preferredTimeWrap {
  display: none;
}

#addressWrap {
  display: block;
}

/* Time input fix */

input[type="time"] {
  height: 54px;
  min-height: 54px;

  display: flex;
  align-items: center;

  padding: 0 14px;

  line-height: 1;
  text-align: left;
}

input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}

input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.9;
}

/* =========================
   EXTRA OPTIONS / CHECKBOX
========================= */

.option-group {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 52px;
  padding: 8px 12px;

  border-radius: 18px;
  border: 1px solid var(--line);

  background: var(--card-light);
  cursor: pointer;
}

.option-text {
  flex: 1;
}

.option-title {
  display: block;
  margin-bottom: 1px;
  font-weight: 800;
}

.option-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-check {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;

  border-radius: 6px;
  border: 2px solid var(--line);
  background: rgba(255,255,255,0.06);

  display: flex !important;
  align-items: center;
  justify-content: center;
}

.option-card input[type="checkbox"]:checked + .custom-check {
  background: var(--accent);
  border-color: var(--accent);
}

.option-card input[type="checkbox"]:checked + .custom-check::after {
  content: "✓";
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 900;
}

.option-card:has(input[type="checkbox"]:checked) {
  border-color: var(--accent);
  background: rgba(52, 211, 153, 0.14);
}


/* =========================
   STATUS
========================= */

.status {
  display: inline-block;

  padding: 6px 10px;

  border-radius: 999px;

  background: rgba(96, 165, 250, 0.2);
  color: var(--text);

  font-size: 12px;
  font-weight: 800;
}

/* =========================
   ORDER HISTORY
========================= */

.orders-sheet {
  max-height: 88vh;
  overflow: hidden;
  padding: 0;
}

.orders-header {
  position: sticky;
  top: 0;
  z-index: 20;

  padding: 18px 18px 12px;

  background: var(--sheet-bg);
  border-bottom: 1px solid var(--line);
}

.orders-header h2 {
  margin: 0;
}

.orders-scroll {
  max-height: calc(88vh - 76px);
  overflow-y: auto;

  padding: 16px 18px 18px;

  -webkit-overflow-scrolling: touch;
}

.order-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;

  border-radius: 18px;
  border: 1px solid var(--line);

  background: var(--card-light);

  cursor: pointer;
}

.order-summary-card:active {
  transform: scale(0.98);
}

.order-back-btn {
  width: 100%;

  margin-bottom: 14px;
  padding: 14px 16px;

  border-radius: 18px;
  border: 1px solid var(--line);

  background: var(--card-light);
  color: var(--text);

  font-weight: 800;
  font-size: 15px;
}

.order-detail-card {
  padding: 16px;

  border-radius: 24px;
  border: 1px solid var(--line);

  background: var(--card);
}

.order-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;
  margin-bottom: 14px;
}

.order-label {
  display: block;

  margin-bottom: 4px;

  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-top-row h2 {
  margin: 0;

  font-size: 28px;
  line-height: 1;
}

.order-status-pill {
  padding: 8px 12px;

  border-radius: 999px;

  background: rgba(96, 165, 250, 0.22);
  color: var(--text);

  font-size: 12px;
  font-weight: 900;
}

.order-total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 16px;
  margin-bottom: 12px;

  border-radius: 18px;

  background: rgba(52, 211, 153, 0.16);
}

.order-total-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-total-card strong {
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

.order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 10px;
  margin-bottom: 10px;
}

.order-info-box {
  padding: 13px;

  border-radius: 16px;
  border: 1px solid var(--line);

  background: var(--card-light);
}

.order-info-box.full {
  margin-bottom: 10px;
}

.order-info-box span {
  display: block;

  margin-bottom: 5px;

  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-info-box strong {
  display: block;

  font-size: 15px;
  line-height: 1.35;

  word-break: break-word;
}

.order-section-title {
  margin: 18px 0 10px;
  font-size: 18px;
}

.saved-order-items {
  display: grid;
  gap: 10px;
}

.saved-order-item {
  padding: 13px;

  border-radius: 16px;
  border: 1px solid var(--line);

  background: var(--card-light);
}

.saved-order-item strong {
  display: block;

  margin-bottom: 6px;

  font-size: 16px;
}

.saved-order-item .small {
  margin-top: 3px;
}

/* =========================
   EMPTY STATE
========================= */

.empty {
  padding: 24px 0;

  text-align: center;
  color: var(--muted);
}

/* =========================
   ANIMATIONS
========================= */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   LIGHT MODE
========================= */

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f4f6;
    --bg-soft-1: rgba(52, 211, 153, 0.16);
    --bg-soft-2: rgba(59, 130, 246, 0.14);

    --card: rgba(255, 255, 255, 0.74);
    --card-light: rgba(255, 255, 255, 0.56);
    --line: rgba(17, 24, 39, 0.10);

    --text: #111827;
    --muted: #6b7280;

    --accent: #10b981;
    --accent-text: #052e20;

    --sheet-bg: #ffffff;
  }
}

/* =========================
   TELEGRAM THEME OVERRIDES
========================= */

body.theme-light {
  --bg: #f3f4f6;
  --bg-soft-1: rgba(52, 211, 153, 0.16);
  --bg-soft-2: rgba(59, 130, 246, 0.14);

  --card: rgba(255, 255, 255, 0.74);
  --card-light: rgba(255, 255, 255, 0.56);
  --line: rgba(17, 24, 39, 0.10);

  --text: #111827;
  --muted: #6b7280;

  --accent: #10b981;
  --accent-text: #052e20;

  --sheet-bg: #ffffff;
}

body.theme-dark {
  --bg: #0b0b10;
  --bg-soft-1: rgba(52, 211, 153, 0.18);
  --bg-soft-2: rgba(96, 165, 250, 0.18);

  --card: rgba(255, 255, 255, 0.09);
  --card-light: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.14);

  --text: #ffffff;
  --muted: #b8b8c8;

  --accent: #34d399;
  --accent-text: #06110d;

  --sheet-bg: #15151d;
}

/* =========================

   LIGHT MODE CART FIX

========================= */

body.theme-light .cart-bar {

  background: rgba(255, 255, 255, 0.92);

}

body.theme-light .cart-bar strong,

body.theme-light .cart-bar span,

body.theme-light #cartCount {

  color: #111827 !important;

}

body.theme-light #cartTotal {

  color: #10b981 !important;

}

@media (prefers-color-scheme: light) {

  .cart-bar {

    background: rgba(255, 255, 255, 0.92);

  }

  .cart-bar strong,

  .cart-bar span,

  #cartCount {

    color: #111827 !important;

  }

  #cartTotal {

    color: #10b981 !important;

  }

}
