@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Cinzel:wght@400;700&family=El+Messiri:wght@400;700&family=Montserrat:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700;800&family=Tajawal:wght@300;400;500;700;900&display=swap');

:root {
  /* Colors */
  --white: #ffffff;
  --gold: #c9a227;
  --gold-light: #e6bc3c;
  --gold-dark: #a6811b;
  --beige: #b89a6a;
  --chocolate: #3d2314;
  --cream: #faf5ef;
  --caramel: #e6a15c;
  
  /* Theme mapping (default Light) */
  --bg-main: var(--cream);
  --bg-card: var(--white);
  --bg-header: rgba(250, 245, 239, 0.85);
  --primary: var(--gold);
  --primary-hover: var(--gold-dark);
  --secondary: var(--beige);
  --accent: var(--chocolate);
  --accent-light: var(--caramel);
  --text-main: var(--chocolate);
  --text-muted: #8c7662;
  --border: rgba(184, 154, 106, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  
  /* Shadows */
  --shadow-sm: 0 4px 6px -1px rgba(61, 35, 20, 0.05), 0 2px 4px -1px rgba(61, 35, 20, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(61, 35, 20, 0.08), 0 4px 6px -2px rgba(61, 35, 20, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(61, 35, 20, 0.12), 0 10px 10px -5px rgba(61, 35, 20, 0.06);
  --shadow-gold: 0 10px 20px -3px rgba(201, 162, 39, 0.25), 0 4px 6px -2px rgba(201, 162, 39, 0.15);
  
  /* Fonts */
  --font-en: 'Poppins', 'Montserrat', sans-serif;
  --font-ar: 'Cairo', 'Tajawal', sans-serif;
  --font-luxury-ar: 'El Messiri', 'Cairo', 'Tajawal', sans-serif;
  --font-luxury-en: 'Cinzel', serif;
}

.font-luxuryAr {
  font-family: var(--font-luxury-ar);
}
.font-luxuryEn {
  font-family: var(--font-luxury-en);
}

[data-theme="dark"] {
  /* Warm Dark Luxury Palette */
  --bg-main: #18100a;
  --bg-card: #271a11;
  --bg-header: rgba(24, 16, 10, 0.85);
  --primary: var(--gold-light);
  --primary-hover: #ffd966;
  --secondary: #c8ab7d;
  --accent: #faf5ef;
  --accent-light: #f7b267;
  --text-main: #faf5ef;
  --text-muted: #c8b7b2;
  --border: rgba(200, 171, 125, 0.15);
  --glass-bg: rgba(39, 26, 17, 0.75);
  --glass-border: rgba(230, 188, 60, 0.15);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 10px 20px -3px rgba(230, 188, 60, 0.15);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-en);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
}

html[dir="rtl"] body {
  font-family: var(--font-ar);
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

html[dir="rtl"] h1, 
html[dir="rtl"] h2, 
html[dir="rtl"] h3, 
html[dir="rtl"] h4, 
html[dir="rtl"] h5, 
html[dir="rtl"] h6 {
  letter-spacing: normal;
}

/* Glassmorphism utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

/* Shadows */
.shadow-lux-sm { box-shadow: var(--shadow-sm); }
.shadow-lux-md { box-shadow: var(--shadow-md); }
.shadow-lux-lg { box-shadow: var(--shadow-lg); }
.shadow-lux-gold { box-shadow: var(--shadow-gold); }

/* Custom Animations */
@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.95; }
}

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

@keyframes slideInSide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideInSideLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

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

@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Apply animation classes */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse-slow {
  animation: pulse-slow 4s ease-in-out infinite;
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-up {
  animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-bounce-slow {
  animation: bounceSlow 3s ease-in-out infinite;
}

/* Buttons and Interaction styling */
.btn-premium {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--white);
  box-shadow: var(--shadow-gold);
  text-decoration: none;
}

.btn-premium:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 25px -5px rgba(201, 162, 39, 0.4);
}

.btn-premium:active {
  transform: translateY(-1px) scale(0.99);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--primary);
  text-decoration: none;
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

/* Layout Elements */
.header-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: padding 0.3s, background-color 0.3s;
}

/* Hero Section */
.hero-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(22, 14, 10, 0.7), rgba(22, 14, 10, 0.75)), url('./assets/waffle_bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 2rem;
  overflow: hidden;
}

.hero-content {
  text-align: center;
  max-width: 800px;
  z-index: 10;
  color: var(--white);
}

/* Store Navigation & Filter list */
.category-btn {
  padding: 0.6rem 1.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  white-space: nowrap;
}

.category-btn:hover, .category-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Grid layout for cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 1rem 0;
}

/* Premium Product Card */
.product-card {
  background: var(--bg-card);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
}

.product-image-container {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 Aspect Ratio */
  overflow: hidden;
  background: rgba(184, 154, 106, 0.05);
}

.product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

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

.product-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--primary) 100%);
  color: var(--white);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

html[dir="rtl"] .product-badge {
  right: auto;
  left: 1rem;
}

.product-details {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-title {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.product-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex-grow: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.product-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.product-price-currency {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-inline-start: 2px;
}

/* Quantity controls in card */
.quantity-control {
  display: flex;
  align-items: center;
  background: rgba(184, 154, 106, 0.1);
  border-radius: 9999px;
  padding: 0.25rem;
}

.qty-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.qty-btn:hover {
  background: var(--primary);
  color: var(--white);
}

.qty-number {
  padding: 0 0.8rem;
  font-weight: 700;
  min-width: 1.8rem;
  text-align: center;
}

/* Cart Panel (Slide Out) */
.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-inline-start: 1px solid var(--border);
}

html[dir="rtl"] .cart-panel {
  right: auto;
  left: 0;
  transform: translateX(-100%);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
}

.cart-panel.open, html[dir="rtl"] .cart-panel.open {
  transform: translateX(0);
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(61, 35, 20, 0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Cart List */
.cart-items-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.cart-item-image {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  object-fit: cover;
}

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

.cart-item-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.cart-item-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Floating Elements (Kids menus and decorations) */
.decor-sweet {
  position: absolute;
  pointer-events: none;
  opacity: 0.15;
  z-index: 1;
  animation: float 8s ease-in-out infinite;
}

/* Custom Scrollbar for premium feel */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Toggle switches */
.toggle-icon-btn {
  background: rgba(184, 154, 106, 0.15);
  border: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  box-shadow: var(--shadow-sm);
}

.toggle-icon-btn:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-2px) rotate(10deg);
}

/* Admin Dashboard Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: rgba(184, 154, 106, 0.2);
  color: var(--text-main);
  text-align: start;
  padding: 1rem;
  font-weight: 700;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  color: var(--text-main);
  outline: none;
  transition: all 0.3s;
}

.admin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

/* Checkout Form styling */
.checkout-input {
  width: 100%;
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: all 0.3s;
}

.checkout-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: var(--bg-main);
  padding: 1rem 2rem;
  border-radius: 9999px;
  z-index: 150;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

#store-section {
  background-image: linear-gradient(rgba(250, 245, 239, 0.88), rgba(250, 245, 239, 0.88)), url('./assets/waffle_bg.png');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

[data-theme="dark"] #store-section {
  background-image: linear-gradient(rgba(24, 16, 10, 0.9), rgba(24, 16, 10, 0.9)), url('./assets/waffle_bg.png');
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .hero-container {
    background-attachment: scroll;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
