/* ==========================================================================
   EV CAFE — Official Customer Menu Stylesheet
   Specialty Coffee Luxury Experience · Pure Read-Only Menu
   Fonts: Cairo (400, 500, 600, 700, 800, 900) + Montserrat (800, 900)
   Color Palette: Warm Milk (#F8F5EE) & Roasted Coffee (#4A3525, #231F1C)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Typography */
  --font-arabic: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-brand: 'Montserrat', sans-serif;

  /* Warm Coffee Palette */
  --bg-page: #F8F5EE;              /* خلفية حليبية دافئة مستوحاة من القهوة */
  --bg-card: #FFFFFF;              /* أسطح الكروت: أبيض نقي معزول */
  --bg-surface: #F0E9DF;           /* خلفية البادجات ومربعات الصور */
  --bg-subtle: #E8E1D5;            /* تفاعل التحويم */
  --bg-input: #FFFFFF;

  /* Text Colors */
  --text-primary: #231F1C;         /* إسبريسو داكن مقروء وفخم */
  --text-secondary: #57524E;       /* بني دافئ للأوصاف */
  --text-muted: #8C857E;           /* رمادي دافئ للنصوص الفرعية */
  --text-inverse: #FFFFFF;

  /* Coffee Identity */
  --coffee-primary: #4A3525;       /* بني القهوة الأساسي لـ BOX COFE */
  --coffee-hover: #36261A;
  --coffee-accent: #785135;        /* كراميل محمص هادئ */
  --coffee-light: #EFE8DE;

  /* Borders */
  --border-color: #E6DFD4;
  --border-subtle: #EFE9E0;
  --border-hover: #D5CBBF;
  --border-focus: #4A3525;

  /* Status Colors */
  --status-included-bg: rgba(22, 101, 52, 0.08);
  --status-included-text: #166534;
  --status-soldout-bg: rgba(185, 28, 28, 0.09);
  --status-soldout-text: #B91C1C;

  /* Elevation & Soft Shadows */
  --shadow-sm: 0 1px 3px rgba(35, 31, 28, 0.04);
  --shadow-card: 0 2px 8px rgba(35, 31, 28, 0.04), 0 8px 20px rgba(35, 31, 28, 0.03);
  --shadow-hover: 0 4px 14px rgba(35, 31, 28, 0.08), 0 12px 28px rgba(35, 31, 28, 0.06);
  --shadow-modal: 0 24px 60px rgba(35, 31, 28, 0.22);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --radius-pill: 999px;

  /* Container */
  --container-max: 1140px;
}

/* --------------------------------------------------------------------------
   2. Base Reset & Typography
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent !important;
}

*:focus:not(:focus-visible) {
  outline: none !important;
}

html.modal-open-scroll-locked,
body.modal-open-scroll-locked {
  overflow: hidden !important;
  overscroll-behavior: contain !important;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: auto;
}

body.customer-menu-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-arabic);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================================================
   3. Clean Luxury Top Bar (الشريط العلوي — EV CAFE)
   ========================================================================== */
.menu-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 245, 238, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--border-color);
  padding: 12px 16px;
}

