/* ملف التنسيقات المتجاوبة الكامل - css/responsive.css */

/* ===================================
   شاشات كبيرة جداً (Large Desktop)
   =================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.8rem;
    }
}

/* ===================================
   شاشات كبيرة (Desktop)
   =================================== */
@media (max-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .products-layout {
        grid-template-columns: 250px 1fr;
    }
    
    .filters-sidebar {
        width: 250px;
    }
}

/* ===================================
   شاشات متوسطة (Tablets)
   =================================== */
@media (max-width: 1024px) {
    /* تعديل الحاوية */
    .container {
        max-width: 960px;
        padding: 0 20px;
    }
    
    /* الهيدر */
    .header-main .container {
        flex-wrap: wrap;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-color);
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        padding: 80px 30px 30px;
        flex-direction: column;
        gap: 20px;
        transition: var(--transition);
        z-index: 9999;
        overflow-y: auto;
    }
    
    body[dir="rtl"] .nav-menu {
        right: auto;
        left: -100%;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    body[dir="rtl"] .nav-menu.active {
        right: auto;
        left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    /* تعديل الشبكات */
    .products-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .filters-sidebar {
        position: static;
        width: 100%;
    }
    
    .categories-grid,
    .products-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* تفاصيل المنتج */
    .product-details-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* من نحن */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .vm-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* اتصل بنا */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ===================================
   شاشات صغيرة (Mobile Landscape)
   =================================== */
@media (max-width: 768px) {
    /* تعديل الخطوط */
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    /* الهيدر */
    .header-top {
        padding: 8px 0;
        font-size: 0.8rem;
    }
    
    .header-top .container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header-info {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .header-main {
        padding: 15px 0;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .logo img {
        height: 40px;
    }
    
    /* Hero Section */
    .hero {
        min-height: 500px;
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    /* الأقسام */
    .section {
        padding: 50px 0;
    }
    
    .section-header {
        margin-bottom: 35px;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 12px;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* الشبكات */
    .categories-grid,
    .products-grid,
    .features-grid,
    .videos-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* البطاقات */
    .product-card,
    .category-card,
    .video-card {
        max-width: 100%;
    }
    
    /* تفاصيل المنتج */
    .product-title {
        font-size: 1.6rem;
    }
    
    .product-meta {
        flex-direction: column;
        gap: 15px;
    }
    
    .price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-lg {
        width: 100%;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* معرض الصور */
    .gallery-filter {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-btn {
        width: 100%;
    }
    
    /* الفيديوهات */
    .videos-filter {
        flex-direction: column;
        gap: 10px;
    }
    
    /* من نحن */
    .about-content h2 {
        font-size: 1.8rem;
    }
    
    .about-content .lead {
        font-size: 1.1rem;
    }
    
    .feature-box h3 {
        font-size: 1.1rem;
    }
    
    .stat-box h3 {
        font-size: 2.5rem;
    }
    
    /* اتصل بنا */
    .contact-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .info-cards {
        gap: 15px;
    }
    
    /* الفوتر */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* أزرار عائمة */
    .whatsapp-float,
    .theme-toggle {
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .theme-toggle {
        bottom: 80px;
    }
    
    /* صفحة الهيدر */
    .page-header-section {
        padding: 50px 0 40px;
    }
    
    .page-header-content h1 {
        font-size: 1.8rem;
    }
    
    .page-header-content p {
        font-size: 1rem;
    }
    
    /* Toolbar */
    .products-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .toolbar-right {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .toolbar-right select {
        width: 100%;
    }
}

/* ===================================
   شاشات صغيرة جداً (Mobile Portrait)
   =================================== */
@media (max-width: 480px) {
    /* تعديل الخطوط */
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    /* Hero */
    .hero {
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 1.6rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    /* العناوين */
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    /* البطاقات */
    .product-card,
    .category-card {
        border-radius: 10px;
    }
    
    .product-content,
    .category-content {
        padding: 15px;
    }
    
    /* الأزرار */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    /* المنتج */
    .product-title {
        font-size: 1.4rem;
    }
    
    .price-value {
        font-size: 1.3rem;
    }
    
    /* الصور المصغرة */
    .thumbnail-images {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .thumbnail img {
        height: 80px;
    }
    
    /* النماذج */
    .form-control {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    /* الإحصائيات */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stat-box h3 {
        font-size: 2rem;
    }
    
    /* CTA */
    .cta-content h2 {
        font-size: 1.6rem;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-buttons .btn {
        width: 100%;
    }
}

/* ===================================
   شاشات صغيرة للغاية
   =================================== */
@media (max-width: 360px) {
    html {
        font-size: 12px;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .logo img {
        height: 35px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}

/* ===================================
   إصلاحات خاصة بالموبايل
   =================================== */
@media (max-width: 768px) {
    /* منع التكبير عند التركيز */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* تحسين اللمس */
    .btn,
    a,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* إخفاء العناصر غير الضرورية */
    .header-top .header-info-item:nth-child(n+3) {
        display: none;
    }
    
    /* تحسين القوائم */
    .nav-menu li a {
        padding: 15px 20px;
        display: block;
        border-radius: 8px;
        background: var(--bg-light);
        margin-bottom: 10px;
        text-align: center;
        font-size: 1rem;
    }
    
    /* تحسين النماذج */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    /* تحسين الجداول */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* تحسين Lightbox */
    .lightbox-content {
        max-width: 95%;
        padding: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
    }
    
    /* تحسين معرض الصور */
    .gallery-content {
        padding: 15px;
    }
    
    /* تحسين الفيديو */
    .video-player-container {
        padding-bottom: 56.25%;
    }
    
    /* إخفاء الأشكال الخلفية */
    .hero-shapes {
        display: none;
    }
}

/* ===================================
   وضع الطباعة
   =================================== */
@media print {
    .header,
    .footer,
    .whatsapp-float,
    .theme-toggle,
    .back-to-top,
    .cta-section {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
    }
    
    .product-card,
    .category-card {
        break-inside: avoid;
    }
}

/* ===================================
   تحسينات الأداء
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   تحسينات الوضع الليلي
   =================================== */
@media (prefers-color-scheme: dark) {
    body.auto-theme {
        --text-color: #ECF0F1;
        --text-light: #BDC3C7;
        --bg-color: #1A1A1A;
        --bg-light: #2C2C2C;
        --border-color: #3A3A3A;
    }
}

/* ===================================
   شاشات اللمس
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* إزالة التأثيرات على الهوفر */
    .btn:hover,
    .product-card:hover,
    .category-card:hover {
        transform: none;
    }
    
    /* إضافة تأثيرات على اللمس */
    .btn:active,
    .product-card:active,
    .category-card:active {
        transform: scale(0.98);
    }
    
    /* تحسين الأزرار */
    .btn {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===================================
   شاشات عالية الدقة (Retina)
   =================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* تحسين الصور */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===================================
   الوضع الأفقي للموبايل
   =================================== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        max-height: 80vh;
    }
    
    .nav-menu li {
        flex: 1 1 45%;
    }
}

/* ===================================
   إصلاح مشاكل Safari
   =================================== */
@supports (-webkit-appearance: none) {
    .form-control,
    .btn {
        -webkit-appearance: none;
    }
    
    input[type="search"] {
        -webkit-appearance: textfield;
    }
}

/* ===================================
   إصلاح مشاكل iOS
   =================================== */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-text-size-adjust: 100%;
    }
    
    .nav-menu {
        -webkit-overflow-scrolling: touch;
    }
    
    .form-control {
        border-radius: 0;
    }
}

/* ===================================
   تحسينات الإتاحة
   =================================== */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0A3D2F;
        --border-color: #000000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}