/* ==========================================================================
   MEGA DISINFESTAZIONI - CUSTOM RESPONSIVE CSS
   This stylesheet isolates all mobile & tablet overrides.
   Absolute constraint: Desktop layout (width >= 1024px) is NOT altered.
   ========================================================================== */

/* --------------------------------------------------------------------------
   TABLET BREAKPOINT (< 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    /* Section Padding Adjustments */
    #chi-siamo, #servizi, #i-nostri-mezzi, #contatti {
        padding-top: 5rem !important;
        padding-bottom: 5rem !important;
    }

    /* Titles Adjustments */
    #chi-siamo h2, #servizi h2, #i-nostri-mezzi h2, #contatti h2 {
        font-size: 2.5rem !important;
        line-height: 1.15 !important;
        margin-bottom: 3rem !important;
    }

    /* Servizi Background Custom Ambient Glow for Mobile/Tablet */
    #servizi img {
        display: none !important;
    }
    #servizi > div.absolute.inset-x-0 {
        background: 
            radial-gradient(circle at 20% 30%, rgba(173, 255, 0, 0.08) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(0, 240, 255, 0.06) 0%, transparent 50%),
            radial-gradient(circle at 50% 50%, rgba(173, 255, 0, 0.04) 0%, transparent 70%) !important;
        opacity: 1 !important;
        height: 100% !important;
    }

    /* Disable AOS animations inside Servizi for a static immediate display on mobile/tablet */
    #servizi [data-aos] {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }

    /* Chi Siamo Layout */
    #chi-siamo .aspect-\[4\/5\] {
        aspect-ratio: 16 / 10 !important;
        border-radius: 24px !important;
    }

    /* Gallery (I nostri mezzi) */
    .image-item {
        width: 240px !important;
        height: 240px !important;
        border-radius: 20px !important;
    }

    /* Service Modal Adjustments */
    #service-modal #modal-header {
        width: 100% !important;
        border-right: none !important;
        height: 5rem !important;
    }
    #service-modal #modal-container {
        flex-direction: column !important;
    }
    #service-modal .overflow-y-auto {
        padding-top: 5.5rem !important;
    }
    
    /* Sticky header close button alignment and visibility guarantee */
    #service-modal button[onclick="closeModal()"] {
        position: absolute !important;
        top: 1rem !important;
        right: 1.5rem !important;
        width: 3rem !important;
        height: 3rem !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-color: #adff00 !important; /* solid neon border for maximum contrast */
        background-color: rgba(0, 0, 0, 0.9) !important; /* solid dark background to block out text underneath */
        color: #adff00 !important; /* force neon color on text/icons */
    }

    #service-modal button[onclick="closeModal()"] svg {
        width: 1.5rem !important;
        height: 1.5rem !important;
        stroke: #adff00 !important; /* force SVG stroke color */
        display: block !important;
    }

    /* Disable zoom gesture within the services modal on touch devices, maintaining vertical scroll */
    #service-modal, 
    #service-modal * {
        touch-action: pan-y !important;
    }
}

