/* ========================================
   SIDECSA - RESPONSIVE STYLES
   Mobile First Design para México
   ======================================== */

/* Estilos base para contenido responsive */
@media (max-width: 480px) {
    /* Hero sections en páginas */
    .hero-section,
    section[style*="padding: var(--spacing-hero)"] {
        padding: 1.5rem 0 !important;
    }
    
    .hero-section h1,
    h1[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    .hero-section p,
    section p[style*="font-size: 1rem"] {
        font-size: 0.9rem !important;
    }
    
    /* Secciones de contenido */
    section {
        padding: 2rem 0 !important;
    }
    
    h2, h2[style*="font-size"] {
        font-size: 1.5rem !important;
    }
    
    h3, h3[style*="font-size"] {
        font-size: 1.25rem !important;
    }
    
    /* Grids - forzar 1 columna */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Botones del hero slider */
    .hero-slider a[class*="btn"],
    a[style*="position: absolute"] {
        position: static !important;
        display: block !important;
        margin: 0.5rem auto !important;
        max-width: 200px !important;
        text-align: center !important;
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
    }
    
    /* Hero slider ajustes */
    .hero-slider {
        position: relative;
        padding-bottom: 6rem !important;
    }
    
    /* Contenedor de botones hero */
    .hero-slider ~ * {
        margin-top: 0 !important;
    }
    
    /* Trust bar - stack vertical */
    div[style*="display: flex"][style*="justify-content: space-around"] {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    /* Cards y grids de contacto */
    div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Iconos grandes de contacto */
    div[style*="font-size: 3.5rem"] {
        font-size: 2.5rem !important;
    }
    
    /* Formularios */
    input, textarea, select {
        font-size: 16px !important;
        width: 100% !important;
    }
    
    /* Padding reducido en cards */
    a[style*="padding: var(--spacing-2xl)"],
    div[style*="padding: var(--spacing-2xl)"] {
        padding: 1.5rem !important;
    }
    
    /* Tablas responsive */
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Max width para textos */
    div[style*="max-width: 900px"],
    div[style*="max-width: 800px"] {
        max-width: 100% !important;
        padding: 0 1rem !important;
    }
    
    /* Badges y tags */
    div[style*="border-radius: 20px"] {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}

/* Mobile Medium - 375px a 767px */
@media (min-width: 481px) and (max-width: 767px) {
    .hero-section {
        padding: 2rem 0 !important;
    }
    
    h1[style*="font-size: 2rem"] {
        font-size: 1.75rem !important;
    }
    
    h2[style*="font-size"] {
        font-size: 1.75rem !important;
    }
    
    section {
        padding: 2.5rem 0 !important;
    }
    
    /* Grid 1 columna */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Botones hero */
    .hero-slider a[class*="btn"] {
        font-size: 0.9rem !important;
        padding: 0.7rem 1.25rem !important;
    }
}

/* Tablet Portrait - 768px a 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-section {
        padding: 2.5rem 0 !important;
    }
    
    h1[style*="font-size: 2rem"] {
        font-size: 2rem !important;
    }
    
    section {
        padding: 3rem 0 !important;
    }
    
    /* Grid 2 columnas para servicios */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    /* Grid 2 columnas para contacto */
    div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

/* Desktop ajustes */
@media (min-width: 1024px) {
    /* Asegurar que los grids de 2 columnas funcionen bien */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Utilidades Mobile */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .text-mobile-center {
        text-align: center !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    /* Forzar botones a full width en móvil */
    a[style*="border-radius"],
    button {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
    }
}

/* Fix para sticky header en móviles */
@media (max-width: 767px) {
    body {
        padding-top: 0;
    }
    
    .header {
        position: sticky;
    }
}

/* Mejoras touch para móviles */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar áreas de toque */
    a, button, .btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mejorar contraste para tap */
    a:active, button:active {
        opacity: 0.7;
    }
}

/* Landscape mobile fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-slider {
        height: 100vh !important;
        min-height: auto !important;
    }
    
    .hero-section {
        padding: 1rem 0 !important;
    }
    
    .header {
        padding: 0.3rem 0 !important;
    }
    
    .logo img {
        height: 40px !important;
    }
}

/* Safe area para iPhone con notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Fix específicos para páginas */

/* HOME - Botones del slider */
@media (max-width: 767px) {
    .hero-buttons {
        flex-direction: column !important;
        position: static !important;
        padding: 1rem !important;
        gap: 0.75rem !important;
        margin-top: 1rem;
    }
    
    .hero-buttons a {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto !important;
        text-align: center !important;
        justify-content: center !important;
    }
    
    .hero-slider {
        padding-bottom: 1rem !important;
    }
}

/* SERVICIOS - Imágenes responsive */
@media (max-width: 767px) {
    img[style*="max-width"],
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* CONTACTO - Formulario y sidebar stack */
@media (max-width: 767px) {
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}