.header-container {
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-top-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  line-height: 1;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.brand-top-lockup:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

/* الكارد الفاخر للشعار فقط */
.brand-top-card {
  position: relative;
  width: 50px;
  height: 50px;
  background: #FFFFFF;
  border: 1.5px solid rgba(150, 91, 50, 0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 4px 12px rgba(35, 31, 28, 0.06),
    0 1px 3px rgba(150, 91, 50, 0.08);
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.brand-top-lockup:hover .brand-top-card {
  box-shadow: 
    0 6px 16px rgba(35, 31, 28, 0.09),
    0 2px 6px rgba(150, 91, 50, 0.12);
}

.brand-top-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

/* اسم البراند الفاخر فقط */
.brand-top-title {
  font-family: var(--font-brand);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.brand-top-title .brand-word-ev,
.pos-brand-title .brand-word-ev {
  color: #241B18;
}

.brand-top-title .brand-word-cafe,
.pos-brand-title .brand-word-cafe {
  color: #965B32;
  margin-inline-start: 4px;
}

.header-brand-wrap {
  display: flex;
  align-items: center;
}

/* Unified POS & Bar Brand Signature Lockup */
.pos-brand-signature {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  user-select: none;
}

.pos-brand-signature:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.pos-brand-emblem-badge {
  position: relative;
  width: 42px;
  height: 42px;
  background: #FFFFFF;
  border: 1.5px solid rgba(150, 91, 50, 0.28);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(35, 31, 28, 0.05);
  flex-shrink: 0;
  overflow: hidden;
}

.pos-brand-cup-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 9px;
  display: block;
}

.pos-brand-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.pos-brand-title {
  font-family: var(--font-brand);
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.pos-brand-subtitle {
  font-family: var(--font-arabic);
  font-size: 0.65rem;
  font-weight: 800;
  color: #8A4F2A;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand-signature-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.brand-signature-lockup:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

.brand-main-logo {
  height: 48px;
  width: auto;
  max-width: 230px;
  object-fit: contain;
  display: block;
}

@media (max-width: 480px) {
  .menu-header {
    padding: 10px 14px;
  }
  .brand-top-card {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .brand-top-title {
    font-size: 1.35rem;
    letter-spacing: 0.14em;
  }
  .brand-main-logo {
    height: 40px;
    max-width: 180px;
  }
  .pos-brand-emblem-badge {
    width: 38px;
    height: 38px;
  }
  .pos-brand-cup-img {
    width: 32px;
    height: 32px;
  }
  .pos-brand-title {
    font-size: 1.08rem;
  }
}

.header-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-badge-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.meta-badge-card.highlight {
  background: var(--bg-surface);
  border-color: rgba(120, 81, 53, 0.25);
  color: var(--coffee-primary);
  font-weight: 600;
}

.meta-badge-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .menu-header {
    padding: 10px 14px;
  }

  .header-container {
    justify-content: center;
    align-items: center;
  }
}

/* --------------------------------------------------------------------------
   4. Search & Categories Navigation (البحث والتصنيفات)
   -------------------------------------------------------------------------- */
.customer-main-view {
  flex: 1;
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 16px 16px 48px;
}

.search-filter-section {
  margin-bottom: 24px;
}

.search-box-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box-wrapper:focus-within {
  border-color: var(--coffee-primary);
  box-shadow: 0 0 0 3px rgba(74, 53, 37, 0.12);
}

.search-icon-pos {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
  pointer-events: none;
  color: var(--text-muted);
}

.search-icon-pos .icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}

.search-input {
  width: 100%;
  min-height: 50px;
  padding: 10px 50px 10px 44px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  border-radius: var(--radius-card);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-clear-btn {
  position: absolute;
  left: 12px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background: var(--coffee-primary);
  color: #FFFFFF;
}

.search-clear-btn .icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* Categories Horizontal Scroll Bar (Full-bleed with subtle luxury edge fade) */
.categories-nav {
  margin-top: 14px;
  width: calc(100% + 32px);
  margin-inline: -16px;
  padding-inline: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  padding-top: 2px;
  padding-bottom: 6px;
  /* Default fade-left mask in RTL so cut-off pills gracefully fade instead of looking like a hard wall */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
}

.categories-nav::-webkit-scrollbar {
  display: none;
}

.categories-nav.fade-left-only {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
}

.categories-nav.fade-right-only {
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
  mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) 100%);
}

.categories-nav.fade-both {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 1) 28px, rgba(0, 0, 0, 1) calc(100% - 28px), transparent 100%);
}

.categories-nav.fade-none {
  -webkit-mask-image: none;
  mask-image: none;
}

@media (min-width: 1024px) {
  .categories-nav,
  .categories-nav.fade-left-only,
  .categories-nav.fade-right-only,
  .categories-nav.fade-both {
    width: 100%;
    margin-inline: 0;
    padding-inline: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

.categories-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  padding-inline-end: 16px;
  scroll-snap-type: x proximity;
}

.category-item {
  flex-shrink: 0;
  scroll-snap-align: start;
}

.category-pill-btn {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-arabic);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
  -webkit-user-select: none;
}

@media (hover: hover) {
  .category-pill-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface);
    color: var(--text-primary);
  }
}

.category-pill-btn:active {
  transform: scale(0.97);
}

.category-pill-btn.active {
  background: var(--coffee-primary);
  border-color: var(--coffee-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(74, 53, 37, 0.22);
}

/* --------------------------------------------------------------------------
   5. Category Sections & Titles (عناوين الأقسام)
   -------------------------------------------------------------------------- */
.category-block {
  margin-bottom: 36px;
}

.category-header {
  margin-bottom: 16px;
  padding-bottom: 6px;
}

.category-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-accent-bar {
  display: inline-block;
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: var(--coffee-primary);
  flex-shrink: 0;
}

.category-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.category-desc {
  display: none !important;
}

/* --------------------------------------------------------------------------
   6. Product Cards Grid (كروت المنتجات)
   -------------------------------------------------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2 columns on mobile */
  gap: 12px;
}

