/* DC Stores - Modern E-commerce CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   CSS Variables & Design Tokens
   ============================================ */
:root {
  /* Colors - Premium Palette */
  --primary: hsl(215, 85%, 50%);
  --primary-dark: hsl(215, 85%, 40%);
  --primary-light: hsl(215, 85%, 95%);
  --secondary: hsl(280, 70%, 55%);
  --accent: hsl(340, 90%, 55%);
  
  /* Neutral Colors */
  --dark: hsl(220, 20%, 10%);
  --gray-900: hsl(220, 15%, 15%);
  --gray-800: hsl(220, 12%, 25%);
  --gray-700: hsl(220, 10%, 35%);
  --gray-600: hsl(220, 8%, 50%);
  --gray-500: hsl(220, 6%, 65%);
  --gray-400: hsl(220, 5%, 75%);
  --gray-300: hsl(220, 5%, 85%);
  --gray-200: hsl(220, 5%, 92%);
  --gray-100: hsl(220, 5%, 97%);
  --white: hsl(0, 0%, 100%);
  
  /* Semantic Colors */
  --success: hsl(145, 65%, 45%);
  --warning: hsl(40, 95%, 55%);
  --danger: hsl(0, 75%, 55%);
  --info: hsl(200, 85%, 50%);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  --gradient-dark: linear-gradient(135deg, var(--gray-900) 0%, var(--dark) 100%);
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Typography */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;

  /* Currency Symbol */
  .currency-symbol {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.75em;
    color: var(--gray-600);
    margin-inline-start: 4px;
    display: inline-block;
    vertical-align: middle;
  }

  /* Salla Icon - Riyal Currency Symbol */
  .sicon-sar {
    color: inherit !important; /* Inherit color from parent element */
    font-size: 0.85em; /* Slightly smaller than the price */
    margin-inline-start: 4px; /* Small spacing before the icon */
    display: inline-block;
    vertical-align: middle;
  }
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-base);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ============================================
   Layout Components
   ============================================ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
}

/* ============================================
   Header & Navigation
   ============================================ */
.header {
  background: var(--white);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) 0;
}

/* Logo Animation - Rotating between text and image */
.logo-container {
  text-decoration: none;
  display: inline-block;
  perspective: 1000px;
  height: 50px;
}

.logo-flip {
  position: relative;
  width: 150px;
  height: 50px;
  transform-style: preserve-3d;
  animation: logoFlip 6s ease-in-out infinite;
}

.logo-side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.logo-text {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--secondary),
    var(--accent),
    var(--primary)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease-in-out infinite;
  transition: var(--transition-base);
}

.logo-image {
  transform: rotateY(180deg);
  background: white;
  padding: 3px;
  /* box-shadow: 0 1px 4px rgba(0,0,0,0.08); */
}

.logo-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes logoFlip {
  0%, 30% {
    transform: rotateY(0deg);
  }
  50%, 80% {
    transform: rotateY(180deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

.logo-container:hover .logo-flip {
  animation-play-state: paused;
}

.logo-container:hover .logo-text {
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.nav-links {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  color: var(--gray-700);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: var(--transition-base);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.cart-icon {
  position: relative;
  padding: var(--space-sm) var(--space-md);
  background: var(--gray-100);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.cart-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--gradient-accent);
  color: var(--white);
  font-size: var(--font-size-xs);
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  background: var(--gradient-primary);
  color: var(--white);
  padding: var(--space-3xl) 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,165.3C1248,171,1344,149,1392,138.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
  background-size: cover;
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
}

.hero h1 {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  margin-bottom: var(--space-lg);
  line-height: 1.2;
}

.hero p {
  font-size: var(--font-size-lg);
  opacity: 0.95;
  margin-bottom: var(--space-xl);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: var(--transition-base);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-secondary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: var(--shadow-lg);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

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

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover {
  background: hsl(145, 65%, 40%);
  transform: translateY(-2px);
}

.btn-sm {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
}

/* ============================================
   Product Grid
   ============================================ */
.section-title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--space-xl);
  text-align: center;
  color: var(--gray-900);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
}

.product-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl);
}

.product-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  background: var(--gray-200);
}

.product-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--gradient-accent);
  color: var(--white);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.product-info {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.product-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.product-price {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.price-current {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--primary);
}

.price-original {
  font-size: var(--font-size-lg);
  color: var(--gray-500);
  text-decoration: line-through;
}

.product-stock {
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  margin-bottom: var(--space-md);
}

.stock-available {
  color: var(--success);
  font-weight: 600;
}

.stock-low {
  color: var(--warning);
  font-weight: 600;
}

.stock-out {
  color: var(--danger);
  font-weight: 600;
}

/* Push button to bottom of card */
.product-info > form,
.product-info > button {
  margin-top: auto;
}

/* ============================================
   Categories Section
   ============================================ */
.categories {
  background: var(--white);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.category-card {
  position: relative;
  height: 200px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-base);
  cursor: pointer;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-dark);
  opacity: 0.5;
  transition: var(--transition-base);
}

.category-card:hover::before {
  opacity: 0.7;
}

.category-card:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-2xl);
}

.category-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-name {
  position: absolute;
  bottom: var(--space-lg);
  left: var(--space-lg);
  color: var(--white);
  font-size: var(--font-size-xl);
  font-weight: 700;
  z-index: 1;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--gradient-dark);
  color: var(--white);
  padding: var(--space-2xl) 0 var(--space-lg);
  margin-top: var(--space-3xl);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-xl);
}

.footer-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--gray-400);
  transition: var(--transition-base);
}

.footer-links a:hover {
  color: var(--white);
  padding-left: var(--space-xs);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--gray-400);
}

/* ============================================
   Cart & Checkout
   ============================================ */
.cart-container {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.cart-item-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.cart-summary {
  background: var(--gray-100);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  margin-top: var(--space-xl);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.summary-total {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--primary);
  padding-top: var(--space-md);
  border-top: 2px solid var(--gray-300);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  transition: var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-lg); }
.mt-3 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-lg); }
.mb-3 { margin-bottom: var(--space-xl); }

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: var(--space-md); }
.gap-2 { gap: var(--space-lg); }

/* ============================================
   Animations
   ============================================ */
@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* WhatsApp Floating Button */
.whatsapp-float {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  transition: all var(--transition-base);
}

.whatsapp-float a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: all var(--transition-base);
  text-decoration: none;
}

.whatsapp-float a:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-float svg {
  width: 32px;
  height: 32px;
  fill: white;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
  }
}

.whatsapp-float a {
  animation: pulse 2s ease-in-out infinite;
}

/* RTL Positioning for WhatsApp button */
html[dir="rtl"] .whatsapp-float {
  right: auto;
  left: 30px;
}

@media (max-width: 768px) {
  .whatsapp-float {
    bottom: 20px;
    right: 20px;
  }
  
  html[dir="rtl"] .whatsapp-float {
    right: auto;
    left: 20px;
  }
  
  .whatsapp-float a {
    width: 56px;
    height: 56px;
  }
  
  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }
}

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

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .hero h1 {
    font-size: var(--font-size-3xl);
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-lg);
  }
  
  .category-grid {
    grid-template-columns: 1fr;
  }
  
  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: var(--space-md);
  }
}