/* --------------------------------------------------------------------------
   SMARTPHONE BREAKPOINT (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    /* Section Padding Adjustments */
    #chi-siamo, #servizi, #i-nostri-mezzi, #contatti {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }

    /* Title Scales */
    #chi-siamo h2, #servizi h2, #i-nostri-mezzi h2, #contatti h2 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 2rem !important;
    }

    /* Mobile Menu Overlay Smooth Slide */
    #mobile-menu:not(.hidden) {
        display: flex !important;
        animation: mobileMenuFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Hero Parallax Scales */
    #hero-title {
        font-size: 3.25rem !important;
        line-height: 0.9 !important;
        margin-bottom: 1.5rem !important;
    }
    #hero-phrase p {
        font-size: 1.15rem !important;
        line-height: 1.3 !important;
        margin-bottom: 2rem !important;
    }
    #hero-phrase a {
        padding: 1rem 2rem !important;
        border-radius: 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Hero Insects Scaling (prevents overlapping) */
    .mosquito {
        width: 44px !important;
        height: 44px !important;
        opacity: 0.85 !important;
    }
    #m3, #m9, #w2 {
        width: 56px !important;
        height: 56px !important;
        opacity: 0.9 !important;
    }

    /* Scroll Indicator mobile fix */
    #scroll-indicator span {
        font-size: 8px !important;
        letter-spacing: 0.3em !important;
    }
    #scroll-indicator div {
        height: 2rem !important;
    }

    /* Chi Siamo Layout Mobile */
    #chi-siamo .aspect-\[4\/5\] {
        aspect-ratio: 4 / 3 !important;
        border-radius: 20px !important;
    }
    #chi-siamo .grid {
        gap: 2rem !important;
    }
    #chi-siamo .space-y-8 > div.grid {
        gap: 1rem !important;
    }
    #chi-siamo .p-6.glass-card {
        padding: 1.25rem !important;
        border-radius: 1rem !important;
    }

    /* Servizi Grid */
    #servizi .grid {
        gap: 1rem !important;
    }
    #servizi .glass-card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    /* Gallery (I nostri mezzi) */
    .image-item {
        width: 180px !important;
        height: 180px !important;
        border-radius: 16px !important;
        padding: 4px !important;
    }
    .image-item img {
        border-radius: 12px !important;
    }

    /* Contatti Section Mobile layout overrides */
    #contatti .grid {
        gap: 2rem !important;
    }
    #contatti .grid > div:first-child {
        text-align: center;
    }
    #contatti .grid > div:first-child .grid {
        text-align: left;
        gap: 1.5rem !important;
    }
    #contatti #status-badge {
        justify-content: center;
    }

    /* Contatti Big Card Right */
    #contatti .glass-card.p-10 {
        padding: 1.5rem !important;
        border-radius: 24px !important;
    }
    #contatti .glass-card.p-10 h3 {
        font-size: 1.75rem !important;
    }
    #contatti .glass-card.p-10 p {
        font-size: 0.875rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Contatti Call Button block */
    #contatti .glass-card.p-10 a[href*="tel"] {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
        border-radius: 1rem !important;
    }
    #contatti .glass-card.p-10 a[href*="tel"] span.text-3xl {
        font-size: 1.5rem !important;
    }
    #contatti .glass-card.p-10 a[href*="tel"] span.text-\[10px\] {
        font-size: 8px !important;
        letter-spacing: 0.2em !important;
    }

    /* Service Modal Mobile */
    #modal-main-title {
        font-size: 1.85rem !important;
        line-height: 1.1 !important;
    }
    #modal-subtitle {
        font-size: 0.875rem !important;
    }
    #modal-caption {
        font-size: 0.875rem !important;
    }
    #service-modal .overflow-y-auto {
        padding-top: 5rem !important;
    }
    #service-modal .max-w-4xl {
        padding-bottom: 4rem !important;
    }
    #modal-steps-container {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    #modal-steps-container > div {
        padding: 1rem !important;
    }
    
    /* Direct Response Quick Action Panel inside modal */
    #service-modal .bg-neon\/10 {
        padding: 1.25rem !important;
        text-align: center;
        flex-direction: column !important;
    }
    #service-modal .bg-neon\/10 a {
        width: 100% !important;
        justify-content: center;
    }
}

/* --------------------------------------------------------------------------
   SMARTPHONE COMPACT BREAKPOINT (< 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 479px) {
    /* Section Breathing Space */
    #chi-siamo, #servizi, #i-nostri-mezzi, #contatti {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
    }

    /* Titles */
    #chi-siamo h2, #servizi h2, #i-nostri-mezzi h2, #contatti h2 {
        font-size: 1.75rem !important;
    }

    /* Hero Headline */
    #hero-title {
        font-size: 2.75rem !important;
    }
    #hero-phrase p {
        font-size: 1.05rem !important;
    }

    /* Call Button scale down to prevent wrapping */
    #contatti .glass-card.p-10 a[href*="tel"] span.text-3xl {
        font-size: 1.25rem !important;
    }
    #contatti .glass-card.p-10 a[href*="tel"] svg {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    /* Nav bar adjustments */
    nav .max-w-7xl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        height: 4.5rem !important;
    }
    nav span.font-display {
        font-size: 0.875rem !important;
    }
    nav img {
        height: 2rem !important;
    }
    nav a[href*="tel"] {
        padding: 0.35rem 0.75rem !important;
    }
}

/* --------------------------------------------------------------------------
   SMARTPHONE MICRO BREAKPOINT (< 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 359px) {
    /* Critical micro text scales */
    #hero-title {
        font-size: 2.25rem !important;
    }
    #modal-main-title {
        font-size: 1.5rem !important;
    }
    #contatti .glass-card.p-10 a[href*="tel"] span.text-3xl {
        font-size: 1.15rem !important;
    }
}

/* --------------------------------------------------------------------------
   ANIMATIONS & EFFECTS
   -------------------------------------------------------------------------- */
@keyframes mobileMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
