/* ==========================================
   RESPONSIVE.CSS - Media Queries
   ========================================== */

/* ==========================================
   DESKTOP (1025px y superior)
   ========================================== */

@media (min-width: 1025px) {
    /* Asegurar que stats-row en header desktop siempre muestre 4 columnas */
    .header-desktop .stats-row {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        align-items: center;
        gap: 0.25rem;
        padding: 0.15rem 0.25rem;
        min-height: 24px;
    }
}

/* ==========================================
   TABLET (1024px)
   ========================================== */

@media (max-width: 1024px) {
    .header-main-container {
        flex-direction: column;
    }
    
    .logo-independent,
    .content-independent {
        width: 100%;
    }
    
    .logo-independent {
        border-right: 0;
        border-bottom: 2px solid var(--accent);
        padding: 0.75rem;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .logo-independent .contact-btn {
        min-width: unset !important;
        max-width: 100%;
        width: 100%;
        font-size: 0.85rem;
        padding: 0.6rem 0.9rem;
        white-space: normal !important;
        line-height: 1.3;
        box-sizing: border-box;
    }
    
    /* En tablet, reducir tamaño y permitir ajuste */
    .logo-independent .contact-btn span {
        font-size: 0.75rem;
        display: inline-block;
        word-break: break-word;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Excepción: En header desktop mantener 4 columnas incluso en tablet */
    .header-desktop .stats-row {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .nav-social-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .navbar-container {
        width: 100%;
        justify-content: center;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .social-icons {
        order: 2;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }
    
    .social-icons a {
        min-width: 45px;
    }
    
    .social-count {
        font-size: 0.65rem;
    }
    
    .social-text {
        font-size: 0.55rem;
    }
    
    nav ul {
        flex-direction: column;
        text-align: center;
    }

    /* Content */
    .content-slider,
    .offices-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-content-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   MOBILE (768px)
   ========================================== */

@media (max-width: 768px) {
    html { 
        font-size: 14px; 
    }

    /* Header - Optimizado para móvil */
    .logo-independent {
        padding: 0.75rem 1rem 0.75rem 0.5rem !important;
        gap: 0.4rem !important;
        min-height: 70px;
    }
    
    .logo img {
        height: 70px !important;
        width: auto;
        max-width: 100%;
    }
    
    .logo-independent .logo {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
    
    .logo-independent .contact-btn {
        flex: 0 0 55% !important;
        max-width: 55% !important;
        width: auto !important;
        min-width: unset !important;
        font-size: 0.7rem !important;
        padding: 0.4rem 0.5rem !important;
        white-space: normal !important;
        line-height: 1.2;
        text-align: center;
        flex-wrap: wrap;
        word-break: break-all;
        min-height: 36px;
        margin: 0 0.25rem;
    }
    
    .logo-independent .mobile-menu-toggle {
        flex: 0 0 20% !important;
        max-width: 20% !important;
        width: auto !important;
        min-width: 44px !important;
        padding: 8px 10px !important;
        margin-right: 0 !important;
        align-items: center !important;
    }
    
    .logo-independent .mobile-menu-toggle .hamburger-line {
        width: 22px !important;
        max-width: 22px !important;
    }
    
    /* En móvil, ocultar "Consulta" y mostrar solo el número usando CSS */
    .logo-independent .contact-btn span {
        font-size: 0;
        position: relative;
    }
    
    .logo-independent .contact-btn span::before {
        content: '509-927-3840';
        font-size: 0.65rem;
        display: inline;
    }
    
    /* Asegurar que el icono también se ajuste */
    .logo-independent .contact-btn i {
        flex-shrink: 0;
        font-size: 0.8rem;
    }
    
    /* Stats bar más compacta - ocultar contenido por defecto */
    .stats-bar {
        max-height: 40px;
        overflow: hidden;
    }
    
    .stats-container {
        min-height: 40px;
    }
    
    .stats-title {
        padding: 0.3rem 0.5rem !important;
        min-height: 40px !important;
        font-size: 0.7rem !important;
    }
    
    /* Ocultar stats en el header fijo, pero mostrar en el menú móvil */
    .stats-row {
        display: none !important; /* Ocultar stats en móvil para ahorrar espacio */
    }
    
    .stats-cta {
        display: none !important; /* Ocultar CTA de stats en móvil */
    }
    
    /* Asegurar que cuando el menú móvil está abierto, las stats sean visibles */
    .mobile-menu-overlay.active .mobile-menu-content .stats-row,
    .mobile-menu-overlay .mobile-menu-content .stats-row {
        display: grid !important;
    }
    
    .mobile-menu-overlay.active .mobile-menu-content .stats-cta,
    .mobile-menu-overlay .mobile-menu-content .stats-cta {
        display: block !important;
    }

    /* Location bar más compacta - Solo header desktop */
    .header-desktop .location-bar {
        padding: 0.2rem 0 !important;
        gap: 0.3rem !important;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 50px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .header-desktop .location-item {
        font-size: 0.7rem;
    }
    
    .header-desktop .location-item a {
        font-size: 0.7rem !important;
    }

    /* Navigation */
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    /* Submenus */
    .submenu {
        position: static;
        box-shadow: none;
        border-radius: 0;
    }

    /* Hero */
    .hero.hero-static {
        margin-top: 145px !important;
        background: transparent !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    .hero-img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /* Content */
    .content-slider,
    .offices-content {
        grid-template-columns: 1fr;
    }

    .offices-img {
        height: 180px;
    }

    /* Contact */
    .contact-content {
        flex-direction: column;
    }

    /* Stats */
    .stats-title,
    .stats-cta {
        border: none;
        text-align: center;
    }
}

/* ==========================================
   SMALL MOBILE (480px)
   ========================================== */

@media (max-width: 480px) {
    /* Header aún más compacto en móviles pequeños */
    .logo img {
        height: 60px !important;
        width: auto;
        max-width: 100%;
    }
    
    .logo-independent {
        padding: 0.65rem 0.8rem 0.65rem 0.4rem !important;
        gap: 0.3rem !important;
        min-height: 65px;
    }
    
    .logo-independent .logo {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
    
    .logo-independent .contact-btn {
        flex: 0 0 55% !important;
        max-width: 55% !important;
        width: auto !important;
        font-size: 0.65rem !important;
        padding: 0.35rem 0.4rem !important;
        min-height: 32px;
        margin: 0 0.2rem;
    }
    
    .mobile-menu-toggle {
        flex: 0 0 20% !important;
        max-width: 20% !important;
        width: auto !important;
        min-width: 40px !important;
        height: 36px;
        padding: 6px 8px !important;
        margin-right: 0 !important;
        align-items: center !important;
    }
    
    .mobile-menu-toggle .hamburger-line {
        width: 20px !important;
        max-width: 20px !important;
    }
    }
    
    /* Ajustar padding-top del main-content para móviles pequeños */
    #main-content {
        padding-top: 210px !important;
    }
    
    .hero.hero-static {
        margin-top: 145px !important;
        background: transparent !important;
        min-height: auto !important;
        height: auto !important;
    }

    /* Botón de contacto en pantallas muy pequeñas */
    .logo-independent {
        padding: 0.4rem;
    }
    
    .logo-independent .contact-btn {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
        font-size: 0.65rem;
        padding: 0.4rem 0.5rem;
        white-space: normal !important;
        line-height: 1.1;
        text-align: center;
        flex-wrap: wrap;
        word-break: break-all;
    }
    
    /* En pantallas muy pequeñas, mostrar solo el número */
    .logo-independent .contact-btn span {
        font-size: 0;
    }
    
    .logo-independent .contact-btn span::before {
        content: '509-927-3840';
        font-size: 0.6rem;
        display: inline;
    }
    
    /* Asegurar que el icono se mantenga visible */
    .logo-independent .contact-btn i {
        flex-shrink: 0;
        font-size: 0.8rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .update-card,
    .service-card {
        min-height: 350px;
    }

    /* Ticker */
    .ticker-title {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .ticker-list li {
        font-size: 0.85rem;
        margin: 0 1rem;
    }

    /* Modal */
    .media-modal-content {
        width: 95%;
    }

    .media-close-modal {
        font-size: 24px;
        top: -35px;
    }
}

/* ==========================================
   LARGE SCREENS (1920px+)
   ========================================== */

@media (min-width: 1920px) {
    .header-main-container,
    .hero {
        max-width: 2560px;
        margin: 0 auto;
    }

    .container {
        max-width: 1400px;
    }
}

/* ==========================================
   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;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    header,
    footer,
    .social-icons,
    .contact-btn,
    .ticker-wrapper,
    nav,
    .hero {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

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

    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}