@media (max-width: 359px) {
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

/* Tablet (iPad): 3 balanced columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* Desktop: 4 columns or auto-fill */
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }
}

/* Product Card Component */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.product-card:focus,
.product-card:focus-visible {
  outline: none !important;
}

.product-card.unavailable {
  opacity: 0.72;
}

/* Card Media (Pure White Studio Photography) */
/* Card Media (Seamless Luxury Studio Product Presentation) */
.product-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #FFFFFF;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  display: block;
  mix-blend-mode: multiply;
  filter: contrast(1.05) brightness(1.03);
  transform: scale(1.12);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-card-img {
  transform: scale(1.2);
}

.product-image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--coffee-accent);
  background: linear-gradient(135deg, #F3ECE2 0%, #EBE3D7 100%);
}

.placeholder-coffee-svg {
  width: 32px;
  height: 32px;
  opacity: 0.75;
}

.placeholder-brand-text {
  font-family: var(--font-brand);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  opacity: 0.6;
}

.product-soldout-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(185, 28, 28, 0.9);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

/* Card Body */
.product-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 10px 10px 12px;
  justify-content: space-between;
  gap: 8px;
}

.product-card-top-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 3px;
  line-height: 1.35;
}

/* Subtle Options Hint (بديل خيارات متعددة المربكة) */
.product-custom-hint {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--coffee-accent);
  margin-bottom: 4px;
}

.product-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Footer: Price & Details Button */
.product-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
}

.product-price-row {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  width: 100%;
}

.price-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--coffee-primary);
  font-feature-settings: "tnum";
}

.price-currency {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.view-details-btn {
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 14px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #3A281A 0%, #21160E 100%);
  border: 1px solid rgba(120, 81, 53, 0.4);
  box-shadow: 0 2px 8px rgba(33, 22, 14, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: var(--font-arabic);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
}

.view-details-btn .btn-text {
  letter-spacing: -0.01em;
  font-weight: 700;
  color: #FFFFFF;
}

.view-details-btn .btn-action-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.22s ease;
  flex-shrink: 0;
}

.view-details-btn .btn-arrow-icon,
.view-details-btn .btn-plus-icon {
  width: 13px;
  height: 13px;
  stroke: #FFFFFF;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
}

.view-details-btn:focus,
.view-details-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.product-card:hover .view-details-btn,
.view-details-btn:hover {
  background: linear-gradient(135deg, #4A3525 0%, #2D1E13 100%);
  border-color: rgba(180, 130, 90, 0.55);
  box-shadow: 0 4px 14px rgba(33, 22, 14, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.product-card:hover .btn-action-badge,
.view-details-btn:hover .btn-action-badge {
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-2px) scale(1.06);
}

.view-details-btn:active {
  transform: scale(0.98);
}

.view-details-btn.is-unavailable {
  background: #EFE9E0;
  color: #8C857E;
  border-color: #E2DAD0;
  box-shadow: none;
  cursor: not-allowed;
  justify-content: center;
}

.view-details-btn.is-unavailable .btn-text {
  color: #8C857E;
  font-size: 0.76rem;
  font-weight: 600;
}

@media (max-width: 359px) {
  .view-details-btn {
    min-height: 36px;
    padding: 0 8px 0 10px;
    font-size: 0.76rem;
  }
  .view-details-btn .btn-action-badge {
    width: 20px;
    height: 20px;
  }
  .view-details-btn .btn-arrow-icon {
    width: 11px;
    height: 11px;
  }
}

/* --------------------------------------------------------------------------
   7. Item Details Modal / Drawer (نافذة تفاصيل الصنف)
   -------------------------------------------------------------------------- */
dialog.customization-modal {
  width: min(540px, calc(100% - 24px));
  max-height: min(88vh, 760px);
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-modal);
  color: var(--text-primary);
  overflow: hidden;
  outline: none !important;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

dialog.customization-modal:focus,
dialog.customization-modal:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

dialog.customization-modal::backdrop {
  background: rgba(35, 31, 28, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modalBackdropFade 0.22s ease forwards;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalBackdropFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  dialog.customization-modal {
    width: 100%;
    max-width: 100%;
    margin-top: auto;
    margin-bottom: 0;
    margin-inline: 0;
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    max-height: min(84dvh, 84vh);
    height: auto;
    overflow: hidden;
    animation: modalSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes modalSlideUp {
    from {
      opacity: 0.6;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .modal-content-shell {
    max-height: min(84dvh, 84vh);
    height: 100%;
  }
}

.modal-content-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 760px);
  height: 100%;
  overflow: hidden;
  position: relative;
}

.modal-top-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
}

.modal-close-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.18s ease;
}

.modal-close-btn:hover {
  background: var(--coffee-primary);
  color: #FFFFFF;
}

.modal-close-btn:focus,
.modal-close-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.modal-close-btn .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
}

.modal-hero-header {
  position: relative;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.modal-thumb-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 240px;
  overflow: hidden;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-thumb-box img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: contain;
  padding: 12px;
  display: block;
  mix-blend-mode: multiply;
  filter: contrast(1.05) brightness(1.03);
}

.modal-title-group {
  padding: 18px 20px 14px;
}

.modal-product-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.modal-product-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 10px;
}

.modal-price-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--coffee-primary);
}

