/* styles.css - Leaf & Roll Premium Mobile Web Menu Style Sheet */

/* ==================== 1. DESIGN VARIABLES & CONFIG ==================== */
:root {
  /* Color Palette */
  --primary: #4EAF2F;
  --primary-rgb: 78, 175, 47;
  --primary-dark: #1F4C11;
  --primary-dark-rgb: 31, 76, 17;
  --accent-gold: #D4AF37;
  --accent-gold-rgb: 212, 175, 55;
  
  /* Light Mode Tokens */
  --bg-app: #F5F7F4;
  --bg-gradient: radial-gradient(circle at 50% 0%, #EBF4E8, #F5F7F4);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.5);
  --text-main: #1D2A17;
  --text-muted: #62725D;
  --glow-color: rgba(78, 175, 47, 0.15);
  --shadow-color: rgba(12, 22, 8, 0.08);
  
  /* Shared Tokens */
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --glass-blur: 24px;
  --spring-transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --fluid-transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  --ios-transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s ease;
  
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode Tokens Override */
.dark-mode {
  --bg-app: #090E07;
  --bg-gradient: radial-gradient(circle at 50% 0%, #111D0D, #090E07);
  --card-bg: rgba(18, 26, 15, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #ECEFEA;
  --text-muted: #95A591;
  --glow-color: rgba(78, 175, 47, 0.35);
  --shadow-color: rgba(0, 0, 0, 0.4);
}

/* ==================== 2. GLOBAL SYSTEM STYLES ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: #0c120a; /* Dark desktop backing for premium feel */
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Language Specific Font Bindings */
[dir="rtl"] {
  font-family: 'Cairo', sans-serif;
}

/* Base Headings Setup */
.font-playfair {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
}
[dir="rtl"] .font-cairo {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
}

/* ==================== 3. MOBILE SHELL WRAPPER (Desktop Showcase) ==================== */
#app-container, .portal-overlay, .sheet-overlay, .cart-overlay, .compare-overlay, .success-overlay {
  width: 100%;
  height: 100%;
  max-width: 450px; /* iPhone 15 Pro Max style boundary on Desktop */
  position: absolute;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  background: var(--bg-gradient);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Responsive Desktop Screen Emulation Decorator */
@media (min-width: 460px) {
  body::before {
    content: "";
    position: absolute;
    width: 460px;
    height: calc(100vh - 40px);
    border: 8px solid #222;
    border-radius: 48px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 0 20px 50px rgba(0,0,0,0.6);
    pointer-events: none;
    z-index: 9999;
  }
  #app-container, .portal-overlay, .sheet-overlay, .cart-overlay, .compare-overlay, .success-overlay {
    height: calc(100vh - 56px);
    border-radius: 40px;
  }
}

/* Dynamic Ambient Glow */
.ambient-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  max-width: 450px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.glow-1 {
  position: absolute;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(78, 175, 47, 0.18) 0%, rgba(78, 175, 47, 0) 70%);
  top: -50px;
  left: -50px;
  animation: floatGlow 12s infinite alternate ease-in-out;
}
.glow-2 {
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.12) 0%, rgba(212, 175, 55, 0) 70%);
  bottom: 100px;
  right: -50px;
  animation: floatGlow 18s infinite alternate-reverse ease-in-out;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.2); }
}

/* ==================== 4. PREMIUM GLASSMORPHISM SYSTEM ==================== */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(190%);
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 32px var(--shadow-color);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  transition: var(--fluid-transition);
}

.glass-btn:active {
  transform: scale(0.95);
  background: rgba(78, 175, 47, 0.15);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
}

