:root {
  --black: #030302;
  --black-2: #080704;
  --cream: #fff8df;
  --line: rgba(248, 224, 138, 0.55);
  --radius: 32px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--black);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  font-family: "Noto Naskh Arabic", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 72% 28%, rgba(217, 169, 56, 0.16), transparent 30%),
    radial-gradient(circle at 18% 78%, rgba(248, 224, 138, 0.09), transparent 28%),
    linear-gradient(135deg, var(--black), var(--black-2) 55%, #010101);
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: screen;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23noise)' opacity='0.45'/%3E%3C/svg%3E");
  z-index: 0;
}

.background-glow {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(88px);
  opacity: 0.55;
  z-index: 0;
}

.background-glow-1 {
  width: 340px;
  height: 340px;
  right: 8vw;
  top: 10vh;
  background: rgba(217, 169, 56, 0.16);
}

.background-glow-2 {
  width: 260px;
  height: 260px;
  left: 10vw;
  bottom: 8vh;
  background: rgba(255, 248, 223, 0.07);
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(14px, 2.4vw, 28px);
  display: grid;
  place-items: center;
}

.luxury-border {
  position: absolute;
  inset: 10px;
  border: 1.5px solid var(--line);
  border-radius: calc(var(--radius) - 10px);
  pointer-events: none;
  z-index: 5;
  box-shadow:
    0 0 18px rgba(217, 169, 56, 0.12),
    inset 0 0 24px rgba(248, 224, 138, 0.04);
}

.logo-img {
  display: block;
  width: min(340px, 58vw);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 8px rgba(248, 224, 138, 0.22))
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}

/* Tablet */
@media (max-width: 980px) {
  body {
    overflow-x: hidden;
    background:
      radial-gradient(circle at 50% 20%, rgba(217, 169, 56, 0.13), transparent 34%),
      linear-gradient(135deg, #030302, #080704 60%, #010101);
  }

  .grain {
    opacity: 0.08;
    mix-blend-mode: normal;
  }

  .background-glow {
    filter: blur(45px);
    opacity: 0.28;
  }
}

/* Mobile */
@media (max-width: 620px) {
  :root {
    --radius: 24px;
  }

  html,
  body {
    min-height: 100%;
  }

  .page {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 10px 10px 90px 10px; /* Extra padding at the bottom so you can scroll past the button */
  }

  .luxury-border {
    inset: 8px;
  }

  .logo-img {
    width: min(260px, 68vw);
  }

  .background-glow-1,
  .background-glow-2 {
    display: none;
  }

  /* Center the button and stretch it on mobile */
  .cart-fab {
    bottom: 15px;
    left: 20px;
    right: 20px;
    width: auto;
    text-align: center;
    transform: none; /* Fixes the RTL shift bug */
  }
  .cart-fab:hover {
    transform: scale(1.05);
  }
}

/* 3D Flip Container */
.menu-flip-container {
  perspective: 1500px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 90vh;
  min-height: 650px;
  z-index: 10;
  position: relative;
}

.menu-flipper {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy flip */
  transform-style: preserve-3d;
}

/* The class triggered by JavaScript to flip the card */
.menu-flip-container.is-flipped .menu-flipper {
  transform: rotateY(-180deg);
}

.menu-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: rgba(15, 15, 15, 0.85); /* Dark frosted glass */
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.3); /* Gold tint border */
  border-radius: 12px;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.15);
}

.menu-back {
  transform: rotateY(180deg);
}

/* Softcopy Image Container */
.softcopy-container {
  width: 100%;
  flex: 1;
  min-height: 0; /* Prevents the container from squishing to 0 height */
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.softcopy-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Keeps your image ratio intact */
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.flip-button {
  background: transparent;
  border: 1px solid #d4af37;
  color: #d4af37;
  padding: 12px 20px;
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 30px;
  transition: all 0.3s ease;
  margin-top: 15px;
  width: 100%;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.flip-button:hover {
  background: #d4af37;
  color: #111;
  transform: scale(1.03);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.4);
}

/* --- WhatsApp Cart Styles --- */
.cart-fab {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #d4af37;
  color: #111;
  border: none;
  padding: 15px 25px;
  border-radius: 30px;
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: transform 0.3s ease;
}

.cart-fab:hover {
  transform: scale(1.05);
}

.cart-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.cart-modal.hidden {
  display: none;
}

.cart-content {
  background: var(--black-2);
  border: 1px solid var(--line);
  width: 90%;
  max-width: 450px;
  max-height: 85vh;
  border-radius: 20px;
  padding: 25px;
  overflow-y: auto;
  position: relative;
  color: var(--cream);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2rem;
  cursor: pointer;
}

.menu-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 20px;
}

.category-header {
  color: #d4af37;
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
  font-size: 1.1rem;
  margin: 15px 0 5px 0;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.3);
  padding-bottom: 5px;
}

.menu-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 15px;
  border-radius: 8px;
}

.sugar-select,
.flavor-select {
  background: rgba(0, 0, 0, 0.5);
  color: var(--cream);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 5px;
  padding: 4px 8px;
  font-family: 'Noto Naskh Arabic', sans-serif;
  font-size: 0.85rem;
  outline: none;
  width: fit-content;
}

.sugar-select:focus,
.flavor-select:focus {
  border-color: #d4af37;
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
}

