/* ===================================
   ROOT VARIABLES & FONT LOADING
   =================================== */
:root {
  /* Colors */
  --color-primary: #c9a24d;
  --color-primary-dark: #b8923f;
  --color-primary-light: #d4ad5a;
  --color-bg: #0f0a08;
  --color-bg-light: #1a1410;
  --color-bg-lighter: #2a201c;
  --color-text: #f5f5f5;
  --color-text-muted: #b8b8b8;
  --color-border: rgba(201, 162, 77, 0.2);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.4);
}

/* Optimized font loading with font-display swap */
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("assets/fonts/Cairo-Light.woff2") format("woff2"), url("assets/fonts/Cairo-Light.woff") format("woff");
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/Cairo-Regular.woff2") format("woff2"), url("assets/fonts/Cairo-Regular.woff") format("woff");
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/Cairo-SemiBold.woff2") format("woff2"), url("assets/fonts/Cairo-SemiBold.woff") format("woff");
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/Cairo-Bold.woff2") format("woff2"), url("assets/fonts/Cairo-Bold.woff") format("woff");
}

/* ===================================
   BASE STYLES
   =================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Prevent layout shift */
  overflow-x: hidden;
}

body {
  font-family: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  /* Better font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Optimize image rendering */
img {
  max-width: 100%;
  height: auto;
  display: block;
  /* Better image rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Lazy loading styles */
img[loading="lazy"] {
  /* Add subtle fade-in effect */
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded,
img[loading="eager"] {
  opacity: 1;
}

/* Added utility class for hiding elements on desktop */
@media (min-width: 1024px) {
  .mobile-only {
    display: none !important;
  }
}

/* ===================================
   LOADING SCREEN
   =================================== */

/* ===================================
   HEADER
   =================================== */

/* Removed duplicate cart-btn definition at line 299-305 */
/* Original cart-btn styles are already defined earlier */

/* ===================================
   TOAST NOTIFICATION
   =================================== */
/* Enhanced toast with better styling and close button */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(26, 20, 16, 0.95);
  backdrop-filter: blur(20px);
  color: var(--color-text);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 77, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateX(calc(100% + 2rem));
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 300px;
  max-width: 400px;
}

[dir="rtl"] .toast {
  right: auto;
  left: 2rem;
  transform: translateX(calc(-100% - 2rem));
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.95rem;
}

.toast-close {
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

/* ===================================
   BACK TO TOP BUTTON
   =================================== */
/* Added back to top button styles */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 50px;
  height: 50px;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201, 162, 77, 0.3);
  transition: all 0.3s ease;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

[dir="rtl"] .back-to-top {
  left: auto;
  right: 2rem;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.back-to-top:hover {
  background: #d4ad5a;
  transform: translateY(-5px);
  box-shadow: 0 6px 25px rgba(201, 162, 77, 0.4);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* ===================================
   LOADING SKELETON
   =================================== */
/* Added skeleton loading animation for menu items */
.menu-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
}

.skeleton-card {
  background: rgba(201, 162, 77, 0.1);
  border-radius: 16px;
  padding: 1rem;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-card::before {
  content: "";
  display: block;
  width: 100%;
  height: 200px;
  background: rgba(201, 162, 77, 0.15);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.skeleton-card::after {
  content: "";
  display: block;
  width: 60%;
  height: 20px;
  background: rgba(201, 162, 77, 0.15);
  border-radius: 4px;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ===================================
   MODAL ENHANCEMENTS
   =================================== */
/* Added focus trap styles for modals */
.modal-open {
  overflow: hidden;
}

.modal-content:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===================================
   IMPROVED RTL SUPPORT
   =================================== */
/* Enhanced RTL support for various elements */
[dir="rtl"] .scroll-indicator {
  transform: scaleX(-1);
}

[dir="rtl"] .hero-actions .btn svg {
  transform: scaleX(-1);
}

[dir="rtl"] .menu-controls .search-box svg {
  right: auto;
  left: 1rem;
}

[dir="rtl"] .menu-controls .search-box input {
  padding-right: 1rem;
  padding-left: 3rem;
}

/* ===================================
   ACCESSIBILITY IMPROVEMENTS
   =================================== */
/* Added focus visible styles for better keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-bg);
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100000;
}

.skip-to-content:focus {
  top: 0;
}

/* ===================================
   RESPONSIVE IMPROVEMENTS
   =================================== */
@media (max-width: 768px) {
  .toast {
    bottom: 6rem;
    right: 1rem;
    left: 1rem;
    min-width: auto;
    max-width: none;
  }

  .back-to-top {
    bottom: 6rem;
    width: 45px;
    height: 45px;
  }
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   =================================== */
/* Use will-change for animated elements */
.hero-bg-img,
.loading-spinner,
.menu-card,
.cart-sidebar {
  will-change: transform;
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* Optimize backdrop-filter performance */
.header,
.cart-sidebar,
.toast {
  /* Use transform3d to trigger GPU acceleration */
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

/* ===================================
   RESPONSIVE IMAGES
   =================================== */
/* Ensure images maintain aspect ratio */
.menu-card-image,
.hero-bg-img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}

.menu-card-image {
  aspect-ratio: 4 / 3;
}
