:root {
  --light-text: #333;
  --dark-text: #fff;
  --accent-color: #2a9d8f;
  --discount-color: #e74c3c;
  --light-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
  --dark-bg: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
  --card-light: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  --card-dark: linear-gradient(135deg, #21262d 0%, #30363d 100%);
  --price-gradient-light: linear-gradient(45deg, #2a9d8f 0%, #264653 100%);
  --price-gradient-dark: linear-gradient(45deg, #2a9d8f 0%, #52e5d7 100%);
  --text-gradient-light: linear-gradient(45deg, #333 0%, #495057 100%);
  --text-gradient-dark: linear-gradient(45deg, #fff 0%, #adb5bd 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--light-bg);
  color: var(--light-text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  padding: 20px;
  max-width: 1200px;
  margin: auto;
  scroll-behavior: smooth;
}

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 25px 0;
  border-bottom: 1px solid rgba(42, 157, 143, 0.2);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  margin-bottom: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: bold;
  background: var(--text-gradient-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(42, 157, 143, 0.3);
}

.subtitle {
  text-align: center;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: var(--light-text);
  margin-bottom: 10px;
  opacity: 0.8;
  background: var(--text-gradient-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-grid {
  display: grid;
  gap: 20px;
  padding: 0;
}

/* موبايل: عنصرين أفقيًا */
@media (max-width: 767px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .product-image {
    min-height: 180px;
  }
}

/* تابلت: عنصرين أفقيًا */
@media (min-width: 768px) and (max-width: 1023px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .product-image {
    min-height: 220px;
  }
}

/* كمبيوتر: 3 عناصر */
@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .product-image {
    min-height: 260px;
  }
}


.product-card {
  background: var(--card-light);
  overflow: hidden;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(42, 157, 143, 0.1);
  position: relative;
  will-change: transform;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(42, 157, 143, 0.15);
}

.product-image-container {
  position: relative;
  overflow: hidden;
  flex-grow: 1;
  cursor: pointer;
  border-radius: 20px 20px 0 0;
}

.product-image {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  aspect-ratio: 1/1;
  background-color: #f0f0f0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='200' viewBox='0 0 300 200'%3E%3Crect width='300' height='200' fill='%23f0f0f0'/%3E%3C/svg%3E");
}

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

.product-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 600;
  margin-bottom: 8px;
  background: var(--text-gradient-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-discount {
  font-size: clamp(0.85rem, 3vw, 1rem);
  background: linear-gradient(45deg, #e74c3c 0%, #c0392b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #e74c3c;
  font-weight: 500;
  opacity: 0.85;
}

.product-price {
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  background: var(--price-gradient-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  font-weight: bold;
  text-shadow: 0 2px 10px rgba(42, 157, 143, 0.3);
}

.view-button {
  background: linear-gradient(45deg, var(--accent-color) 0%, #21867a 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 5px 15px rgba(42, 157, 143, 0.3);
  transition: all 0.2s ease;
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.view-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(42, 157, 143, 0.4);
  background: linear-gradient(45deg, #21867a 0%, var(--accent-color) 100%);
}

.view-button a {
  color: white;
  text-decoration: none;
  display: block;
}

/* الوضع الداكن */
body.dark-mode {
  background: var(--dark-bg);
  color: var(--dark-text);
}

body.dark-mode .subtitle {
  background: var(--text-gradient-dark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.dark-mode header {
  background: rgba(33, 38, 45, 0.3);
  border-bottom: 1px solid rgba(42, 157, 143, 0.3);
}

body.dark-mode header h1 {
  background: var(--text-gradient-dark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.dark-mode .product-card {
  background: var(--card-dark);
  border: 1px solid rgba(42, 157, 143, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .product-name {
  background: var(--text-gradient-dark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.dark-mode .product-price {
  background: var(--price-gradient-dark);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.dark-mode .product-discount {
  background: linear-gradient(45deg, #ff6b6b 0%, #ee5a24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration-color: #ff6b6b;
}

body.dark-mode .view-button {
  background: linear-gradient(45deg, #2a9d8f 0%, #52e5d7 100%);
  box-shadow: 0 5px 15px rgba(82, 229, 215, 0.3);
}

body.dark-mode .view-button:hover {
  background: linear-gradient(45deg, #52e5d7 0%, #2a9d8f 100%);
  box-shadow: 0 8px 20px rgba(82, 229, 215, 0.4);
}

/* تأثيرات التمرير */
.scroll-reveal {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* تخصيص شريط التمرير */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #2a9d8f;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #21867a;
}

body.dark-mode ::-webkit-scrollbar-track {
  background: #1e2229;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #52e5d7;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #2a9d8f;
}

/* مؤشر التحميل */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(42, 157, 143, 0.2);
  z-index: 1000;
  overflow: hidden;
}

.loader::before {
  content: '';
  position: absolute;
  height: 3px;
  width: 50%;
  background: var(--accent-color);
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.loaded .loader {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.image-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: opacity;
}

.image-zoom-overlay.active {
  opacity: 1;
  visibility: visible;
}

.zoomed-image {
  max-width: 90%;
  max-height: 90%;
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  object-fit: contain;
  cursor: zoom-out;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

.image-zoom-overlay.active .zoomed-image {
  transform: scale(1);
}

/* تحسينات للجوال */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  header {
    padding: 20px 0;
    margin-bottom: 10px;
  }
  
  .product-grid {
    gap: 15px;
  }
  
  .product-card {
    border-radius: 15px;
  }
  
  .product-image {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }
  
  .product-grid {
   gap: 10px;
  }
  
  .product-image {
    min-height: 161px;
  }
  
  .view-button {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}