/* ==================== 5. LANG SELECTION PORTAL ==================== */
.portal-overlay {
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.portal-overlay.fade-out {
  opacity: 0;
  transform: scale(1.08);
  pointer-events: none;
}

.portal-card {
  width: 100%;
  padding: 40px 24px;
  border-radius: var(--radius-xl);
  text-align: center;
  animation: slideUpPortal 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes slideUpPortal {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.portal-logo-container {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto 24px;
}

.portal-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  border: 4px solid var(--primary);
  background: #fff;
  z-index: 2;
  position: relative;
  box-shadow: 0 10px 25px rgba(78,175,47,0.25);
  animation: logoUnfurl 1.5s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes logoUnfurl {
  from { transform: scale(0.3) rotate(-120deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.logo-pulse {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: rgba(78, 175, 47, 0.4);
  z-index: 1;
  animation: pulseLogo 3s infinite;
}

@keyframes pulseLogo {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

.portal-title-container {
  margin-bottom: 36px;
}

.portal-title {
  font-size: 38px;
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: 8px;
}

.portal-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.portal-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.btn-portal {
  width: 100%;
  padding: 18px 24px;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-portal:hover, .btn-portal:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(78, 175, 47, 0.3);
}

.portal-footer {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== 6. APP MAIN SHELL LAYOUT ==================== */
#app-container {
  z-index: 10;
  display: flex;
  flex-direction: column;
  opacity: 1;
}

#app-container.app-hidden {
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}

/* Dynamic Bilingual Visibility Controller */
body[lang="en"] .ar-sub, body[lang="en"] .ar-title { display: none !important; }
body[lang="ar"] .en-sub, body[lang="ar"] .en-title { display: none !important; }

/* APP HEADER */
.app-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  border-bottom: 1px solid var(--card-border);
  border-top: none;
  border-left: none;
  border-right: none;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
}

.brand-name {
  font-size: 20px;
  color: var(--text-main);
  line-height: 1;
}

.brand-tagline {
  font-size: 10px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--card-border);
}

#lang-switch {
  font-size: 12px;
  font-weight: 800;
}

/* ==================== 7. SEARCH & HEALTH FILTER ZONE ==================== */
.search-filter-section {
  padding: 16px 20px 8px;
  z-index: 50;
}

.search-bar-container {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.search-icon {
  color: var(--primary);
  margin-right: 10px;
}
[dir="rtl"] .search-icon {
  margin-right: 0;
  margin-left: 10px;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-main);
  font-weight: 500;
}

#search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

/* Quick Health Filter Chips */
.quick-filters-container {
  overflow: hidden;
  margin: 0 -20px;
  padding: 0 20px;
}

.quick-filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 4px;
}

.quick-filters-scroll::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.filter-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(78, 175, 47, 0.25);
}

/* ==================== 8. ELASTIC CATEGORY PILLS ==================== */
.category-nav {
  padding: 8px 20px 16px;
  z-index: 40;
}

.category-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.category-icon {
  font-size: 18px;
  transition: transform 0.4s ease;
}

.category-pill-name {
  font-size: 13px;
  font-weight: 700;
}

.category-pill.active {
  background: var(--primary-dark);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(78, 175, 47, 0.2);
}

.category-pill.active .category-icon {
  transform: scale(1.22) rotate(-5deg);
}

/* ==================== 9. MAIN FEED & ITEM CARDS ==================== */
.menu-main {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 160px; /* Large bottom pad to allow scrolling over bars */
  scroll-behavior: smooth;
  z-index: 10;
}

.menu-main::-webkit-scrollbar {
  width: 4px;
}
.menu-main::-webkit-scrollbar-thumb {
  background: rgba(78,175,47,0.2);
  border-radius: 4px;
}

.section-title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.category-title-text {
  font-size: 24px;
  color: var(--text-main);
  letter-spacing: -0.5px;
}
[dir="rtl"] .category-title-text {
  font-family: 'Cairo', sans-serif;
  font-size: 20px;
}

.items-count-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(78, 175, 47, 0.12);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-xl);
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ITEM CARD DESIGN (High-Fidelity) */
.item-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 258px;
  cursor: pointer;
  transition: var(--spring-transition);
  animation: cardFadeUp 0.6s cubic-bezier(0.19, 1, 0.22, 1) both;
}

@keyframes cardFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.item-card:active {
  transform: scale(0.96) translateY(2px);
}

/* Card Image Area */
.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 130px;
  background: #eaeaea;
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.item-card:hover .card-image {
  transform: scale(1.08);
}

/* Premium Gradient Placeholder for missing photos */
.card-placeholder-bg {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #4EAF2F, #1F4C11);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-placeholder-icon {
  font-size: 32px;
  opacity: 0.75;
  animation: pulseLeaf 3s infinite ease-in-out;
}

