/* ===== RESPONSIVE DESIGN ===== */

/* Mobile First Approach - Base styles are for mobile */

/* ===== TABLET STYLES (768px and up) ===== */
@media (min-width: 768px) {
    /* Container */
    .container {
        padding: 0 var(--space-6);
    }

    /* Navigation */
    .nav-menu {
        display: flex;
    }

    .nav-toggle {
        display: none;
    }

    /* Hero */
    .hero-content {
        grid-template-columns: 1fr 1fr;
        text-align: left;
    }

    .hero-content .hero-actions {
        justify-content: flex-start;
    }

    /* Grids */
    .advantages-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .faq-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .earnings-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-single-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid-single-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .testimonials-grid-single-row {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }

    /* Layout */
    .two-column-layout {
        grid-template-columns: 1fr 1fr;
    }

    .calculator-main {
        grid-template-columns: 1fr 1fr;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 2fr;
    }

    .footer-brand {
        text-align: left;
    }

    .footer-description {
        margin: 0;
    }

    .footer-links {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-section {
        text-align: left;
    }

    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }

    /* Buttons */
    .btn {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-base);
    }

    .btn-lg {
        padding: var(--space-4) var(--space-8);
        font-size: var(--text-lg);
    }

    /* Hero Title Sizes */
    .hero-content .hero-title {
        font-size: clamp(2.5rem, 5vw, 3rem);
    }

    .hero-content-centered .hero-title {
        font-size: clamp(3rem, 6vw, 4.5rem);
    }
}

/* ===== DESKTOP STYLES (1024px and up) ===== */
@media (min-width: 1024px) {
    /* Grids */
    .advantages-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .faq-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .earnings-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-grid-single-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .features-grid-single-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .testimonials-grid-single-row {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }

    /* Hero Title Sizes */
    .hero-content .hero-title {
        font-size: 3.5rem;
    }

    .hero-content-centered .hero-title {
        font-size: 4.5rem;
    }
}

/* ===== LARGE DESKTOP STYLES (1400px and up) ===== */
@media (min-width: 1400px) {
    .testimonials-grid-single-row {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-6);
    }
}

/* ===== MOBILE SPECIFIC STYLES (767px and down) ===== */
@media (max-width: 767px) {
    /* Buttons */
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
    }

    .btn-lg {
        padding: var(--space-4) var(--space-6);
        font-size: var(--text-lg);
    }

    .cta-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }

    /* Sections */
    .section {
        padding: var(--space-16) 0;
    }

    /* Typography */
    .hero-content .hero-title,
    .hero-content-centered .hero-title {
        font-size: clamp(2rem, 8vw, 2.5rem);
    }

    .section-title {
        font-size: var(--text-3xl);
    }

    .cta-title {
        font-size: var(--text-3xl);
    }

    /* Forms */
    .balance-input {
        width: 250px;
        height: 60px;
        font-size: var(--text-2xl);
    }

    /* Connection Status */
    .connection-status {
        flex-direction: column;
        text-align: center;
        padding: var(--space-4) var(--space-6);
        max-width: 400px;
    }

    /* Hero Image */
    .hero-image {
        order: -1;
        margin-bottom: var(--space-8);
    }

    .hero-img-wrapper {
        max-width: 300px;
    }

    /* Modal */
    .modal-content {
        margin: var(--space-4);
        width: calc(100% - var(--space-8));
    }

    /* Text Alignment */
    .hero-content {
        text-align: center;
    }

    /* Single Row Grids become single column */
    .stats-grid-single-row,
    .features-grid-single-row,
    .testimonials-grid-single-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

/* ===== SMALL MOBILE STYLES (480px and down) ===== */
@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 var(--space-3);
    }

    /* Buttons */
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
        min-height: 44px; /* Accessibility minimum touch target */
    }

    .btn-lg {
        padding: var(--space-3) var(--space-5);
        font-size: var(--text-base);
        min-height: 48px;
    }

    .btn-icon {
        margin-right: var(--space-1);
        font-size: var(--text-lg);
    }

    /* Button effects optimization for small screens */
    .btn:hover {
        transform: translateY(-1px); /* Reduced hover effect */
    }

    /* Typography */
    .hero-title {
        font-size: clamp(1.75rem, 6vw, 2rem);
        line-height: 1.2;
    }

    .section-title {
        font-size: var(--text-2xl);
        line-height: 1.3;
    }

    /* Spacing */
    .section {
        padding: var(--space-12) 0;
    }

    /* Cards */
    .advantage-card {
        padding: var(--space-6) var(--space-4);
    }

    .testimonial-card {
        padding: var(--space-6);
    }

    .plan-card {
        padding: var(--space-6);
    }

    /* Forms */
    .balance-input {
        width: 220px;
        height: 50px;
        font-size: var(--text-xl);
    }

    /* Navigation improvements */
    .nav-toggle {
        padding: var(--space-2);
        min-width: 44px;
        min-height: 44px;
    }

    /* Grid gaps */
    .advantages-grid,
    .faq-grid,
    .plans-grid {
        gap: var(--space-4);
    }

    /* Hero actions */
    .hero-actions {
        gap: var(--space-2);
    }

    .cta-actions {
        gap: var(--space-2);
    }
}

