/* ==========================================================================
   Z.R.S Hydroconsult - ملف الاستجابة الشاملة للأجهزة
   Responsive CSS - Mobile First Enhancements

   Breakpoints:
     xs  < 400px   (هواتف صغيرة جداً)
     sm  < 576px   (هواتف عادية)
     md  < 768px   (هواتف كبيرة / أفقي)
     lg  < 1024px  (تابلت)
     xl  ≥ 1024px  (ديسكتوب)
   ========================================================================== */

/* ==========================================================================
   1. الهيدر والتنقل (Header & Navigation)
   ========================================================================== */

@media (max-width: 576px) {
  .header-inner { height: 68px; gap: 12px; }
  .brand-logo-img { height: 50px; }
  .hamburger-btn { width: 40px; height: 40px; }
}

@media (max-width: 400px) {
  .mobile-drawer { width: 290px; }
}

/* ==========================================================================
   2. البانر الرئيسي (Hero Slider)
   ========================================================================== */

@media (max-width: 768px) {
  .hero-slider-section { min-height: auto; align-items: center; padding-block: 46px 36px; }
  .hero-slide-content { max-width: 100%; }
  .hero-headline { font-size: clamp(1.6rem, 6.5vw, 2.1rem); margin-bottom: 12px; }
  .hero-desc { font-size: 0.95rem; margin-bottom: 16px; }
  .hero-tagline-bar { font-size: 0.78rem; gap: 8px; margin-bottom: 10px; }
  .hero-badges-row { gap: 8px; margin-bottom: 18px; }
  .hero-badge-item { font-size: 0.8rem; padding: 5px 10px; }
  .hero-actions-row { gap: 10px; flex-direction: column; align-items: stretch; margin-bottom: 16px; }
  .hero-actions-row .btn { width: 100%; justify-content: center; }
  .slider-arrow-btn { display: none !important; }
}

@media (max-width: 400px) {
  .hero-slider-section { padding-block: 36px 28px; }
  .hero-headline { font-size: 1.45rem; }
}

/* ==========================================================================
   3. الأزرار العامة (Buttons)
   ========================================================================== */

@media (max-width: 576px) {
  .btn { font-size: 0.92rem; padding: 10px 18px; }
  .btn-lg { font-size: 0.98rem; padding: 12px 22px; }
}

/* ==========================================================================
   4. شريط العلامات التجارية (Brands Section)
   ========================================================================== */

@media (max-width: 576px) {
  .brands-section { padding-block: 28px; }
  .brands-title { font-size: 1.15rem; }
  .brand-card-item { height: 68px; min-width: 145px; padding: 8px 18px; font-size: 0.92rem; }
  .brand-card-item img { max-height: 48px; max-width: 115px; }
  .brands-arrow-btn { width: 34px; height: 34px; }
}

/* ==========================================================================
   5. بطاقات الأقسام الرئيسية (Department Cards - Home)
   ========================================================================== */

@media (max-width: 576px) {
  .dept-home-card { padding: 28px 20px; min-height: 200px; }
  .dept-home-title { font-size: 1.5rem; }
  .dept-home-desc { font-size: 0.95rem; margin-bottom: 18px; }
}

/* ==========================================================================
   6. شريط المزايا الأربعة (Values Bar)
   ========================================================================== */

@media (max-width: 576px) {
  .values-bar { padding: 24px 16px; gap: 16px; }
  .value-item { gap: 12px; }
  .value-icon-box { width: 42px; height: 42px; }
  .value-title { font-size: 0.98rem; }
  .value-desc { font-size: 0.84rem; }
}

/* ==========================================================================
   7. عناصر Section عامة
   ========================================================================== */

