/* =========================================================
   Mobile Template Skin - تصميم بسيط وعملي
   ========================================================= */

@media (max-width: 992px) {

  :root {
    --primary: #2C5282; /* أزرق أنيق */
    --primary-light: #4299E1;
    --primary-dark: #1A365D;
    --accent: #38B2AC; /* تركواز */
    --bg-color: #F7FAFC; /* رمادي فاتح جداً */
    --card-bg: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --success: #38A169;
    --warning: #D69E2E;
    --danger: #E53E3E;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
  }

  body {
    background: var(--bg-color) !important;
    padding-top: 120px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  }

  /* ==================== Header بسيط ==================== */
  header {
    background: var(--card-bg) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    border-bottom: 1px solid #E2E8F0 !important;
  }

  .header-container {
    padding: 0.8rem 1rem !important;
    max-width: 100% !important;
  }

  .logo h1 {
    font-weight: 600 !important;
    font-size: 1.3rem !important;
    color: var(--text-primary) !important;
  }

  /* ==================== القائمة البسيطة ==================== */
  #mobileToggle {
    position: fixed !important;
    top: 0.8rem !important;
    right: 1rem !important;
    z-index: 1002 !important;
    background: transparent !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }

  #mobileToggle i {
    color: var(--text-primary) !important;
    font-size: 1.2rem !important;
  }

  /* القائمة البسيطة بدون أيقونات */
  #navMenu {
    position: fixed !important;
    top: 0 !important;
    right: -280px !important;
    width: 280px !important;
    height: 100vh !important;
    background: var(--card-bg) !important;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1) !important;
    z-index: 1001 !important;
    padding: 4rem 0 2rem !important;
    transition: right 0.3s ease !important;
    overflow-y: auto !important;
    border-left: 1px solid #E2E8F0 !important;
  }

  #navMenu.active {
    right: 0 !important;
  }

  #navMenu .nav-link {
    color: var(--text-primary) !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    text-align: right !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    display: block !important;
    border-bottom: 1px solid #EDF2F7 !important;
    transition: all 0.2s ease !important;
  }

  #navMenu .nav-link:hover {
    background: #F7FAFC !important;
  }

  #navMenu .nav-link.active {
    color: var(--primary) !important;
    background: #EBF8FF !important;
    border-right: 3px solid var(--primary) !important;
  }

  /* ==================== التصنيفات البسيطة ==================== */
  .category-nav-container {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--card-bg) !important;
    z-index: 998 !important;
    padding: 0.5rem 0 !important;
    overflow: hidden !important;
    border-bottom: 1px solid #E2E8F0 !important;
  }

  .category-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 0.5rem !important;
    padding: 0 1rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .category-nav::-webkit-scrollbar {
    display: none !important;
  }

  .cat-btn {
    background: #F7FAFC !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 20px !important;
    padding: 0.5rem 1rem !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
  }

  .cat-btn.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    font-weight: 600 !important;
  }

  #announcement-bar {
    top: 60px !important;
    background: var(--primary) !important;
    color: white !important;
    font-size: 0.9rem !important;
  }

  .main-content {
    padding: 0.5rem 0 !important;
  }

  #home-page .container {
    padding-top: 50px !important;
  }

  /* ==================== كروت المنتجات المحسنة ==================== */
  .products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    padding: 0.75rem !important;
    margin-bottom: 1.5rem !important;
  }

  .product-card {
    background: var(--card-bg) !important;
    border-radius: var(--radius) !important;
    overflow: hidden !important;
    box-shadow: var(--shadow) !important;
    position: relative !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    flex-direction: column !important;
    height: 260px !important; /* ارتفاع معتدل */
  }

  .product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    transform: translateY(-2px) !important;
  }

  /* حاوية الصورة بدون مساحة فارغة */
  .product-image-container {
    height: 140px !important; /* تقليل الارتفاع */
    background: #F1F5F9 !important;
    position: relative !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
  }

  .product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }

  /* البادجات صغيرة ومركزة */
  .product-badges {
    position: absolute !important;
    top: 0.5rem !important;
    left: 0.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
    z-index: 2 !important;
  }

  .discount-badge,
  .bundle-badge,
  .inactive-badge {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    text-align: center !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    backdrop-filter: blur(4px) !important;
    border: none !important;
  }

  .discount-badge {
    background: rgba(220, 38, 38, 0.9) !important;
  }

  .bundle-badge {
    background: rgba(56, 178, 172, 0.9) !important;
  }

  /* معلومات المنتج - بدون مسافات فارغة */
  .product-info {
    padding: 0.75rem !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important; /* تقليل الجاب */
  }

  .product-title {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    text-overflow: ellipsis !important;
    min-height: 2.6em !important;
  }

  /* إزالة العناصر غير الضرورية */
  .product-desc,
  .product-size,
  .bundle-info,
  .product-title .desc-toggle,
  .product-title::after {
    display: none !important;
  }

  /* السعر - مضغوط */
  .price-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: auto !important;
    padding-top: 0.5rem !important;
    border-top: 1px solid #EDF2F7 !important;
  }

  .price-wrapper {
    display: flex !important;
    align-items: baseline !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
  }

  .price-new {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
  }

  .price-new.discount {
    color: var(--danger) !important;
  }

  .price-old {
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    font-size: 0.8rem !important;
    text-decoration: line-through !important;
  }

  /* ==================== زر الإضافة الشفاف فوق الصورة ==================== */
  .add-btn {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: white !important;
    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(8px) !important;
    z-index: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
  }

  .add-btn:hover {
    background: rgba(0, 0, 0, 0.8) !important;
  }

  .add-btn:disabled {
    background: rgba(113, 128, 150, 0.6) !important;
    cursor: not-allowed !important;
  }

  .add-btn i {
    font-size: 0.9rem !important;
  }

  /* زر الإضافة في حاوية السعر (للشاشات الكبيرة) */
  .price-container .add-btn {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0.4rem 0.8rem !important;
    border-radius: 6px !important;
    background: var(--primary) !important;
    backdrop-filter: none !important;
    border: none !important;
    font-size: 0.8rem !important;
  }

  /* ==================== تحسينات متجاوبة ==================== */
  @media (min-width: 400px) {
    .products-grid {
      gap: 1rem !important;
      padding: 1rem !important;
    }

    .product-card {
      height: 280px !important;
    }

    .product-image-container {
      height: 150px !important;
    }
  }

  @media (min-width: 768px) and (max-width: 992px) {
    .products-grid {
      grid-template-columns: repeat(3, 1fr) !important;
      gap: 1rem !important;
      padding: 1rem !important;
    }

    .product-card {
      height: 300px !important;
    }

    .product-image-container {
      height: 160px !important;
    }

    .product-title {
      font-size: 0.95rem !important;
    }

    .price-new {
      font-size: 1.1rem !important;
    }
  }

  @media (max-width: 360px) {
    .products-grid {
      gap: 0.5rem !important;
      padding: 0.5rem !important;
    }

    .product-card {
      height: 240px !important;
    }

    .product-image-container {
      height: 120px !important;
    }

    .product-info {
      padding: 0.5rem !important;
    }

    .product-title {
      font-size: 0.85rem !important;
    }

    .price-new {
      font-size: 0.95rem !important;
    }

    .price-old {
      font-size: 0.75rem !important;
    }

    .add-btn {
      height: 28px !important;
      font-size: 0.75rem !important;
    }
  }

  /* ==================== تحسينات إضافية ==================== */
  .cart-badge {
    background: var(--primary) !important;
    color: white !important;
  }

  /* تأثير التحميل البسيط */
  .product-image-container:empty {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
    background-size: 200% 100% !important;
    animation: loading 1.5s infinite !important;
  }

  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
}

/* ==================== تحسينات JavaScript ==================== */