/* ========================================
   RESPONSIVE DESIGN - DESKTOP FIRST
   Mobile optimization with landscape support
   ======================================== */

/* DESKTOP FIRST BREAKPOINTS
   - Base styles: Desktop (>1440px)
   - Large Desktop: @media (max-width: 1440px)
   - Desktop: @media (max-width: 1024px)
   - Tablet: @media (max-width: 768px)
   - Mobile: @media (max-width: 767px)
*/

/* ========================================
   LARGE DESKTOP (≤1440px)
   ======================================== */
@media (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }

    .hero-section h1 {
        font-size: 3.5rem;
    }

    .service-card,
    .pest-card,
    .modern-card {
        padding: 30px;
    }
}

/* ========================================
   DESKTOP (≤1024px)
   ======================================== */
@media (max-width: 1024px) {
    .container {
        max-width: 960px;
    }

    .hero-section h1 {
        font-size: 3rem;
    }

    .hero-section p {
        font-size: 1.1rem;
    }

    /* Service cards grid adjustment */
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    /* Navigation adjustments */
    .navbar-nav .nav-link {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
}

/* ========================================
   TABLET (≤768px)
   ======================================== */
@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        max-width: 720px;
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Typography scaling */
    .hero-section h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .hero-section p {
        font-size: 1rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* Service cards single column */
    .service-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Statistics section */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Section spacing reduction */
    .section-padding {
        padding: 50px 0;
    }

    .page-header {
        padding: 50px 0;
    }
}

/* ========================================
   MOBILE (≤767px)
   ======================================== */
@media (max-width: 767px) {
    /* Container mobile optimization */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Typography mobile */
    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.35rem;
    }

    /* Touch-friendly buttons (minimum 44x44px) */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 25px;
        font-size: 0.9rem;
    }

    .btn-cta {
        min-height: 48px;
        padding: 14px 30px;
        font-size: 0.95rem;
    }

    /* Touch-friendly navigation */
    .navbar-nav .nav-link {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }

    /* Touch-friendly form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 15px;
    }

    /* Touch-friendly checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 24px;
        min-height: 24px;
        margin-right: 10px;
    }

    /* Statistics single column on small mobile */
    .stats-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Section spacing mobile */
    .section-padding {
        padding: 40px 0;
    }

    .page-header {
        padding: 30px 0;
    }

    .section-title {
        margin-bottom: 30px;
        font-size: 1.75rem;
    }

    /* Cards mobile optimization */
    .service-card,
    .pest-card,
    .modern-card {
        padding: 20px;
        margin-bottom: 15px;
    }

    /* Modal mobile optimization */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Footer mobile */
    footer .row > div {
        margin-bottom: 30px;
    }

    footer h5 {
        font-size: 1.1rem;
    }

    /* Pest showcase mobile */
    .pest-category-section {
        margin-bottom: 30px;
    }

    .pest-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Consultation cards mobile */
    .consultation-card {
        margin-bottom: 20px;
    }

    /* Video background mobile */
    .video-background {
        display: none; /* Hide video on mobile for performance */
    }

    .hero-section {
        background: linear-gradient(135deg, #1a2a1f 0%, #0f1811 100%);
    }
}

/* ========================================
   SMALL MOBILE (≤480px)
   ======================================== */