@media (max-width: 576px) {
  .section-title-wrap { margin-bottom: 28px; }
  .section-header-split { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
  .section-header-split .btn-view-all-left { align-self: flex-end; }
}

/* ==========================================================================
   8. البانر الداخلي ومسار التصفح (Page Hero & Breadcrumbs)
   ========================================================================== */

@media (max-width: 768px) {
  .page-hero { padding-block: 22px 18px; }
  .page-hero-title { font-size: clamp(1.3rem, 5.5vw, 1.7rem); }
  .page-hero-subtitle { font-size: 0.88rem; }
  /* إخفاء مسار التنقل (Breadcrumbs) على شاشات الهاتف لمنع الازدحام وتوفير مساحة المحتوى */
  .breadcrumbs-bar { display: none !important; }
}

/* ==========================================================================
   9. شبكة التصنيفات (Categories Grid)
   ========================================================================== */

@media (max-width: 576px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .category-card-imgbox { height: 160px; padding: 0; }
  .category-card-body { padding: 12px 14px; }
  .category-card-title { font-size: 0.95rem; }
}

@media (max-width: 360px) {
  .categories-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   10. شبكة المنتجات (Products Grid)
   ========================================================================== */

@media (max-width: 576px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card-imgbox { height: 160px; padding: 0; }
  .product-card-body { padding: 12px 14px; }
  .product-card-title { font-size: 0.92rem; }
  .product-card-sku { font-size: 0.78rem; margin-bottom: 10px; }
  .products-catalog-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   11. ترقيم الصفحات (Pagination)
   ========================================================================== */

@media (max-width: 576px) {
  .pagination-wrap { gap: 10px; margin-top: 32px; }
  .pagination-numbers { gap: 6px; }
  .pagination-btn { min-width: 36px; height: 36px; padding-inline: 10px; font-size: 0.88rem; }
}

/* ==========================================================================
   12. صفحة تفاصيل المنتج (Single Product Page)
   ========================================================================== */

@media (max-width: 1023px) {
  .product-share-bar-desktop {
    display: none !important;
  }
  .product-share-bar-mobile {
    display: flex !important;
  }
  /* إخفاء أسهم السلايدر في شاشات الموبايل والتابلت (تظهر فقط في أجهزة الديسكتوب واللابتوب) */
  .carousel-arrows,
  .product-carousel-slider-wrapper .carousel-arrow-btn {
    display: none !important;
  }
  /* تحويل المنتجات إلى شبكة رأسية عادية في الموبايل والتابلت ليتصفحها الزائر بالتمرير لأسفل */
  .product-slider-track {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scroll-snap-type: none !important;
    padding: 0 !important;
  }
  .product-slider-track .product-card {
    flex: none !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  .product-main-image-wrap { height: 320px; padding: 0; }
  .product-detail-title { font-size: 1.35rem; }
  .product-summary-card { padding: 20px; }
  .product-desc-box { padding: 20px; }
  .product-carousel-title { font-size: 1.25rem; }
}

@media (max-width: 576px) {
  .product-main-image-wrap { height: 260px; padding: 0; }
  .product-summary-card { padding: 18px; }
  .product-detail-title { font-size: 1.2rem; }
  .product-sizes-list { gap: 8px; }
  .product-size-chip { font-size: 0.85rem; padding: 6px 14px; gap: 6px; }
  .product-badge-row { flex-wrap: wrap; }
  .btn-quote-full { padding-block: 12px; font-size: 1rem; }
  .product-slider-track {
    gap: 12px !important;
  }
  .product-carousel-title { font-size: 1.15rem; }
}

@media (max-width: 360px) {
  .product-slider-track {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   13. صفحة الدعم الفني (Support Page)
   ========================================================================== */

@media (max-width: 768px) {
  .support-banner-alert { flex-direction: column; text-align: center; padding: 20px; gap: 14px; }
  .support-banner-alert .support-alert-icon { margin: 0 auto; }
}

@media (max-width: 576px) {
  .info-box-card { flex-direction: column; gap: 14px; padding: 20px; }
}

/* ==========================================================================
   14. صفحة من نحن (About Page)
   ========================================================================== */

@media (max-width: 576px) {
  .about-intro-grid { gap: 24px; margin-bottom: 40px; }
  .vision-card { padding: 22px; }
  .vision-card-title { font-size: 1.2rem; }
}

/* ==========================================================================
   15. صفحة اتصل بنا (Contact Page)
   ========================================================================== */

@media (max-width: 768px) {
  .contact-form-box { padding: 22px; }
  .map-iframe-wrap { height: 260px; }
  .contact-card-box { padding: 18px; }
}

@media (max-width: 576px) {
  .contact-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .contact-card-icon { width: 40px; height: 40px; margin-bottom: 10px; }
  .contact-card-box { padding: 14px; }
  .contact-form-box { padding: 18px 14px; }
  .form-input, .form-select, .form-textarea { padding: 10px 12px; font-size: 16px; }
  .map-iframe-wrap { height: 220px; }
}

@media (max-width: 400px) {
  .contact-cards-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   16. الفوتر (Footer) - تحسين الارتفاع والمساحة على شاشات الهواتف
   ========================================================================== */

@media (max-width: 576px) {
  .site-footer { padding-top: 18px; }
  .footer-grid { grid-template-columns: 1fr; gap: 14px; padding-bottom: 14px; }
  .footer-column-title { font-size: 0.92rem; margin-bottom: 6px; }
  .footer-column-title::after { margin-top: 3px; width: 18px; }
  /* قائمة الروابط في عمودين لتقليص الارتفاع للنصف */
  .footer-links-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .footer-links-list a { font-size: 0.82rem; }
  .footer-contact-list { font-size: 0.8rem; gap: 6px; }
  .footer-contact-item svg { width: 14px; height: 14px; }
  /* إخفاء الفقرة التعريفية الطويلة على الموبايل لمنع استهلاك شاشة الهاتف بالكامل */
  .site-footer p { display: none; }
  .footer-social-row { gap: 8px; margin-top: 4px; }
  .footer-social-link { width: 32px; height: 32px; }
  .footer-bottom-bar { flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-block: 8px; font-size: 0.74rem; }
  
  /* بطاقة مقدمة التصنيف على الموبايل */
  .category-intro-box { padding: 14px 12px; margin-bottom: 14px; border-right-width: 3px; }
  .category-intro-title { font-size: 1.1rem; }
  .category-intro-desc { font-size: 0.88rem; line-height: 1.7; }
}

/* ==========================================================================
   17. زر واتساب العائم (WhatsApp FAB)
   ========================================================================== */

@media (max-width: 576px) {
  .whatsapp-fab-container { bottom: 16px; left: 16px; }
  .whatsapp-fab-btn { width: 52px; height: 52px; }
  .whatsapp-fab-btn svg { width: 28px; height: 28px; }
  .whatsapp-auto-popup { width: 240px; bottom: 64px; left: 0; font-size: 0.88rem; padding: 14px; }
}

/* ==========================================================================
   18. بطاقات الفريق (Team Cards)
   ========================================================================== */

@media (max-width: 576px) {
  .team-card { padding: 22px 18px; }
  .team-avatar-box { width: 64px; height: 64px; }
  .team-name { font-size: 1.05rem; }
}

/* ==========================================================================
   19. حالة الفراغ والخطأ
   ========================================================================== */

@media (max-width: 576px) {
  .state-feedback-box { padding: 40px 16px; }
  .state-feedback-title { font-size: 1.1rem; }
  .state-feedback-desc { font-size: 0.88rem; }
}

/* ==========================================================================
   20. تحسينات اللمس (Touch Optimizations)
   ========================================================================== */

@media (max-width: 768px) {
  .drawer-link, .drawer-sublink { min-height: 44px; }
  .footer-social-link { min-height: 40px; min-width: 40px; }
  .pagination-btn { min-height: 44px; }

  /* تعطيل hover animation على الأجهزة اللمسية */
  .product-card:hover,
  .category-card:hover,
  .dept-home-card:hover,
  .team-card:hover {
    transform: none;
  }
}

/* ==========================================================================
   21. الشاشات الكبيرة جداً (Large Screens 1440px+)
   ========================================================================== */

@media (min-width: 1440px) {
  .container { max-width: 1360px; }
  .hero-headline { font-size: 3.6rem; }
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   22. RTL ضمانات إضافية
   ========================================================================== */

[dir="rtl"] .footer-social-row {
  direction: rtl;
  justify-content: flex-start;
}

[dir="rtl"] .breadcrumbs-bar { direction: rtl; }
[dir="rtl"] .hero-actions-row { justify-content: flex-start; }

/* ==========================================================================
   23. Safe Area للشاشات ذات الشق (Notch)
   ========================================================================== */

@supports (padding: max(0px)) {
  .site-header {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .whatsapp-fab-container {
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
  }
  .mobile-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
