/* Responsive CSS for AliExpress Dropshipping Website */

/* ========================================
   Mobile First Responsive Design
======================================== */

/* Extra Small devices (phones, 0px to 639px) */
@media (max-width: 639px) {
    /* Container adjustments */
    .container {
        padding: 0 var(--spacing-3);
    }

    /* Typography scaling */
    :root {
        --font-size-5xl: 2.25rem;
        --font-size-4xl: 1.875rem;
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.25rem;
        --font-size-xl: 1.125rem;
    }

    /* Navigation */
    .nav-container {
        padding: var(--spacing-3);
    }

    .nav-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        box-shadow: var(--shadow-xl);
        border-top: 1px solid var(--gray-200);
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-base);
    }

    .nav-menu.active {
        max-height: 500px;
    }

    .nav-item {
        border-bottom: 1px solid var(--gray-100);
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .nav-link {
        padding: var(--spacing-4);
        display: block;
        color: var(--gray-700);
        text-shadow: none;
    }

    .nav-actions {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    /* Dropdown adjustments for mobile */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        background-color: var(--gray-50);
        margin-left: var(--spacing-4);
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-base);
    }

    .dropdown.active .dropdown-menu {
        max-height: 300px;
    }

    /* Hero section */
    .hero-section {
        height: 100vh;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-8);
        text-align: center;
        padding: calc(70px + var(--spacing-12)) var(--spacing-3) var(--spacing-12);
    }

    .hero-text h1 {
        font-size: var(--font-size-4xl);
        margin-bottom: var(--spacing-4);
    }

    .hero-text p {
        font-size: var(--font-size-lg);
        margin-bottom: var(--spacing-6);
    }

    .hero-buttons {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-4);
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 280px;
        padding: var(--spacing-4) var(--spacing-6);
        font-size: var(--font-size-base);
    }

    /* Features section */
    .features-section {
        padding: var(--spacing-16) var(--spacing-3);
    }

    .features-section h2 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--spacing-12);
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-6);
    }

    .feature-card {
        padding: var(--spacing-6);
    }

    /* 带背景图片的卡片移动端优化 */
    .feature-card-with-bg {
        min-height: 250px;
    }

    .feature-content {
        padding: var(--spacing-4);
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        margin-bottom: var(--spacing-4);
    }

    .feature-icon i {
        font-size: var(--font-size-2xl);
    }

    /* How it works section */
    .how-it-works-section {
        padding: var(--spacing-16) var(--spacing-3);
    }

    .how-it-works-section h2 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--spacing-12);
    }

    .step {
        flex-direction: column !important;
        text-align: center;
        gap: var(--spacing-4);
    }

    .step:not(:last-child)::after {
        left: 50%;
        bottom: -30px;
        height: 20px;
    }

    .step-number {
        width: 60px;
        height: 60px;
        font-size: var(--font-size-xl);
    }

    .step-content {
        padding: var(--spacing-4);
        margin: 0;
    }

    /* Statistics section */
    .stats-section {
        padding: var(--spacing-16) var(--spacing-3);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-6);
    }

    .stat-item h3 {
        font-size: var(--font-size-4xl);
    }

    /* CTA section */
    .cta-section {
        padding: var(--spacing-16) var(--spacing-3);
    }

    .cta-section h2 {
        font-size: var(--font-size-3xl);
    }

    .cta-section p {
        font-size: var(--font-size-lg);
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .btn {
        width: 100%;
        max-width: 280px;
    }

    /* Language switcher */
    .language-switcher {
        bottom: var(--spacing-4);
        right: var(--spacing-4);
    }

    .lang-btn {
        padding: var(--spacing-2) var(--spacing-3);
        font-size: var(--font-size-sm);
    }

    /* Back to top */
    .back-to-top {
        bottom: var(--spacing-4);
        left: var(--spacing-4);
        width: 45px;
        height: 45px;
    }
}

/* Small devices (landscape phones, 640px to 767px) */
@media (min-width: 640px) and (max-width: 767px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
    }

    .nav-menu {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }
}

/* Medium devices (tablets, 768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Navigation */
    .nav-menu {
        gap: var(--spacing-6);
    }

    /* Hero section adjustments */
    .hero-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-12);
        text-align: center;
    }

    .hero-text h1 {
        font-size: var(--font-size-4xl);
    }

    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-6);
    }

    /* Steps */
    .steps-container {
        gap: var(--spacing-10);
    }

    .step {
        gap: var(--spacing-6);
    }

    .step-content {
        padding: var(--spacing-5);
    }

    /* Statistics */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large devices (desktops, 1024px to 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container {
        max-width: 1000px;
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-container {
        padding: var(--spacing-4) var(--spacing-6);
    }
}

/* Extra large devices (large desktops, 1280px and up) */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }

    /* Enhanced hero section for larger screens */
    .hero-text h1 {
        font-size: var(--font-size-5xl);
    }

    .hero-text p {
        font-size: var(--font-size-xl);
    }

    /* Features with better spacing */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-10);
    }

    .feature-card {
        padding: var(--spacing-10);
    }

    /* Steps with enhanced layout */
    .steps-container {
        gap: var(--spacing-16);
    }

    .step-content {
        padding: var(--spacing-8);
    }
}