@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .btn-cta {
        padding: 12px 25px;
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE ORIENTATION
   Optimized for phones in landscape mode
   ======================================== */
@media screen and (orientation: landscape) and (max-height: 600px) {
    /* Reset body spacing for landscape */
    body {
        padding-top: 60px;
    }

    /* Compact header */
    .navbar {
        min-height: 60px;
        padding: 5px 0;
    }

    .navbar-brand img {
        max-height: 45px;
    }

    /* Compact hero section */
    .hero-section {
        min-height: 80vh;
        padding: 30px 0;
    }

    .hero-section h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .hero-section p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    /* Compact buttons */
    .btn {
        padding: 8px 20px;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .btn-cta {
        padding: 10px 25px;
        font-size: 0.9rem;
        min-height: 42px;
    }

    /* Compact sections */
    .section-padding {
        padding: 30px 0;
    }

    .page-header {
        padding: 20px 0;
    }

    /* Compact modals */
    .modal-content {
        max-height: 95vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 10px 15px;
    }

    .modal-body {
        padding: 15px;
    }

    /* Compact section titles */
    .section-title {
        margin-bottom: 20px;
        font-size: 1.5rem;
    }

    /* Compact cards */
    .service-card,
    .pest-card,
    .modern-card {
        padding: 15px;
    }

    /* Two column grid for landscape */
    .service-grid,
    .pest-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* Compact stats */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

    /* Compact footer */
    footer {
        padding: 30px 0 20px;
    }

    footer .row > div {
        margin-bottom: 20px;
    }
}

/* ========================================
   LANDSCAPE MOBILE WIDE (landscape & ≥600px height)
   ======================================== */
@media screen and (orientation: landscape) and (min-height: 600px) {
    .service-grid,
    .pest-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

/* ========================================
   PAYMENT MODAL MOBILE OPTIMIZATION
   Full screen on mobile, compact on landscape
   ======================================== */
@media (max-width: 767px) {
    #paymentModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100vh;
    }

    #paymentModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
        border: none;
    }

    #paymentModal .modal-header {
        padding: 15px 20px;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    #paymentModal .modal-body {
        padding: 20px;
        overflow-y: auto;
    }

    #paymentModal .close {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
        font-size: 1.5rem;
    }

    /* Stripe Elements mobile */
    #card-element {
        padding: 15px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    #payment-request-button {
        height: 50px;
        margin-bottom: 20px;
    }
}

/* Payment modal landscape mobile */
@media screen and (orientation: landscape) and (max-height: 600px) {
    #paymentModal .modal-dialog {
        height: auto;
        max-height: 95vh;
    }

    #paymentModal .modal-content {
        min-height: auto;
        max-height: 95vh;
    }

    #paymentModal .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* ========================================
   CAL.COM EMBED RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
    #calcom-embed-container {
        width: 100%;
        padding: 0;
    }

    #calcom-embed-container iframe {
        min-height: 600px;
        width: 100%;
    }

    /* Cal.com modal mobile */
    .cal-modal {
        margin: 0;
        max-width: 100%;
        width: 100%;
    }
}

@media screen and (orientation: landscape) and (max-height: 600px) {
    #calcom-embed-container iframe {
        min-height: 500px;
    }
}

/* ========================================
   TALLY FORM MOBILE OPTIMIZATION
   ======================================== */
@media (max-width: 767px) {
    #tally-embed-container {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    #tally-embed-container iframe {
        width: 100%;
        min-height: calc(100vh - 85px);
        border: none;
    }

    .tally-form-wrapper {
        padding: 0;
        margin: 0;
    }
}

@media screen and (orientation: landscape) and (max-height: 600px) {
    #tally-embed-container iframe {
        min-height: calc(100vh - 60px);
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   Remove hover effects on touch devices
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover transforms on touch devices */
    .btn:hover,
    .service-card:hover,
    .pest-card:hover,
    .modern-card:hover,
    .consultation-card:hover,
    .testimonial-card:hover,
    .benefit-item:hover,
    .logo-unit:hover,
    .nav-link:hover,
    .stat-card:hover {
        transform: none !important;
    }

    /* Use active states instead */
    .btn:active,
    .service-card:active,
    .pest-card:active,
    .modern-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Touch feedback for interactive elements */
    .btn-cta:active {
        background-color: var(--cta-orange-hover);
        transform: scale(0.98);
    }

    .btn-primary:active {
        background-color: var(--dark-green);
        transform: scale(0.98);
    }
}

/* ========================================
   REDUCED MOTION
   Respect user preference for 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;
    }

    /* Disable AOS animations */
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .service-card,
    .pest-card,
    .modern-card {
        border-width: 2px;
    }

    .modal-content {
        border-width: 2px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    /* Hide navigation and interactive elements */
    .navbar,
    .btn,
    #back-to-top,
    .modal,
    .video-background {
        display: none !important;
    }

    /* Optimize for print */
    body {
        padding-top: 0;
        background: white;
    }

    .section-padding {
        page-break-inside: avoid;
    }

    /* Show URLs in links */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}