:root {
  --brand: #e31b23;
  --brand-dark: #c00015;
  --bg: #f4f5f7;
  --fg: #1a1a1f;
  --muted: #8a8f9a;
  --border: #e5e7eb;
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { background-color: var(--bg); color: var(--fg); min-height: 100vh; }

/* ----- Arabic typography → Amiri (Cormorant Garamond is Latin-only) ----- */
html[lang="ar"] body { font-family: 'Amiri', 'Cormorant Garamond', serif; }
html[lang="ar"] .font-display-lg,
html[lang="ar"] .font-headline-lg,
html[lang="ar"] .font-headline-md,
html[lang="ar"] .font-price-lg {
  font-family: 'Amiri', serif;
  font-weight: 700;
  letter-spacing: 0;
}
html[lang="ar"] .font-label-bold,
html[lang="ar"] .font-body-lg,
html[lang="ar"] .font-body-md { font-family: 'Amiri', serif; }
html[lang="ar"] .font-label-bold { letter-spacing: 0.04em; }

/* --------------------------------- RTL ---------------------------------- */
[dir="rtl"] .accent-title { border-left: 0; border-right: 4px solid var(--brand); padding-left: 0; padding-right: 1rem; }
[dir="rtl"] .flip-x { transform: scaleX(-1); }

.accent-title { border-left: 4px solid var(--brand); padding-left: 1rem; }

/* ------------------------------ form fields ----------------------------- */
.custom-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--fg);
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
  outline: none;
  color: var(--fg);
  transition: border-color 0.25s ease;
}
.custom-input::placeholder { color: #9aa0ab; }
.box-input::placeholder { color: #9aa0ab; }
.custom-input:focus { border-bottom-color: var(--brand); box-shadow: none; }
select.custom-input { background-color: #ffffff; }
.field-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
}
html[lang="ar"] .field-label { font-family: 'Amiri', serif; letter-spacing: 0.03em; }

/* The boxed input variant used in admin / auth forms */
.box-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: var(--fg);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s ease;
}
.box-input:focus { border-color: var(--brand); }
textarea.box-input { resize: vertical; min-height: 90px; }

/* -------------------------------- buttons ------------------------------- */
.btn-primary {
  background: var(--brand);
  color: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  border: 1px solid var(--brand);
  cursor: pointer;
}
html[lang="ar"] .btn-primary { font-family: 'Amiri', serif; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid #e5e7eb;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.2s ease;
  cursor: pointer;
}
html[lang="ar"] .btn-ghost { font-family: 'Amiri', serif; letter-spacing: 0.02em; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.payment-card-active { border-color: var(--brand) !important; }

/* --------------------------------- cards -------------------------------- */
.card { background: #ffffff; border: 1px solid #e5e7eb; }
.product-card { transition: transform 0.3s ease, border-color 0.3s ease; }
.product-card:hover { transform: translateY(-4px); border-color: var(--brand); }
/* product photos always show in full colour, with no hover motion on the image */

/* badge */
.cart-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -8px;
  background: var(--brand);
  color: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ------------------------------ lang switch ----------------------------- */
.lang-btn {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  color: var(--muted);
  transition: color 0.2s ease;
  text-transform: uppercase;
}
.lang-btn:hover { color: var(--fg); }
.lang-btn.active { color: var(--brand); }

/* ------------------------------ overlays -------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* toast */
#toast-root { position: fixed; z-index: 200; bottom: 24px; inset-inline-end: 24px; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-inline-start: 3px solid var(--brand);
  padding: 12px 18px;
  font-size: 14px;
  max-width: 320px;
  animation: toast-in 0.25s ease;
}
.toast.ok { border-inline-start-color: #36c26b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* add-to-cart notice (bottom, with Checkout / Continue Shopping) */
#cart-notice-root { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 210; display: flex; justify-content: center; padding: 0 12px; pointer-events: none; }
.cart-notice { pointer-events: auto; position: relative; overflow: hidden; width: 100%; max-width: 560px; display: flex; align-items: center; gap: 16px; background: #ffffff; border: 1px solid #e5e7eb; border-top: 2px solid var(--brand); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55); padding: 14px 18px; animation: cn-in 0.3s ease; }
@keyframes cn-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.cart-notice.out { opacity: 0; transform: translateY(18px); transition: opacity 0.3s ease, transform 0.3s ease; }
.cart-notice .cn-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--brand); width: 100%; animation: cn-progress 5s linear forwards; }
[dir="rtl"] .cart-notice .cn-progress { left: auto; right: 0; }
@keyframes cn-progress { from { width: 100%; } to { width: 0; } }
@media (max-width: 560px) {
  .cart-notice { flex-direction: column; align-items: stretch; gap: 12px; }
  .cart-notice .cn-actions { justify-content: stretch; }
  .cart-notice .cn-actions > * { flex: 1; text-align: center; }
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* misc */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
a { text-decoration: none; }
.line-accent { width: 48px; height: 3px; background: var(--brand); }

/* brand wordmark — Miami Tobacco (red) + TOBACCO (white), serif & unique */
.brand-logo { position: relative; isolation: isolate; font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; letter-spacing: 0.02em; direction: ltr; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.3em; line-height: 1.05; padding-left: 0.55em; }
/* Miami palm sitting behind the wordmark. */
.logo-palm { position: absolute; left: -0.35em; top: 50%; width: 1.7em; height: 1.85em; transform: translateY(-52%); z-index: -1; opacity: 0.9; pointer-events: none; overflow: visible; }
html[dir="rtl"] .brand-logo { padding-left: 0; padding-right: 0.55em; }
html[dir="rtl"] .logo-palm { left: auto; right: -0.35em; transform: translateY(-52%) scaleX(-1); }
.brand-logo .logo-red { color: var(--brand); font-weight: 600; }
.brand-logo .logo-white { color: #1a1a1f; font-weight: 500; letter-spacing: 0.12em; font-style: italic; }
html[lang="ar"] .brand-logo { font-family: 'Amiri', serif; letter-spacing: 0; }
html[lang="ar"] .brand-logo .logo-white { letter-spacing: 0.04em; font-style: normal; }

/* ------------------------------ admin layout ----------------------------- */
#admin-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: 15rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-inline-end: 1px solid #e5e7eb;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
[dir="rtl"] #admin-sidebar { transform: translateX(100%); }
#admin-sidebar.open { transform: none; }
#admin-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 30; }
.admin-content { min-height: 100vh; }
@media (min-width: 1024px) {
  #admin-sidebar { transform: none; }
  .admin-content { margin-inline-start: 15rem; }
  #admin-overlay { display: none !important; }
}
/* admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: start; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
html[lang="ar"] .admin-table th { font-family: 'Amiri', serif; letter-spacing: 0; }
.admin-table td { padding: 12px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.admin-table tr:hover td { background: #f7f8fa; }
.lang-tab { padding: 8px 16px; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
html[lang="ar"] .lang-tab { font-family: 'Amiri', serif; }
.lang-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.stat-card { background: #ffffff; border: 1px solid #e5e7eb; padding: 20px; }
.stat-card .num { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 40px; line-height: 1; }
html[lang="ar"] .stat-card .num { font-family: 'Amiri', serif; }

/* ------------------------- product image gallery ------------------------- */
.product-detail-img { width: 100%; }
.product-gallery-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.product-thumb { width: 64px; height: 64px; flex: 0 0 auto; background: #f1f2f4; border: 1px solid #e5e7eb; overflow: hidden; cursor: pointer; opacity: 0.7; transition: opacity 0.2s, border-color 0.2s; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb.active, .product-thumb:hover { opacity: 1; border-color: var(--brand); }
/* On tablet/phone the single-column detail image must not dominate the screen */
@media (max-width: 1023px) {
  .product-detail-img { max-width: 360px; margin-inline: auto; }
}

/* ============================== PHONE THEME ============================== */
/* Phones get a smaller-scaled theme; desktop (>=768px) is left untouched.    */
@media (max-width: 767px) {
  body { font-size: 15px; }

  /* brand type tokens */
  html .text-display-lg { font-size: 40px; line-height: 1.05; }
  html .text-headline-lg { font-size: 28px; line-height: 1.1; }
  html .text-headline-md { font-size: 22px; line-height: 1.15; }
  html .text-price-lg { font-size: 19px; }
  html .text-body-lg { font-size: 16px; }

  /* tailwind sizes used in mobile-first heading patterns */
  html .text-5xl { font-size: 32px; line-height: 1.08; }
  html .text-4xl { font-size: 27px; }
  html .text-3xl { font-size: 23px; }
  html .text-2xl { font-size: 19px; }
  html .text-xl { font-size: 17px; }

  /* tighten vertical rhythm + gaps */
  html .py-stack-lg { padding-top: 34px; padding-bottom: 34px; }
  html .mt-stack-lg, html .mb-stack-lg { margin-top: 34px; margin-bottom: 34px; }
  html .gap-stack-md { gap: 18px; }
  html .gap-stack-lg { gap: 26px; }
  html .p-8 { padding: 1.25rem; }
  html .md\:p-8 { padding: 1.25rem; }

  /* product detail image: clearly smaller on phones */
  .product-detail-img { max-width: 250px; }
  .product-thumb { width: 52px; height: 52px; }

  /* admin tables scroll rather than squeeze */
  .stat-card .num { font-size: 30px; }
}

/* =========================== light-theme polish =========================== */
.card { border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.product-card { border-radius: 10px; overflow: hidden; background: #ffffff; }
.product-card:hover { box-shadow: 0 12px 26px rgba(16, 24, 40, 0.12); }
.toast { color: var(--fg); box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14); }
.cart-notice { color: var(--fg); box-shadow: 0 16px 40px rgba(16, 24, 40, 0.18); }
.box-input, select.custom-input, .btn-primary, .btn-ghost { border-radius: 6px; }
/* primary "Add to cart" button on cards */
.btn-cart { background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 6px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; transition: background 0.15s ease; }
.btn-cart:hover { background: var(--brand-dark); }
.btn-cart:disabled { background: #cdd1d9; border-color: #cdd1d9; color: #fff; cursor: not-allowed; }

/* =========================== moving flavor marquee =========================== */
.marquee { overflow: hidden; position: relative; direction: ltr; }
.marquee::before, .marquee::after { content: ""; position: absolute; top: 0; bottom: 0; width: 72px; z-index: 3; pointer-events: none; }
.marquee::before { inset-inline-start: 0; left: 0; background: linear-gradient(90deg, var(--marquee-fade, var(--bg)), transparent); }
.marquee::after { inset-inline-end: 0; right: 0; background: linear-gradient(270deg, var(--marquee-fade, var(--bg)), transparent); }
.marquee-track { display: flex; gap: 1rem; width: max-content; will-change: transform; animation: marquee-scroll var(--marquee-duration, 60s) linear infinite; }
.marquee-track.reverse { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.flavor-card { position: relative; flex: 0 0 auto; width: 168px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: #241015; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
.flavor-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.flavor-card:hover img { transform: scale(1.06); }
.flavor-card .flavor-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.82)); }
.flavor-card .flavor-meta { position: absolute; inset-inline: 0; bottom: 0; padding: 10px 12px; direction: ltr; text-align: left; }
@media (min-width: 768px) { .flavor-card { width: 200px; } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } .marquee { overflow-x: auto; } }

/* =========================== hero photo slideshow (4K shisha backgrounds) =========================== */
.hero-photos { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; will-change: opacity, transform; animation: heroKen 27s infinite; }
.hero-slide:nth-child(1) { animation-delay: 0s; }
.hero-slide:nth-child(2) { animation-delay: 9s; }
.hero-slide:nth-child(3) { animation-delay: 18s; }
@keyframes heroKen {
  0%   { opacity: 0; transform: scale(1.04); }
  3%   { opacity: 1; }
  33%  { opacity: 1; }
  36%  { opacity: 0; transform: scale(1.13); }
  100% { opacity: 0; transform: scale(1.13); }
}
.hero-scrim { background: linear-gradient(90deg, rgba(18,10,12,0.92) 0%, rgba(18,10,12,0.74) 45%, rgba(18,10,12,0.4) 100%); }
html[dir="rtl"] .hero-scrim { background: linear-gradient(270deg, rgba(18,10,12,0.92) 0%, rgba(18,10,12,0.74) 45%, rgba(18,10,12,0.4) 100%); }
@media (prefers-reduced-motion: reduce) {
  .hero-slide { animation: none; opacity: 0; transform: none; }
  .hero-slide:nth-child(1) { opacity: 1; }
}

/* =============================== Miami theme ============================== */
/* Full-bleed Miami sunset + palm scene behind the hero headline. */
.hero-scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #15101f; }
.hero-scene svg { width: 100%; height: 100%; display: block; }

/* (legacy) Warm South-Beach sunset glow — kept for other pages if needed. */
.miami-sunset {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 85% at 82% 118%, rgba(255,126,95,0.55) 0%, rgba(255,94,148,0.34) 30%, rgba(124,58,173,0.18) 55%, transparent 76%),
    linear-gradient(0deg, rgba(255,138,76,0.18) 0%, transparent 42%);
  mix-blend-mode: screen;
}
/* Palm-tree silhouettes anchored to the bottom of the hero. */
.miami-palms {
  position: absolute; right: 0; bottom: -1px; z-index: 2; pointer-events: none;
  width: min(46%, 520px); height: auto; opacity: 0.92;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45));
}
html[dir="rtl"] .miami-palms { right: auto; left: 0; transform: scaleX(-1); }
@media (max-width: 640px) { .miami-palms { width: 64%; opacity: 0.82; } }
