/* ===============================================
   Responsive Design - Mobile First Approach
   =============================================== */

/* ===============================================
   Desktop (Default: 1440px+)
   Already defined in style.css
   =============================================== */

/* ===============================================
   Laptop (1024px - 1439px)
   =============================================== */
@media screen and (max-width: 1439px) {
    :root {
        --font-size-h1: 44px;
        --font-size-h2: 38px;
        --font-size-h3: 28px;
        --spacing-xxl: 60px;
    }

    .container {
        max-width: 1024px;
    }

    .hero-title {
        font-size: 48px;
    }

    .results-grid {
        gap: var(--spacing-md);
    }

    .services-grid {
        gap: var(--spacing-md);
    }
}

/* ===============================================
   Tablet (768px - 1023px)
   =============================================== */
@media screen and (max-width: 1023px) {
    :root {
        --font-size-h1: 38px;
        --font-size-h2: 32px;
        --font-size-h3: 24px;
        --spacing-xl: 40px;
        --spacing-xxl: 50px;
    }

    /* Navigation */
    .nav-menu {
        position: fixed;
        right: -100%;
        top: 72px;
        flex-direction: column;
        background: var(--bg-light);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-lg) 0;
        gap: var(--spacing-md);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-toggle {
        display: block;
    }

    /* Hero Section */
    .hero {
        padding-top: 120px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .hero-content {
        text-align: center;
        padding: 0;
    }

    .hero-title {
        font-size: 42px;
    }

    .hero-subtitle {
        font-size: 18px;
    }

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

    .hero-image {
        order: -1;
    }

    .hero-gif {
        max-width: 400px;
    }

    /* Stats */
    .stats-container {
        gap: var(--spacing-md);
    }

    .stat-number {
        font-size: 40px;
    }

    /* Results Gallery */
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    /* Timeline */
    .timeline {
        padding-right: 0;
    }

    .timeline::before {
        right: 35px;
        transform: none;
    }

    .timeline-item {
        grid-template-columns: 70px 1fr;
        gap: var(--spacing-md);
        text-align: right;
        padding-right: 0;
    }

    .timeline-item .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        grid-column: 2;
        text-align: right;
    }

    .timeline-item .timeline-number,
    .timeline-item:nth-child(even) .timeline-number {
        display: none;
    }

    .timeline-item .timeline-icon,
    .timeline-item:nth-child(even) .timeline-icon {
        grid-column: 1;
        margin: 0;
    }

    .timeline-icon {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    /* About */
    .about-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .about-content {
        padding: 0;
        text-align: center;
    }

    .about-credentials {
        justify-content: center;
        align-items: center;
    }
}

/* ===============================================
   Mobile (320px - 767px)
   =============================================== */
@media screen and (max-width: 767px) {
    :root {
        --font-size-h1: 32px;
        --font-size-h2: 28px;
        --font-size-h3: 22px;
        --font-size-base: 15px;
        --font-size-large: 17px;
        --spacing-lg: 32px;
        --spacing-xl: 40px;
        --spacing-xxl: 40px;
        --container-padding: 16px;
    }

    html, body {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 16px;
    }

    /* Section Spacing */
    section {
        padding: var(--spacing-xl) 0;
        width: 100%;
        max-width: 100%;
    }

    /* Typography */
    .section-title {
        font-size: var(--font-size-h2);
        margin-bottom: var(--spacing-sm);
    }

    .section-subtitle {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-lg);
    }

    /* Buttons */
    .btn {
        padding: 14px 32px;
        font-size: var(--font-size-base);
        width: 100%;
    }

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

    .nav-logo h3 {
        font-size: 20px;
    }

    .nav-menu {
        top: 60px;
    }

    /* Hero Section */
    .hero {
        padding-top: 100px;
        padding-bottom: var(--spacing-xl);
    }

    .hero-title {
        font-size: 36px;
        margin-bottom: var(--spacing-sm);
    }

    .hero-subtitle {
        font-size: 16px;
        margin-bottom: var(--spacing-md);
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-sm);
    }

    .hero-gif {
        max-width: 320px;
    }

    /* Stats */
    .stats {
        padding: var(--spacing-lg) 0;
    }

    .stats-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .stat-number {
        font-size: 36px;
    }

    .stat-label {
        font-size: var(--font-size-base);
    }

    /* Results Gallery */
    .results {
        padding-left: 0;
        padding-right: 0;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        padding: 0;
    }

    .result-card {
        max-width: 100%;
        margin: 0;
    }

    .result-image {
        width: 100%;
    }

    .result-image img {
        width: 100%;
        height: auto;
        min-height: 300px;
        object-fit: cover;
        display: block;
    }

    .result-name {
        font-size: 20px;
    }

    .result-achievement {
        font-size: var(--font-size-base);
    }

    /* Timeline */
    .timeline {
        padding: 0 var(--spacing-sm);
    }

    .timeline::before {
        right: var(--spacing-sm);
    }

    .timeline-item {
        margin-bottom: var(--spacing-lg);
    }

    .timeline-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .timeline-title {
        font-size: 20px;
    }

    .timeline-description {
        font-size: var(--font-size-small);
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .service-card {
        padding: var(--spacing-md);
    }

    .service-icon {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .service-title {
        font-size: 20px;
    }

    /* About */
    .about-image {
        max-width: 100%;
    }

    .about-text {
        font-size: var(--font-size-base);
    }

    .about-credentials {
        gap: var(--spacing-sm);
    }

    .credential-item {
        font-size: var(--font-size-small);
    }

    /* FAQ */
    .faq-item {
        margin-bottom: var(--spacing-sm);
    }

    .faq-question {
        padding: var(--spacing-sm);
    }

    .faq-question h3 {
        font-size: 18px;
    }

    .faq-answer p {
        padding: var(--spacing-sm);
        font-size: var(--font-size-small);
    }

    /* Contact */
    .contact-container {
        padding: 0 var(--spacing-sm);
    }

    .contact-form {
        padding: var(--spacing-md);
    }

    .form-input {
        padding: 14px 16px;
        font-size: var(--font-size-base);
    }

    .whatsapp-text {
        font-size: var(--font-size-base);
    }

    /* Footer */
    .footer {
        padding: var(--spacing-md) 0;
    }

    .footer-social {
        gap: var(--spacing-sm);
    }

    .social-link {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .footer-text {
        font-size: 12px;
    }
}

/* ===============================================
   Small Mobile (320px - 480px)
   =============================================== */
@media screen and (max-width: 480px) {
    :root {
        --font-size-h1: 28px;
        --font-size-h2: 24px;
        --font-size-h3: 20px;
    }

    .hero-title {
        font-size: 32px;
    }

    .stat-number {
        font-size: 32px;
    }

    .hero-gif {
        max-width: 280px;
    }
}

/* ===============================================
   Touch Device Optimizations
   =============================================== */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap target sizes */
    .btn,
    .nav-link,
    .faq-question,
    .social-link {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .result-card:hover,
    .service-card:hover,
    .timeline-item:hover .timeline-icon {
        transform: none;
    }

    /* Adjust animations for touch */
    .btn-primary:hover::before,
    .btn-whatsapp:hover::after {
        width: 0;
        height: 0;
    }
}

/* ===============================================
   Landscape Orientation (Mobile)
   =============================================== */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .hero {
        padding-top: 80px;
        padding-bottom: var(--spacing-lg);
    }

    .hero-container {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }

    .hero-content {
        text-align: right;
    }

    .hero-buttons {
        flex-direction: row;
    }

    .hero-image {
        order: 1;
    }

    .hero-gif {
        max-width: 300px;
    }

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

/* ===============================================
   High Resolution Displays (Retina)
   =============================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-gif,
    .result-image img,
    .about-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===============================================
   Dark Mode Support (Optional)
   =============================================== */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    :root {
        --bg-light: #1a1a1a;
        --bg-gray: #2a2a2a;
        --text-dark: #ffffff;
        --text-color: #cccccc;
        --border-color: #404040;
    }

    .header {
        background: rgba(26, 26, 26, 0.98);
    }

    .result-card,
    .service-card,
    .contact-form,
    .timeline-content,
    .faq-item {
        background: #2a2a2a;
    }

    .faq-question {
        background: #333333;
    }
    */
}

/* ===============================================
   Print Styles
   =============================================== */
@media print {
    /* Hide non-essential elements */
    .header,
    .nav,
    .hero-buttons,
    .contact-form,
    .contact-whatsapp,
    .footer-social,
    .nav-toggle {
        display: none !important;
    }

    /* Adjust layout for print */
    .hero-container,
    .about-container {
        grid-template-columns: 1fr;
    }

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

    /* Remove backgrounds and shadows */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Ensure readable text */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Add page breaks */
    section {
        page-break-inside: avoid;
    }
}

/* ===============================================
   Accessibility - Reduced Motion
   =============================================== */
@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-gif {
        animation: none !important;
    }
}