.add-to-cart-btn {
  background: transparent;
  border: 1px solid #d4af37;
  color: #d4af37;
  border-radius: 5px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.add-to-cart-btn:hover {
  background: #d4af37;
  color: #111;
}

.cart-items {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.cart-items li {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #ddd;
  background: rgba(0,0,0,0.3);
  padding: 8px;
  border-radius: 5px;
}

.cart-items li.empty-cart-message {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  padding: 40px 20px;
  margin-top: 10px;
  gap: 15px;
  text-align: center;
}

.empty-cart-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-cart-text {
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
  font-size: 1.1rem;
  color: var(--cream);
  line-height: 1.6;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 8px;
}

.qty-btn {
  background: #d4af37;
  color: #111;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s;
}

.qty-btn:active {
  transform: scale(0.9);
}

.qty-val {
  font-size: 1rem;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

.cart-total {
  font-size: 1.3rem;
  font-weight: bold;
  text-align: right;
  margin-bottom: 20px;
  color: #d4af37;
}

.clear-cart-btn {
  background: transparent;
  border: 1px solid #ff4c4c;
  color: #ff4c4c;
  border-radius: 5px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.clear-cart-btn:hover {
  background: #ff4c4c;
  color: #111;
}

.customer-info-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.customer-info-form input,
.customer-info-form textarea,
.customer-info-form select {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: var(--cream);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  color-scheme: dark;
}

.customer-info-form select option {
  background: var(--black-2);
  color: var(--cream);
}

.customer-info-form textarea {
  resize: vertical;
  min-height: 60px;
}

.customer-info-form input:focus,
.customer-info-form textarea:focus {
  border-color: #d4af37;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

.whatsapp-btn {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.whatsapp-btn:hover {
  background: #1ebe57;
}

/* --- Order Page Layout --- */
.order-page-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 20px 20px;
  z-index: 10;
  min-height: 100vh;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding: 20px 20px 15px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(3, 3, 2, 0.95);
  backdrop-filter: blur(10px);
  margin-left: -20px;
  margin-right: -20px;
}

.search-container {
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.6);
  color: var(--cream);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
  border-color: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

/* --- Loading Spinner --- */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: #d4af37;
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
}

.loading-spinner.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(212, 175, 55, 0.3);
  border-top: 4px solid #d4af37;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

.category-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 15px;
  margin-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: #d4af37 transparent;

  /* Make it sticky */
  position: sticky;
  top: 75px; /* Adjust this value if there's a gap or overlap with the top header */
  z-index: 90;
  background: rgba(3, 3, 2, 0.95);
  backdrop-filter: blur(10px);
  margin-left: -20px;
  margin-right: -20px;
  padding: 10px 20px 15px 20px;
}

.category-tabs::-webkit-scrollbar { height: 6px; }
.category-tabs::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 3px; }

.category-tab {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--cream);
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Cinzel', 'Noto Naskh Arabic', serif;
  transition: all 0.3s;
}

.category-tab.active, .category-tab:hover {
  background: #d4af37;
  color: #111;
  border-color: #d4af37;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 50px;
}

.item-card {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s;
  position: relative;
}

.item-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.15);
}

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

.item-title {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'Noto Naskh Arabic', sans-serif;
}

.item-price {
  color: #d4af37;
  font-weight: bold;
  white-space: nowrap;
}

.item-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  background: #111;
  border: 1px solid #333;
}

.item-card.out-of-stock {
  opacity: 0.7;
}

.item-card.out-of-stock .item-thumb {
  filter: grayscale(100%);
}

.out-of-stock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 76, 76, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 2;
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  background: #d4af37;
  color: #111;
  padding: 12px 24px;
  border-radius: 30px;
  font-family: 'Noto Naskh Arabic', sans-serif;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

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

@keyframes cart-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3) translateY(-3px); }
}

.cart-bounce {
  animation: cart-bounce 0.3s ease-in-out;
}

/* --- Custom Dialog Modal --- */
.dialog-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.dialog-modal.show {
  opacity: 1;
  visibility: visible;
}

.dialog-content {
  background: var(--black-2);
  border: 1px solid var(--line);
  width: 90%;
  max-width: 400px;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.dialog-modal.show .dialog-content {
  transform: scale(1);
}

.dialog-content p {
  color: var(--cream);
  margin-bottom: 25px;
  line-height: 1.6;
  font-family: 'Noto Naskh Arabic', sans-serif;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.dialog-btn {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  border: none;
  transition: all 0.2s;
}

.confirm-btn {
  background: #d4af37;
  color: #111;
  font-weight: bold;
}

.confirm-btn:hover {
  background: #f8e08a;
}

.cancel-btn {
  background: transparent;
  border: 1px solid #aaa;
  color: #aaa;
}

.cancel-btn:hover {
  border-color: #fff;
  color: #fff;
}

.cancel-btn.hidden {
  display: none;
}

/* --- Mobile Adjustments for Order Page --- */
@media (max-width: 620px) {
  .items-grid {
    /* This drops the min-width so phones show 2 items per row */
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 12px;
  }

  .item-card {
    padding: 10px;
  }

  .item-thumb {
    height: 120px; /* Shorter image so cards don't look stretched */
  }

  .item-info {
    flex-direction: column; /* Stacks the price under the title */
    gap: 5px;
  }

  .item-title, .add-to-cart-btn {
    font-size: 0.95rem; /* Slightly smaller text */
  }
}