/***************************************************************
 * DESIGN SYSTEM & VARIABLES
 * Enhanced color palette and design tokens
 * Styles.css v4.15.1 
 ***************************************************************/
:root {
  /* Primary Colors */
  --emerald: #0c4a3e;
  --emerald-light: #1c6356;
  --emerald-dark: #083830;
  --sage: #1a5f4c;
  
  /* Accent Colors */
  --gold: #b78628;
  --gold-light: #d4aa47;
  --gold-dark: #8f6820;
  --desert: #f7e6c4;
  --sand: #f4e4bc;
  
  /* Neutrals */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  
  /* Feedback Colors */
  --success: #0d9488;
  --warning: #d97706;
  --error: #dc2626;
  --info: #0284c7;
  
  /* Purple for Local Deals */
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-800: #5b21b6;
  --purple-900: #4c1d95;
  
  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-arabic: 'Noto Naskh Arabic', serif;
  --font-decorative: 'Aref Ruqaa', serif;
  
  /* Spacing System */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
  
  /* Z-index Scale */
  --z-negative: -1;
  --z-elevate: 1;
  --z-sticky: 100;
  --z-drawer: 200;
  --z-dropdown: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/***************************************************************
 * GLOBAL BACKGROUND & HEADER
 ***************************************************************/
body {
  font-family: var(--font-main);
  line-height: 1.5;
  color: var(--slate-800);
  background: var(--slate-50);
  overflow-x: hidden;
}

header {
  background: var(--emerald);
  color: white;
  padding: var(--space-4) var(--space-6);
}

/***************************************************************
 * RESET & BASE STYLES
 ***************************************************************/
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

/***************************************************************
 * UTILITY CLASSES
 ***************************************************************/
.container {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

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

.arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  unicode-bidi: embed;
}

.decorative {
  font-family: var(--font-decorative);
}

/* Step transition helper */
.step-transition {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Modal fade-in and scale animation */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-animate {
  animation: modalIn 0.3s ease-out;
}

/***************************************************************
 * LOCALE MODAL STYLES
 ***************************************************************/
#localeModal {
  backdrop-filter: blur(8px);
  background: rgba(12, 74, 62, 0.2);
}

#localeModal .modal-content {
  background: white;
  transform-origin: center;
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#localeModal .modal-title {
  color: var(--emerald);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

#localeModal p {
  color: var(--slate-600);
  margin-bottom: 1.5rem;
}

.version-display {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background-color: rgba(183, 134, 40, 0.1);
  color: var(--gold);
  border-radius: var(--radius-full);
  margin-left: 0.5rem;
  font-weight: 500;
}

/* Country and Region Selection */
.country-btn, .region-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(12, 74, 62, 0.1);
  border-radius: var(--radius-md);
  background: white;
  transition: all 0.2s ease;
  text-align: left;
  cursor: pointer;
}

.country-btn:hover, .region-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--emerald);
  background-color: rgba(12, 74, 62, 0.02);
}

.country-btn::after, .region-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(12, 74, 62, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.country-btn:hover::after, .region-btn:hover::after {
  opacity: 1;
}

.country-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: rgba(12, 74, 62, 0.05);
  margin-right: 1rem;
  font-size: 1.5rem;
}

.country-name, .region-name {
  color: var(--slate-800);
  font-weight: 500;
}

.region-info {
  color: var(--slate-600);
  font-size: 0.875rem;
}

/* Grid Layout */
.region-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .region-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Back Button */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background-color: var(--slate-100);
  color: var(--slate-600);
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.back-btn:hover {
  background-color: var(--slate-200);
}

.back-icon {
  margin-right: 0.5rem;
}

/* Animation Classes */
.scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes modalScaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Responsive Adjustments */
@media (max-width: 640px) {
  #countryStep, #regionStep {
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .country-btn, .region-btn {
    padding: 0.75rem;
  }
  
  #localeModal .modal-title {
    font-size: 1.25rem;
  }
  
  #localeModal .modal-content {
    width: 95%;
    margin: 1rem;
  }
}

/* Loading States */
#locationLoading {
  animation: fadeIn 0.2s ease;
}

/* Search Input */
#regionSearch {
  transition: all 0.2s ease;
}

#regionSearch:focus {
  box-shadow: 0 0 0 3px rgba(12, 74, 62, 0.1);
}

/* Broken Image Fallback */
.broken-image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--slate-100);
  color: var(--slate-500);
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.product-image-wrapper {
  position: relative;
  height: 0;
  padding-bottom: 66.67%;
  overflow: hidden;
  background: var(--slate-100);
}

.product-image-wrapper .broken-image-fallback {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/***************************************************************
 * TOAST NOTIFICATIONS
 ***************************************************************/
.toast {
  position: relative;
  padding: 1rem;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-lg);
  margin-bottom: 0.5rem;
  max-width: 24rem;
}

.toast-info {
  border-left: 4px solid var(--info);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--error);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

/***************************************************************
 * CART STYLES
 ***************************************************************/
#cart-sidebar {
  box-shadow: var(--shadow-xl);
}

.cart-item {
  display: flex;
  padding: 1rem;
  border-bottom: 1px solid var(--slate-200);
}

.cart-item-image {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.cart-item-details {
  flex: 1;
  padding: 0 1rem;
}

.cart-item-title {
  font-weight: 500;
  color: var(--slate-800);
}

.cart-item-price {
  color: var(--emerald);
  font-weight: 600;
}

.cart-item-remove {
  color: var(--slate-400);
  transition: color var(--transition);
}

.cart-item-remove:hover {
  color: var(--error);
}

#cart-summary {
  border-top: 1px solid var(--slate-200);
  padding: 1rem;
}

.cart-total {
  display: flex;
  justify-between: space-between;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 1rem;
}

.checkout-button {
  width: 100%;
  padding: 0.75rem;
  background: var(--emerald);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background-color var(--transition);
}

.checkout-button:hover {
  background: var(--emerald-light);
}

.checkout-button:disabled {
  background: var(--slate-300);
  cursor: not-allowed;
}

/***************************************************************
 * PRODUCT CARD STYLES
 ***************************************************************/
.product-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid var(--slate-200);
}

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

.product-image-wrapper {
  position: relative;
  padding-bottom: 75%;
  background: white;
  overflow: hidden;
}

.product-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.product-card:hover .product-image-wrapper img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--emerald);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1;
}

.product-content {
  padding: 1.5rem;
}

.product-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.product-description {
  color: var(--slate-600);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.product-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.product-feature {
  background: var(--emerald-light);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.product-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.current-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--emerald);
}

.original-price {
  color: var(--slate-400);
  text-decoration: line-through;
}

.product-inventory {
  margin-bottom: 1rem;
}

.inventory-bar {
  height: 0.5rem;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.inventory-progress {
  height: 100%;
  background: var(--emerald);
  border-radius: var(--radius-full);
  transition: width var(--transition);
}

.add-to-cart-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--emerald);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all var(--transition);
}

.add-to-cart-btn:hover {
  background: var(--emerald-light);
  transform: translateY(-1px);
}

.add-to-cart-btn:disabled {
  background: var(--slate-300);
  cursor: not-allowed;
  transform: none;
}
  
  