/* ===== EXTRA SMALL MOBILE STYLES (320px and down) ===== */
@media (max-width: 320px) {
    /* Container - более компактный */
    .container {
        padding: 0 var(--space-2);
    }

    /* Typography - уменьшенные размеры */
    .hero-title {
        font-size: clamp(1.5rem, 7vw, 1.75rem);
        line-height: 1.2;
    }

    .section-title {
        font-size: var(--text-xl);
        line-height: 1.3;
    }

    .cta-title {
        font-size: var(--text-xl);
    }

    /* Buttons - более компактные */
    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
        min-height: 40px;
        border-radius: var(--radius-sm);
    }

    .btn-lg {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
        min-height: 44px;
    }

    .btn-icon {
        margin-right: var(--space-1);
        font-size: var(--text-base);
    }

    /* Убираем анимации для экономии ресурсов */
    .btn::before {
        display: none;
    }

    .btn:hover {
        transform: none;
    }

    /* Spacing - более компактные отступы */
    .section {
        padding: var(--space-8) 0;
    }

    /* Cards - уменьшенные отступы */
    .advantage-card,
    .testimonial-card,
    .plan-card {
        padding: var(--space-4) var(--space-3);
        border-radius: var(--radius-sm);
    }

    /* Forms */
    .balance-input {
        width: 180px;
        height: 44px;
        font-size: var(--text-lg);
        padding: var(--space-2);
    }

    /* Hero */
    .hero-img-wrapper {
        max-width: 250px;
    }

    .hero-actions {
        gap: var(--space-1);
    }

    .cta-actions {
        gap: var(--space-1);
    }

    /* Modal */
    .modal-content {
        margin: var(--space-2);
        width: calc(100% - var(--space-4));
        border-radius: var(--radius-sm);
    }

    /* Connection Status */
    .connection-status {
        padding: var(--space-3) var(--space-4);
        max-width: 280px;
        font-size: var(--text-sm);
    }

    /* Footer */
    .footer-links {
        gap: var(--space-4);
    }

    .footer-section {
        font-size: var(--text-sm);
    }

    /* Grid gaps - более компактные */
    .advantages-grid,
    .faq-grid,
    .plans-grid {
        gap: var(--space-3);
    }

    /* Navigation */
    .nav-toggle {
        padding: var(--space-1);
        min-width: 40px;
        min-height: 40px;
    }

    /* Text elements */
    .text-sm {
        font-size: 0.75rem;
    }

    .text-xs {
        font-size: 0.625rem;
    }

    /* Reduce line heights for better space usage */
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.2;
    }

    p {
        line-height: 1.4;
    }

    /* Optimize images */
    .hero-img,
    .section-image {
        max-width: 100%;
        height: auto;
    }
}

/* ===== LANDSCAPE MOBILE STYLES ===== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--space-8) 0;
    }

    .section {
        padding: var(--space-12) 0;
    }

    /* Buttons в ландшафте */
    .btn {
        min-height: 36px;
    }

    .btn-lg {
        min-height: 40px;
    }
}

/* ===== LANDSCAPE EXTRA SMALL MOBILE ===== */
@media (max-width: 320px) and (orientation: landscape) {
    .hero-section {
        padding: var(--space-4) 0;
    }

    .section {
        padding: var(--space-6) 0;
    }

    .hero-title {
        font-size: clamp(1.25rem, 6vw, 1.5rem);
    }

    .btn {
        min-height: 32px;
        padding: var(--space-1) var(--space-3);
    }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .hero-img,
    .section-image,
    .logo-img,
    .footer-logo-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Optimize button borders for retina */
    .btn-outline {
        border-width: 1px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    /* Hide non-essential elements */
    .header,
    .footer,
    .nav-toggle,
    .btn,
    .animated-lines,
    .hero-effects {
        display: none !important;
    }

    /* Adjust colors for print */
    body {
        background: white !important;
        color: black !important;
    }

    .section {
        padding: var(--space-4) 0 !important;
    }
}

/* ===== ACCESSIBILITY - MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animated-line {
        display: none;
    }

    /* Disable button hover animations */
    .btn:hover {
        transform: none !important;
    }

    .btn::before {
        display: none !important;
    }
}

/* ===== DARK MODE SUPPORT (if needed in future) ===== */
@media (prefers-color-scheme: dark) {
    /* Already optimized for dark theme, but can add overrides here if needed */
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(9, 175, 244, 0.5);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.4);
    }

    .advantage-card,
    .testimonial-card,
    .plan-card {
        border-width: 2px;
    }

    .btn {
        border-width: 2px;
    }

    .btn-outline {
        border-width: 3px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS FOR SMALL SCREENS ===== */
@media (max-width: 480px) {
    /* Disable complex effects on mobile for better performance */
    .btn::before {
        display: none;
    }

    /* Simplify shadows */
    .btn-primary {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .btn-primary:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (max-width: 480px) {
    /* Ensure all interactive elements meet touch target minimums */
    button,
    .btn,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }

    /* Add more spacing between interactive elements */
    .nav-menu a {
        padding: var(--space-3) var(--space-4);
    }
}

@media (max-width: 320px) {
    /* Slightly smaller but still accessible touch targets */
    button,
    .btn,
    a,
    input,
    select,
    textarea {
        min-height: 40px;
        min-width: 40px;
    }
}