@keyframes pulseLeaf {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.card-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, rgba(0,0,0,0.3) 100%);
}

.card-cal-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(12, 22, 8, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 2;
}

[dir="rtl"] .card-cal-badge {
  left: auto;
  right: 10px;
}

/* Custom Compare Badge on Card */
.card-compare-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(12, 22, 8, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 5;
  font-size: 11px;
  transition: var(--fluid-transition);
}

.card-compare-btn.active {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

[dir="rtl"] .card-compare-btn {
  right: auto;
  left: 10px;
}

/* Card Details Area */
.card-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 35px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.card-price {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--primary);
}

.card-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(78, 175, 47, 0.3);
  transition: var(--fluid-transition);
}

.card-add-btn svg {
  transition: transform 0.3s ease;
}

.card-add-btn:active {
  transform: scale(0.85);
  background: var(--primary-dark);
}

/* Empty Search Style */
.empty-state-container {
  text-align: center;
  padding: 60px 20px;
}
.empty-illustration {
  font-size: 64px;
  margin-bottom: 16px;
  animation: floatLeaf 4s infinite ease-in-out;
}
@keyframes floatLeaf {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(10deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
.empty-state-container p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 8px 0 24px;
}
.btn-primary {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== 10. BOTTOM FLOATING ACTION BAR ==================== */
.bottom-action-bar-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px calc(16px + var(--safe-area-bottom));
  pointer-events: none; /* Lets you tap behind if needed, buttons override */
  z-index: 500;
}

.bottom-action-bar {
  width: 100%;
  height: 66px;
  border-radius: var(--radius-xl);
  display: flex;
  justify-content: space-around;
  align-items: center;
  pointer-events: auto;
  border: 1px solid var(--card-border);
  box-shadow: 0 16px 36px var(--shadow-color);
}

.action-tab {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  transition: var(--fluid-transition);
  position: relative;
  padding: 4px 8px;
  flex: 1;
}

.action-tab svg {
  stroke: var(--text-muted);
  transition: stroke 0.3s, transform 0.3s;
}

.action-tab span {
  font-size: 9.5px;
}

.action-tab.active {
  color: var(--primary);
}

.action-tab.active svg {
  stroke: var(--primary);
  transform: translateY(-2px);
}

.cart-badge-indicator, .compare-badge-indicator {
  position: absolute;
  top: 0;
  right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid var(--bg-app);
}

.compare-badge-indicator {
  background: var(--accent-gold);
  color: #000;
}

/* ==================== 11. FLOATING QUICK BARS (Cart & Compare) ==================== */
.cart-floating-bar, .compare-floating-bar {
  position: absolute;
  bottom: 96px; /* Sits beautifully above the standard tab bar */
  left: 20px;
  right: 20px;
  height: 60px;
  border-radius: var(--radius-lg);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  z-index: 450;
  border: 1px solid rgba(78, 175, 47, 0.25);
  box-shadow: 0 12px 28px rgba(78, 175, 47, 0.15);
  animation: slideUpCartBar 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.compare-floating-bar {
  bottom: 162px; /* Stacked cleanly above the cart floating bar */
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 12px 28px rgba(212, 175, 55, 0.1);
  cursor: default;
}

@keyframes slideUpCartBar {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.cart-bar-left, .compare-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-bar-icon, .compare-bar-icon {
  font-size: 22px;
}

.cart-bar-qty, .compare-bar-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.cart-bar-sub, .compare-bar-sub {
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compare-bar-sub {
  color: var(--accent-gold);
}

.cart-bar-right, .compare-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-bar-total {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.cart-bar-chevron {
  font-size: 14px;
  color: var(--primary);
  transition: transform 0.3s;
}

[dir="rtl"] .cart-bar-chevron {
  transform: rotate(180deg);
}

.cart-floating-bar:hover .cart-bar-chevron {
  transform: translateX(4px);
}

.btn-compare-action {
  background: var(--accent-gold);
  border: none;
  color: #000;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--fluid-transition);
}

.btn-compare-action:active {
  transform: scale(0.95);
}

/* ==================== 12. BOTTOM SHEET OVERLAYS ==================== */
.sheet-overlay, .cart-overlay, .compare-overlay {
  z-index: 800;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-backdrop, .cart-backdrop, .compare-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1;
  animation: fadeInBackdrop 0.4s ease;
}

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

/* SHEET LAYOUT PANELS */
.sheet-content, .cart-panel, .compare-panel {
  position: relative;
  width: 100%;
  max-height: 85%;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  z-index: 2;
  display: flex;
  flex-direction: column;
  animation: slideUpSheet 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  overflow: hidden;
  border-bottom: none;
  border-left: none;
  border-right: none;
}

.compare-panel {
  max-height: 90%;
  height: 90%;
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-drag-handle {
  width: 40px;
  height: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  margin: 12px auto;
  flex-shrink: 0;
}

.sheet-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  font-size: 11px;
}
[dir="rtl"] .sheet-close-btn {
  right: auto;
  left: 18px;
}

.sheet-scroll-body {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 100px; /* Spacer for fixed footer */
}

/* Detail Image */
.sheet-image-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  background: #eee;
}

.sheet-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-placeholder-bg {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  justify-content: center;
  align-items: center;
}

.placeholder-icon {
  font-size: 54px;
  animation: pulseLeaf 3s infinite ease-in-out;
}

.sheet-image-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to top, var(--card-bg) 0%, rgba(0,0,0,0) 100%);
}

.favorite-circle-btn {
  position: absolute;
  bottom: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 5;
}

[dir="rtl"] .favorite-circle-btn {
  right: auto;
  left: 20px;
}

.favorite-circle-btn svg {
  stroke: #555;
  fill: none;
  transition: fill 0.3s, stroke 0.3s;
}

.favorite-circle-btn.favorited svg {
  stroke: #ff4757;
  fill: #ff4757;
}

/* Detail Content Fields */
.sheet-details-content {
  padding: 20px;
}

.sheet-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-cal-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(78, 175, 47, 0.12);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.detail-price-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.detail-item-title {
  font-size: 24px;
  color: var(--text-main);
  margin-bottom: 12px;
}

.detail-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-tag {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-xl);
}

.detail-item-description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Nutrition Panel */
.nutrition-chart {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.nutrition-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.nutrition-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nutri-row {
  display: grid;
  grid-template-columns: 80px 1fr 30px;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.bar-bg {
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.dark-mode .bar-bg {
  background: rgba(255,255,255,0.1);
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.protein-fill { background: #3498db; }
.fats-fill { background: #f1c40f; }
.carbs-fill { background: #e67e22; }

/* Fixed Detail Footer */
.sheet-cta-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px calc(16px + var(--safe-area-bottom));
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--card-border);
  z-index: 10;
  background: var(--card-bg);
}

.btn-compare-outline {
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-compare-outline.active {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

.qty-stepper {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 52px;
}
.dark-mode .qty-stepper {
  background: rgba(255,255,255,0.06);
}

.qty-btn {
  width: 36px;
  height: 100%;
  background: none;
  border: none;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s;
}

.qty-btn:active {
  background: rgba(78, 175, 47, 0.15);
}

.qty-count {
  font-size: 16px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.btn-primary-glow {
  flex: 1;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(78, 175, 47, 0.3);
  transition: var(--fluid-transition);
}

.btn-primary-glow:active {
  transform: scale(0.97);
  background: var(--primary-dark);
}

/* ==================== 13. FULL CART OVERLAY ==================== */
.cart-header, .compare-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
}

.cart-back-btn, .compare-back-btn {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
}

[dir="rtl"] .cart-back-btn, [dir="rtl"] .compare-back-btn {
  transform: rotate(180deg);
}

.cart-title, .compare-title {
  font-size: 17px;
  color: var(--text-main);
}

.cart-clear-all, .compare-clear-all {
  background: none;
  border: none;
  color: #ff4757;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* Cart Item Rows */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 180px; /* Pad for footer */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.02);
}

.cart-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #eee;
}

.cart-item-placeholder {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}

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

.cart-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.cart-item-cals {
  font-size: 10px;
  color: var(--text-muted);
}

.cart-item-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cart-qty-count {
  font-size: 14px;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}

.cart-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.cart-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Cart Calculation Footer */
.cart-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px calc(16px + var(--safe-area-bottom));
  border-top: 1px solid var(--card-border);
  background: var(--card-bg);
  z-index: 10;
}

.cart-totals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.totals-row.divider {
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.totals-row.grand-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.highlight-green {
  color: var(--primary) !important;
}

.totals-val {
  font-weight: 700;
  color: var(--text-main);
}

.btn-checkout-glow {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(78, 175, 47, 0.35);
  transition: var(--fluid-transition);
}

.btn-checkout-glow:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

/* Full-Page Selections Overlay Overrides */
.cart-overlay {
  justify-content: flex-start !important;
}

.cart-panel {
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important; /* High-end full-page mobile native experience */
  animation: slideUpFullPage 0.5s cubic-bezier(0.19, 1, 0.22, 1) !important;
}

@keyframes slideUpFullPage {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 24px !important; /* Natural padding: no absolute overlays! */
}

.cart-footer {
  position: relative !important; /* Natural block element flow: NEVER covers list items! */
  border-top: 1px solid var(--card-border) !important;
  background: var(--card-bg) !important;
  backdrop-filter: blur(10px) !important;
  padding: 16px 20px calc(16px + var(--safe-area-bottom)) !important;
  flex-shrink: 0 !important;
}

/* ==================== 14. COMPARISON BOARD MATRIX ==================== */
.compare-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.compare-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: flex-start;
}

.compare-column {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 10px 8px;
  animation: cardFadeUp 0.5s ease;
}

.compare-column.empty-slot {
  border: 2px dashed rgba(255,255,255,0.15);
  background: none;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
}

.empty-slot-plus {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 8px;
  opacity: 0.6;
}

.compare-img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #eee;
  margin-bottom: 8px;
}

.compare-title-row {
  font-size: 11px;
  font-weight: 700;
  height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-main);
}

.compare-price-row {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin-bottom: 8px;
}

.compare-stat-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  margin-bottom: 10px;
}
.dark-mode .compare-stat-block {
  background: rgba(255,255,255,0.05);
}

.compare-stat {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 4px;
}
.compare-stat:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.compare-remove-btn {
  width: 100%;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.25);
  color: #ff4757;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--fluid-transition);
}

.compare-remove-btn:active {
  transform: scale(0.95);
  background: #ff4757;
  color: #fff;
}

.compare-helper-tip {
  background: rgba(78, 175, 47, 0.08);
  border: 1px solid rgba(78, 175, 47, 0.15);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 11px;
  text-align: center;
  line-height: 1.4;
}

/* ==================== 15. COUNTER SUMMARY & RECEIPT VIEW ==================== */
.success-overlay {
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  overflow-y: auto;
}

.success-card {
  width: 100%;
  padding: 24px 16px;
  border-radius: var(--radius-xl);
  text-align: center;
  animation: zoomSuccess 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-height: 96%;
  overflow-y: auto;
}

@keyframes zoomSuccess {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.success-title {
  font-size: 19px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.success-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
}

/* Receipt Styler */
.receipt-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px dashed rgba(78, 175, 47, 0.3);
  padding: 18px 14px;
  text-align: left;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
}

[dir="rtl"] .receipt-box {
  text-align: right;
}

.receipt-header {
  font-size: 20px;
  text-align: center;
  color: var(--primary);
  margin-bottom: 4px;
}

.receipt-divider {
  border-bottom: 1.5px dashed rgba(255, 255, 255, 0.15);
  margin: 12px 0;
}
.light-mode .receipt-divider {
  border-bottom-color: rgba(0,0,0,0.1);
}

.receipt-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-main);
}

.receipt-qty {
  color: var(--primary);
  font-weight: 700;
  margin-right: 6px;
}
[dir="rtl"] .receipt-qty {
  margin-right: 0;
  margin-left: 6px;
}

.receipt-totals {
  font-size: 13px;
  font-weight: 700;
}

.grand-row {
  font-size: 15px;
  font-weight: 800;
  margin-top: 4px;
}

/* Animations Helper */
.ripple {
  position: relative;
  overflow: hidden;
}

.scroll-snap-x {
  scroll-snap-type: x mandatory;
}
.scroll-snap-item {
  scroll-snap-align: start;
}