.modal-scrollable-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-read-group {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.group-name-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.group-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.group-badge.required {
  background: rgba(120, 81, 53, 0.12);
  color: var(--coffee-accent);
}

.group-badge.optional {
  background: var(--bg-surface);
  color: var(--text-muted);
}

.read-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.read-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.read-option-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.read-option-icon {
  display: flex;
  align-items: center;
  color: var(--coffee-accent);
}

.read-option-icon .icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.read-option-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.read-option-badge.included {
  background: var(--status-included-bg);
  color: var(--status-included-text);
}

.read-option-badge.extra {
  background: var(--bg-surface);
  color: var(--coffee-primary);
}

.modal-info-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.modal-info-note .icon {
  width: 20px;
  height: 20px;
  stroke: var(--coffee-accent);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.modal-footer.read-only-footer {
  flex-shrink: 0;
  padding: 12px 20px max(24px, env(safe-area-inset-bottom, 24px));
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.modal-dismiss-btn {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-pill);
  background: var(--coffee-primary);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-arabic);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(35, 31, 28, 0.15);
}

.modal-dismiss-btn:hover {
  background: var(--coffee-hover);
}

.modal-dismiss-btn:active {
  transform: scale(0.98);
}

.modal-dismiss-btn:focus,
.modal-dismiss-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* --------------------------------------------------------------------------
   8. States (Skeleton, Empty, Error)
   -------------------------------------------------------------------------- */
.skeleton-loading-container {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.skeleton-box {
  background: linear-gradient(90deg, #EDE7DD 25%, #F5EFE5 50%, #EDE7DD 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.6s infinite ease-in-out;
  border-radius: var(--radius-md);
}

.skeleton-bar {
  width: 180px;
  height: 28px;
  margin-bottom: 8px;
}

.skeleton-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 359px) {
  .skeleton-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .skeleton-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .skeleton-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }
}

.skeleton-card {
  height: 260px;
  border-radius: var(--radius-card);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.menu-empty-view, .error-screen-view {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 36px 20px;
  text-align: center;
  max-width: 480px;
  margin: 32px auto;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-icon-circle, .error-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coffee-primary);
  margin-bottom: 14px;
}

.empty-icon-circle .icon, .error-icon-circle .icon {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}

.menu-empty-view h3, .error-screen-view h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.menu-empty-view p, .error-screen-view p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 16px;
}

.retry-action-btn {
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--coffee-primary);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-arabic);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.retry-action-btn:hover {
  background: var(--coffee-hover);
}

.retry-action-btn .icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}

/* --------------------------------------------------------------------------
   9. Footer (الفوتر)
   -------------------------------------------------------------------------- */
.customer-menu-footer {
  margin-top: auto;
  background: #EFE8DE;
  border-top: 1px solid var(--border-color);
  padding: 24px 16px;
  text-align: center;
}

