/* التصميم المتجاوب للشاشات المختلفة */

/* شاشات كبيرة - أجهزة سطح المكتب */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* أجهزة اللاب توب والشاشات المتوسطة */
@media (max-width: 1199px) and (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* الأجهزة اللوحية */
@media (max-width: 991px) and (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .portfolio-item {
        padding: 2rem;
    }
}

/* الهواتف الكبيرة */
@media (max-width: 767px) and (min-width: 576px) {
    .container {
        max-width: 540px;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        flex-direction: column;
        position: fixed;
        top: 70px;
        right: -100%;
        background: rgba(0, 0, 0, 0.95);
        width: 80%;
        height: calc(100vh - 70px);
        padding: 2rem;
        transition: right 0.3s ease;
        backdrop-filter: blur(20px);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

/* الهواتف الصغيرة */
@media (max-width: 575px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .service-card {
        padding: 2rem 1.5rem;
    }
    
    .portfolio-slide {
        padding: 1rem;
    }
    
    .portfolio-item {
        padding: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    /* القائمة المتنقلة */
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        background: rgba(0, 0, 0, 0.98);
        width: 100%;
        height: calc(100vh - 70px);
        flex-direction: column;
        padding: 2rem 1rem;
        transition: right 0.3s ease;
        backdrop-filter: blur(20px);
        z-index: 999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .language-switcher {
        margin-right: 0;
        margin-bottom: 1rem;
        justify-content: center;
    }
    
    /* زر القائمة */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        width: 30px;
        height: 30px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1000;
    }
    
    .menu-toggle span {
        width: 100%;
        height: 3px;
        background: var(--secondary);
        margin: 3px 0;
        transition: 0.3s;
        border-radius: 2px;
    }
    
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    /* السلايدر الأفقي للهواتف */
    .portfolio-container {
        padding: 0 1rem;
    }
    
    .portfolio-item {
        max-width: 100%;
    }
    
    .slider-controls {
        bottom: 1rem;
    }
}

/* إصلاح مشكلة السلايدر الأفقي للجوال */
@media (max-width: 768px) {
    /* منع التمرير الأفقي في كل الأقسام ما عدا السلايدر */
    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    .hero,
    .services,
    .portfolio,
    .footer {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* السلايدر الأفقي فقط */
    .horizontal-section {
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .horizontal-container {
        scroll-snap-type: x mandatory;
    }
    
    .slide {
        scroll-snap-align: start;
    }
    
    /* إخفاء شريط التمرير */
    .horizontal-section::-webkit-scrollbar {
        display: none;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
    }
}

/* باقي الكود يبقى كما هو */
/* الشاشات فائقة العرض */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-content {
        max-width: 1400px;
    }
}

/* التوجيه الأفقي للهواتف */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 120vh;
    }
    
    .hero-content {
        padding: 6rem 2rem 2rem;
    }
    
    .portfolio-section {
        height: 120vh;
    }
    
    .portfolio-container {
        height: 100vh;
    }
}

/* دعم اللمس عالي الدقة */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover {
        transform: none;
    }
    
    .portfolio-item:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* تحسينات لللمس */
    .btn {
        min-height: 44px;
    }
    
    .nav-link {
        padding: 1rem 0.5rem;
    }
    
    .form-input {
        font-size: 16px;
    }
}

/* الوضع الداكن التلقائي */
@media (prefers-color-scheme: dark) {
    body {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* الطباعة */
@media print {
    .header,
    .footer,
    .cta-buttons,
    .menu-toggle {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .hero {
        min-height: auto;
        background: white !important;
    }
    
    .service-card {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* تحسينات للأجهزة القابلة للطي */
@media (max-width: 300px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* تحسينات للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .service-icon,
    .portfolio-image {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* تحسينات الأداء للشاشات الكبيرة */
@media (min-width: 768px) {
    .lazy-load {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .lazy-load.loaded {
        opacity: 1;
    }
}

/* تأثيرات الحركة المخفضة */
@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;
    }
    
    .hero-title .char,
    .service-card,
    .portfolio-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}