/* ===============================================
   High Contrast Mode
   =============================================== */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #FF0000;
        --text-dark: #000000;
        --bg-light: #FFFFFF;
        --border-color: #000000;
    }

    .btn-primary,
    .btn-secondary {
        border: 2px solid #000000;
    }

    a:focus,
    button:focus,
    input:focus {
        outline: 3px solid #000000;
        outline-offset: 2px;
    }
}

/* ===============================================
   Container Queries (Modern Browsers)
   =============================================== */
@supports (container-type: inline-size) {
    .results-grid {
        container-type: inline-size;
    }

    @container (max-width: 768px) {
        .result-card {
            grid-column: span 1;
        }
    }
}

/* ===============================================
   iOS Specific Fixes
   =============================================== */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari fixes */
    .btn,
    .form-input {
        -webkit-appearance: none;
        border-radius: var(--radius-sm);
    }

    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="tel"],
    textarea {
        font-size: 16px;
    }
}

/* ===============================================
   Firefox Specific Fixes
   =============================================== */
@-moz-document url-prefix() {
    .form-input {
        scrollbar-width: thin;
    }
}

/* ===============================================
   Edge/IE Specific Fixes (Legacy Support)
   =============================================== */
@supports (-ms-ime-align: auto) {
    .hero-container,
    .results-grid,
    .services-grid {
        display: -ms-grid;
    }
}
