:root {
  --bg: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #e2e8f0 100%);
  --card: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
  --text: #0f172a;
  --text-light: #475569;
  --primary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --border: rgba(226, 232, 240, 0.8);
  --shadow: 0 8px 32px rgba(59, 130, 246, 0.12);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass: rgba(255, 255, 255, 0.1);
  --backdrop: blur(20px);
  --notification-bg: #ef4444;
  --notification-color: white;
  --main-blue: #1d4ed8; /* لون أزرق ثابت */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: linear-gradient(135deg, #000000 0%, #0f172a 50%, #1e293b 100%);
    --card: linear-gradient(145deg, #111827 0%, #1f2937 100%);
    --text: #f8fafc;
    --text-light: #cbd5e1;
    --primary: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --border: rgba(51, 65, 85, 0.6);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass: rgba(255, 255, 255, 0.05);
    --notification-bg: #f87171;
    --main-blue: #3b82f6; /* لون أزرق ثابت للوضع المظلم */
  }
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}
/* مؤشر التحميل */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(59, 130, 246, 0.2);
  z-index: 1000;
  overflow: hidden;
}
.loader::before {
  content: '';
  position: absolute;
  height: 3px;
  width: 50%;
  background: var(--primary);
  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;
}
/* شريط التنقل المركزي */
.nav-center {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 15px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 50px;
  padding: 10px 25px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.4s ease;
}
@media (prefers-color-scheme: dark) {
  .nav-center {
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}
/* أزرار ثابتة بلون أزرق واحد ونص واضح */
.nav-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 25px;
  background: var(--main-blue);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  z-index: 1;
}
.nav-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(59, 130, 246, 0.3);
  background: #1e3a8a;
}
.nav-button i {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}
.nav-button:hover i {
  transform: scale(1.15);
}
/* زر السلة */
.cart-btn {
  background: var(--main-blue) !important;
  color: white !important;
}
.cart-btn:hover {
  background: #1e3a8a !important;
}
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--notification-bg);
  color: var(--notification-color);
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
  z-index: 2;
}
.cart-count.no-items {
  animation: none;
  opacity: 0.7;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
/* مغلف الإشعار لتسجيل الخروج */
.notification-envelope {
  position: absolute;
  top: -5px;
  left: -5px;
  width: 20px;
  height: 20px;
  background: var(--notification-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.6rem;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 2;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s ease;
}
.login-btn.logged-in .notification-envelope {
  opacity: 1;
  transform: scale(1);
}
.login-btn.logged-in::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}
/* تأثيرات إضافية */
.nav-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
/* نافذة تأكيد تسجيل الخروج المخصصة */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.confirm-modal.active {
  opacity: 1;
  pointer-events: all;
}
.confirm-modal-content {
  background: var(--card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border: 1px solid var(--border);
}
.confirm-modal.active .confirm-modal-content {
  transform: translateY(0);
  opacity: 1;
}
.confirm-modal-header {
  padding: 25px 25px 15px;
  text-align: center;
  position: relative;
}
.confirm-modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.confirm-modal-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
  overflow: hidden;
}
.confirm-modal-icon::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.7; }
}
.confirm-modal-icon i {
  font-size: 2.2rem;
  color: white;
  position: relative;
  z-index: 1;
}
.confirm-modal-body {
  padding: 0 25px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1.6;
}
.confirm-modal-footer {
  display: flex;
  padding: 15px 25px 25px;
  gap: 15px;
}
.confirm-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.confirm-btn.cancel {
  background: rgba(226, 232, 240, 0.5);
  color: var(--text);
}
.confirm-btn.confirm {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.confirm-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(135, 130, 246, 0.35);
}
.confirm-btn.cancel:hover {
  background: rgba(203, 213, 225, 0.7);
}
.confirm-btn.confirm:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
}
.confirm-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}
/* المحتوى الرئيسي */
.container {
  max-width: 1200px;
  margin: 80px auto 40px;
  padding: 0 20px;
}
.subtitle {
  text-align: center;
  font-size: 1.5rem;
  margin: 20px 0 30px;
  background: linear-gradient(45deg, #3b82f6, #1d4ed8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
/* شبكة المنتجات - 3 منتجات للكمبيوتر */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  padding: 20px 0;
}

/* 2 منتجات للموبايل (الحل النهائي الذي يعمل حتى في أصغر الشاشات) */
@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* منع تمدد العناصر */
  .product-card {
    min-width: 0 !important;
    width: 100%;
  }
  
  /* تقليل حجم العناصر للحفاظ على التناسق */
  .product-image {
    height: 200px;
  }
  .product-title {
    font-size: 1.1rem;
  }
  .price {
    font-size: 1.2rem;
  }
}

/* 2 منتجات حتى في الموبايل الصغير جدًا (حتى 320px) */
@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* ضمان عدم تقليل حجم الصورة بشكل مفرط */
  .product-image {
    height: 160px !important;
    min-height: 160px !important;
  }
  
  /* تحسين حجم النصوص */
  .product-title {
    font-size: 0.95rem !important;
    min-height: 45px !important;
  }
  
  .price {
    font-size: 1.1rem !important;
  }
  
  .add-to-cart-btn {
    padding: 10px !important;
    font-size: 0.9rem !important;
  }
}.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: var(--backdrop);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(59, 130, 246, 0.2);
}
.product-image {
  position: relative;
  height: 250px;
  width: 100% ;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
    display: flex;
}
.product-img {
  width: 100%;
  height: auto;
  max-height: 230px;
  object-fit: contain;
  opacity: 0; 
  transition: var(--transition);
}
.product-card:hover .product-img {
  transform: scale(1.05);
}
.product-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  min-height: 60px;
  display: flex;
  align-items: center;
}
.price {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.product-actions {
  margin-top: auto;
}
.add-to-cart-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.add-to-cart-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
/* الخلفية */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: -1;
}
/* تأثيرات الظهور عند التمرير */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
/* تحسينات للشاشة الصغيرة */
@media (max-width: 768px) {
  .product-image {
    height: 200px;
  }
  .nav-center {
    top: 15px;
    padding: 8px 20px;
  }
  .nav-button {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
}
@media (max-width: 480px) {
  .product-image {
    height: 180px;
  }
  .product-info {
    padding: 15px;
  }
  .nav-center {
    top: 10px;
    padding: 6px 15px;
    gap: 10px;
  }
  .nav-button {
    padding: 8px 15px;
    font-size: 0.85rem;
  }
  .cart-count {
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
}