/* ========================================
   Landscape Orientation Adjustments
======================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        height: auto;
        min-height: 70vh;
        padding: calc(70px + var(--spacing-8)) var(--spacing-4) var(--spacing-8);
    }

    .hero-text h1 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--spacing-3);
    }

    .hero-text p {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-4);
    }
}

/* ========================================
   Touch Device Optimizations
======================================== */
@media (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: var(--spacing-3) var(--spacing-6);
    }

    .nav-link {
        min-height: 44px;
        padding: var(--spacing-3) var(--spacing-4);
    }

    .lang-btn {
        min-height: 44px;
        padding: var(--spacing-3) var(--spacing-4);
    }

    .back-to-top {
        width: 56px;
        height: 56px;
    }

    /* Enhanced hover states for touch */
    .feature-card:hover {
        transform: none;
    }

    .feature-card:active {
        transform: scale(0.98);
    }

    /* Remove hover effects that don't work well on touch */
    .btn-primary:hover {
        transform: none;
    }

    .btn-primary:active {
        transform: scale(0.98);
    }
}

/* ========================================
   High DPI/Retina Display Optimizations
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp images and icons */
    .logo-img,
    .hero-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Enhanced shadows for high DPI */
    .feature-card:hover {
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    }

    .navbar.scrolled {
        box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
    }
}

/* ========================================
   Dark Mode Support (System Preference)
======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1a1a1a;
        --gray-100: #2a2a2a;
        --gray-200: #3a3a3a;
        --gray-300: #4a4a4a;
        --gray-400: #6a6a6a;
        --gray-500: #8a8a8a;
        --gray-600: #aaaaaa;
        --gray-700: #cccccc;
        --gray-800: #e0e0e0;
        --gray-900: #f0f0f0;
        --white: #121212;
        --black: #ffffff;
    }

    body {
        background-color: var(--white);
        color: var(--gray-800);
    }

    .navbar {
        background-color: rgba(18, 18, 18, 0.95);
        border-bottom-color: var(--gray-200);
    }

    .feature-card,
    .step-content {
        background-color: var(--gray-100);
        border-color: var(--gray-200);
    }

    .hero-section,
    .how-it-works-section {
        background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
    }
}

/* ========================================
   Reduced Motion Support
======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .feature-card:hover,
    .btn-primary:hover,
    .back-to-top:hover {
        transform: none;
    }
}

/* ========================================
   High Contrast Mode Support
======================================== */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --primary-dark: #0052a3;
        --gray-600: #404040;
        --gray-700: #262626;
        --gray-800: #0d0d0d;
    }

    .btn-primary {
        border: 2px solid var(--primary-dark);
    }

    .feature-card,
    .step-content {
        border: 2px solid var(--gray-300);
    }

    .nav-link:hover,
    .login-link:hover {
        border: 1px solid var(--primary-color);
    }
}

/* ========================================
   Print Responsive Adjustments
======================================== */
@media print {
    /* Override responsive grid for print */
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20pt !important;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .hero-content {
        grid-template-columns: 1fr !important;
        gap: 20pt !important;
    }

    .step {
        flex-direction: row !important;
        page-break-inside: avoid;
    }

    .step:nth-child(even) {
        flex-direction: row-reverse !important;
    }

    /* Ensure readability */
    .hero-text h1 {
        font-size: 24pt !important;
    }

    .features-section h2,
    .how-it-works-section h2 {
        font-size: 20pt !important;
    }
}

/* ========================================
   Internet Explorer 11 Fallbacks
======================================== */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* Grid fallbacks for IE11 */
    .features-grid {
        display: -ms-grid;
        -ms-grid-columns: 1fr 20px 1fr 20px 1fr;
    }

    .feature-card:nth-child(1) { 
        -ms-grid-column: 1; 
        grid-column: 1;
    }
    .feature-card:nth-child(2) { 
        -ms-grid-column: 3; 
        grid-column: 3;
    }
    .feature-card:nth-child(3) { 
        -ms-grid-column: 5; 
        grid-column: 5;
    }

    .hero-content {
        display: -ms-grid;
        -ms-grid-columns: 1fr;
    }

    /* Flexbox fallbacks */
    .nav-menu {
        display: -ms-flexbox;
        -ms-flex-direction: row;
        flex-direction: row;
        -ms-flex-align: center;
        align-items: center;
    }

    .nav-actions {
        display: -ms-flexbox;
        -ms-flex-direction: row;
        flex-direction: row;
        -ms-flex-align: center;
        align-items: center;
    }
}