/* رسپانسیو برای دستگاه‌های مختلف */

/* تبلت - افقی (1024px و کمتر) */
@media (max-width: 1024px) {
    .container {
        max-width: var(--container-lg);
        padding: 0 var(--spacing-lg);
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .services-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
    }
    
    /* صفحه پرداخت */
    .payment-methods {
        grid-template-columns: 1fr;
    }
    
    .payment-form .form-row {
        grid-template-columns: 1fr;
    }
}

/* تبلت - عمودی (768px و کمتر) */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 0 var(--spacing-md);
    }
    
    .navbar {
        padding: 0 var(--spacing-md);
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 80%;
        height: calc(100vh - 70px);
        background: var(--light-color);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-xl);
        transition: right 0.3s ease;
        z-index: 1000;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 120px var(--spacing-md) var(--spacing-2xl);
    }
    
    .hero-content {
        max-width: 100%;
        margin-bottom: var(--spacing-2xl);
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .services-grid,
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    /* صفحه فروشگاه */
    .products-filter {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    /* سبد خرید سایدبار */
    .cart-section {
        width: 100%;
        right: -100%;
    }
    
    /* صفحه پرداخت */
    .checkout-steps {
        flex-direction: column;
    }
    
    .checkout-step {
        width: 100%;
        margin-bottom: var(--spacing-md);
    }
}

/* موبایل - کوچک (480px و کمتر) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    .service-card,
    .product-card {
        padding: var(--spacing-md);
    }
    
    .btn-lg {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 1rem;
    }
    
    .modal-content {
        padding: var(--spacing-lg);
        width: 95%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* کارت سبد خرید */
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .item-controls {
        width: 100%;
        margin-top: var(--spacing-md);
    }
    
    /* نوتیفیکیشن */
    .notification {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
        width: auto;
    }
}

/* چاپ */
@media print {
    .main-header,
    .main-footer,
    .nav-actions,
    .btn,
    .notification,
    .cart-toggle {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
    
    .receipt {
        border: 1px solid #000;
        padding: 20px;
        margin: 0;
    }
    
    .no-print {
        display: none !important;
    }
}

/* دسکتاپ بزرگ (1440px و بیشتر) */
@media (min-width: 1440px) {
    .container {
        max-width: var(--container-xl);
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .services-grid,
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .features {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* حالت لنداسکیپ موبایل */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 0;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* تیرگی حالت تاریک با پشتیبانی سیستمی */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --light-color: #121212;
        --dark-color: #f8f9fa;
        --gray-100: #1e1e1e;
        --gray-200: #2d2d2d;
        --gray-300: #3d3d3d;
        --gray-400: #4d4d4d;
        --gray-500: #5d5d5d;
        --gray-600: #6d6d6d;
        --gray-700: #7d7d7d;
        --gray-800: #8d8d8d;
        --gray-900: #9d9d9d;
    }
}

/* پشتیبانی از تاچ */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .service-card:hover,
    .product-card:hover {
        transform: none;
    }
    
    .nav-menu a {
        padding: var(--spacing-md);
    }
    
    /* افزایش سایز دکمه‌ها برای تاچ */
    .btn {
        min-height: 44px;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* جلوگیری از زوم در iOS */
    }
}

/* رتینا و نمایشگرهای با تراکم بالا */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* جهت‌های مختلف */
@media (orientation: portrait) {
    .hero-image img {
        max-height: 50vh;
    }
}

@media (orientation: landscape) {
    .hero {
        min-height: auto;
    }
}

/* کاهش حرکت */
@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;
    }
    
    .fade-in,
    .slide-in-up,
    .zoom-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* کنتراست بالا */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --dark-color: #000000;
        --light-color: #ffffff;
    }
    
    .btn-primary {
        border: 2px solid #000000;
    }
}