.footer-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footer-brand {
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.footer-tagline {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   10. Accessibility & Performance
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--coffee-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   11. Customer Menu Reference Direction
   Dark espresso catalog inspired by the supplied reference image.
   The customer menu remains read-only; only presentation is changed.
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg-page: #11100f;
  --bg-card: #1d1b19;
  --bg-surface: #28231f;
  --bg-subtle: #332b24;
  --bg-input: #1d1b19;
  --text-primary: #fff8ef;
  --text-secondary: #c9b9a8;
  --text-muted: #998c7f;
  --coffee-primary: #d39a67;
  --coffee-hover: #e2ac78;
  --coffee-accent: #d39a67;
  --coffee-light: #3b2c21;
  --border-color: rgba(255, 245, 231, 0.12);
  --border-subtle: rgba(255, 245, 231, 0.08);
  --border-hover: rgba(211, 154, 103, 0.48);
  --border-focus: #d39a67;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.16);
  --shadow-card: 0 10px 26px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 16px 34px rgba(0, 0, 0, 0.34);
  --shadow-modal: 0 28px 80px rgba(0, 0, 0, 0.52);
}

html,
body.customer-menu-body {
  background: var(--bg-page);
  color: var(--text-primary);
}

body.customer-menu-body {
  background:
    radial-gradient(circle at 50% -15%, rgba(177, 117, 72, 0.16), transparent 34rem),
    var(--bg-page);
}

.menu-header {
  background: rgba(17, 16, 15, 0.88);
  border-bottom-color: rgba(255, 245, 231, 0.09);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

.brand-top-card {
  background: #2a231e;
  border-color: rgba(211, 154, 103, 0.38);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.brand-top-title .brand-word-ev,
.pos-brand-title .brand-word-ev {
  color: #fff8ef;
}

.brand-top-title .brand-word-cafe,
.pos-brand-title .brand-word-cafe {
  color: var(--coffee-primary);
}

.customer-main-view {
  max-width: 1240px;
  padding: 22px 18px 64px;
}

.search-filter-section {
  margin-bottom: 30px;
}

.categories-nav {
  margin-top: 0;
  padding-top: 2px;
  padding-bottom: 8px;
}

.categories-list {
  gap: 10px;
}

.category-pill-btn {
  min-height: 42px;
  padding: 8px 19px;
  background: #211f1c;
  border-color: rgba(255, 245, 231, 0.12);
  color: var(--text-secondary);
  box-shadow: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.category-pill-btn.active {
  background: var(--coffee-primary);
  border-color: var(--coffee-primary);
  color: #1a120c;
  box-shadow: 0 7px 18px rgba(211, 154, 103, 0.2);
}

.category-block {
  margin-bottom: 44px;
}

.category-header {
  margin-bottom: 16px;
  padding: 0 2px 11px;
  border-bottom: 1px solid rgba(255, 245, 231, 0.1);
}

.category-title-wrap {
  gap: 12px;
}

.category-accent-bar {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coffee-primary), rgba(211, 154, 103, 0.15));
}

.category-title {
  color: var(--text-primary);
  font-size: clamp(1.1rem, 2vw, 1.38rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.products-grid {
  gap: 14px;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .products-grid {
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 18px;
  }
}

.product-card {
  background: linear-gradient(180deg, #211f1d 0%, #1a1917 100%);
  border-color: rgba(255, 245, 231, 0.11);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.product-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.product-card-media {
  aspect-ratio: 1 / 0.9;
  background: #f4f0e9;
  padding: 0;
}

.product-card-img {
  padding: 0;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: contrast(1.04) saturate(0.98);
  transform: scale(1.04);
}

.product-card:hover .product-card-img {
  transform: scale(1.09);
}

.product-card-body {
  padding: 13px 14px 14px;
  gap: 10px;
}

.product-name {
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.45;
}

.product-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
  -webkit-line-clamp: 1;
}

.product-card-footer {
  padding-top: 10px;
  border-top-color: rgba(255, 245, 231, 0.1);
  gap: 6px;
}

.product-price-row {
  gap: 5px;
}

.price-amount {
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.price-currency {
  color: var(--coffee-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.product-detail-label {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  color: var(--coffee-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.product-detail-label span {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

.product-card:hover .product-detail-label span {
  transform: translateX(-3px);
}

.product-detail-label.is-unavailable {
  color: var(--text-muted);
}

.product-soldout-badge {
  top: 10px;
  left: 10px;
  background: rgba(102, 32, 27, 0.92);
  color: #ffe8de;
  border: 1px solid rgba(255, 208, 191, 0.2);
}

.menu-empty-view,
.error-screen-view {
  background: #1c1a18;
  border-color: rgba(255, 245, 231, 0.12);
  box-shadow: var(--shadow-card);
}

.empty-icon-circle,
.error-icon-circle {
  background: #30271f;
  color: var(--coffee-primary);
}

.skeleton-box {
  background: linear-gradient(90deg, #1f1d1a 25%, #2a2521 50%, #1f1d1a 75%);
  background-size: 200% 100%;
}

.customer-menu-footer {
  background: #171513;
  border-top-color: rgba(255, 245, 231, 0.09);
}

.footer-brand {
  color: var(--text-primary);
}

.footer-tagline {
  color: var(--text-muted);
}

dialog.customization-modal {
  background: #1c1a18;
  border-color: rgba(255, 245, 231, 0.12);
}

dialog.customization-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.modal-hero-header,
.modal-footer.read-only-footer {
  background: #211f1d;
  border-color: rgba(255, 245, 231, 0.1);
}

.modal-thumb-box {
  background: #f4f0e9;
}

.modal-title-group,
.modal-scrollable-body {
  color: var(--text-primary);
}

.modal-product-name,
.group-name-title,
.read-option-main {
  color: var(--text-primary);
}

.modal-product-desc,
.menu-empty-view p,
.error-screen-view p {
  color: var(--text-secondary);
}

.modal-price-pill,
.modal-read-group,
.read-option-card,
.modal-info-note {
  background: #171513;
  border-color: rgba(255, 245, 231, 0.1);
}

.read-option-card {
  color: var(--text-primary);
}

.modal-dismiss-btn,
.retry-action-btn {
  background: var(--coffee-primary);
  color: #1b120c;
}

@media (max-width: 640px) {
  .customer-main-view {
    padding: 17px 12px 48px;
  }

  .category-block {
    margin-bottom: 34px;
  }

  .product-card-body {
    padding: 11px 11px 12px;
  }

  .product-name {
    font-size: 0.88rem;
  }

  .price-amount {
    font-size: 0.98rem;
  }
}

/* ==========================================================================
   12. Fixed Catalog App Bar
   A single branded navigation surface keeps the logo and section tabs together
   while the catalog scrolls underneath it.
   ========================================================================== */
.menu-header {
  position: sticky;
  top: 0;
  padding: 13px 18px 10px;
  border: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(17, 16, 15, 0.94);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  isolation: isolate;
}

.menu-header::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset-inline: 0;
  bottom: -22px;
  height: 24px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(17, 16, 15, 0.22), transparent);
}

.header-container {
  width: min(100%, var(--container-max));
  min-height: 48px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(255, 245, 231, 0.12);
}

.brand-top-lockup {
  gap: 11px;
}

.brand-top-card {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.brand-top-title {
  font-size: clamp(1.25rem, 3vw, 1.58rem);
}

.search-filter-section {
  width: min(100%, var(--container-max));
  margin: 0 auto;
  padding: 11px 0 0;
}

.categories-nav,
.categories-nav.fade-left-only,
.categories-nav.fade-right-only,
.categories-nav.fade-both,
.categories-nav.fade-none {
  width: 100%;
  margin: 0;
  padding: 0 0 5px;
  border-radius: 0 0 18px 18px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 74%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 74%, transparent 100%);
}

.categories-list {
  gap: 8px;
  padding-inline: 2px 12px;
}

.category-pill-btn {
  min-height: 39px;
  padding: 7px 16px;
  background: rgba(255, 245, 231, 0.055);
  border-color: rgba(255, 245, 231, 0.11);
  box-shadow: none;
  font-size: 0.82rem;
}

.category-pill-btn.active {
  background: var(--coffee-primary);
  border-color: var(--coffee-primary);
  box-shadow: 0 8px 18px rgba(211, 154, 103, 0.23);
}

.customer-main-view {
  padding-top: 30px;
}

.category-block {
  scroll-margin-top: 154px;
}

@media (max-width: 640px) {
  .menu-header {
    padding: 10px 14px 8px;
    border-radius: 0 0 22px 22px;
  }

  .header-container {
    min-height: 43px;
    padding-bottom: 9px;
  }

  .brand-top-card {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .brand-top-title {
    font-size: 1.2rem;
    letter-spacing: 0.12em;
  }

  .search-filter-section {
    padding-top: 9px;
  }

  .categories-nav,
  .categories-nav.fade-left-only,
  .categories-nav.fade-right-only,
  .categories-nav.fade-both,
  .categories-nav.fade-none {
    width: calc(100% + 28px);
    margin-inline: -14px;
    padding-inline: 14px;
    padding-bottom: 4px;
  }

  .categories-list {
    gap: 7px;
    padding-inline: 0 14px;
  }

  .category-pill-btn {
    min-height: 36px;
    padding: 6px 13px;
    font-size: 0.75rem;
  }

  .customer-main-view {
    padding-top: 25px;
  }

  .category-block {
    scroll-margin-top: 132px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-pill-btn,
  .brand-top-lockup {
    transition: none;
  }
}
