/**
 * Estilos responsivos para el Club Balonmano Albacete
 * Incluye optimizaciones para dispositivos móviles y tablets
 */

/* Prevenir scroll horizontal en toda la página */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

/* Todos los elementos deben respetar el ancho de la pantalla */
* {
    max-width: 100vw;
    box-sizing: border-box;
}

/* Reglas globales responsivas */
img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    margin: 0 auto;
}

/* =====================
   TABLETS (991px y menos)
   ===================== */
@media (max-width: 991px) {
    /* Ajustes generales */
    .container {
        padding: 0 15px;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }
    
    /* Hero section */
    .hero-section {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero-slide .slide-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-slide .slide-content p {
        font-size: 1.1rem;
    }
    
    /* Grid de noticias */
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Grid de equipos */
    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Navegación móvil */
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background-color: #fff;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        transition: right 0.3s ease;
        overflow-y: auto;
        padding: 60px 20px 20px;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .nav-overlay.active {
        display: block;
    }
    
    body.menu-open {
        overflow: hidden;
    }
    
    /* Listas de navegación */
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-item {
        width: 100%;
        margin: 0;
        padding: 12px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    /* Patrocinadores - Corrección para que se vean en móvil */
    .sponsors-slider {
        overflow: visible;
        margin: 20px 0;
        width: 100%;
    }
    
    .sponsors-track {
        animation: none !important;
        transform: none !important;
        position: static;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        width: 100% !important;
    }
    
    .sponsor-item {
        width: calc(50% - 15px);
        margin: 0;
        padding: 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #fff;
    }
}

/* =====================
   MÓVILES (767px y menos)
   ===================== */
@media (max-width: 767px) {
    /* Ajustes generales */
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    /* Hero section */
    .hero-section {
        height: 50vh;
        min-height: 300px;
    }
    
    .hero-slide .slide-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .hero-slide .slide-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .slider-controls {
        bottom: 10px;
    }
    
    .slider-arrow {
        width: 36px;
        height: 36px;
    }
    
    /* Grid de noticias */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .news-card {
        margin-bottom: 0;
        width: 100%;
    }
    
    /* Grid de equipos */
    .teams-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .team-slide {
        margin-bottom: 0;
        width: 100%;
    }
    
    /* Patrocinadores - Corrección para móviles */
    .sponsors-track {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 100% !important;
    }
    
    .sponsor-item {
        width: 100%;
        margin: 0;
        padding: 10px;
        height: auto;
    }
    
    .sponsor-item img {
        max-height: 60px;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
    
    /* Botones */
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    /* Social links */
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
}

/* =====================
   MÓVILES PEQUEÑOS (480px y menos)
   ===================== */
@media (max-width: 480px) {
    /* Ajustes generales */
    .container {
        padding: 0 12px;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    /* Hero section */
    .hero-section {
        height: 40vh;
        min-height: 250px;
    }
    
    .hero-slide .slide-content h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .hero-slide .slide-content p {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .hero-slide .slide-content .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    /* Controles del slider */
    .slider-arrow {
        width: 32px;
        height: 32px;
    }
    
    .slider-dots .dot {
        width: 8px;
        height: 8px;
        margin: 0 4px;
    }
    
    /* Patrocinadores - Para móviles muy pequeños */
    .sponsors-track {
        grid-template-columns: 1fr;
    }
    
    /* Separación de secciones */
    section {
        padding: 30px 0;
    }
    
    /* Botones y acciones */
    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .view-all {
        margin-top: 15px;
    }
    
    /* Noticias */
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-excerpt {
        font-size: 0.9rem;
    }
}

/* =====================
   AJUSTES PARA NAVEGACIÓN MÓVIL
   ===================== */
.nav-toggle {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
}

.nav-toggle span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--color-primary, #0d47a1);
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.nav-toggle span:nth-child(1) {
    top: 0px;
}

.nav-toggle span:nth-child(2) {
    top: 10px;
}

.nav-toggle span:nth-child(3) {
    top: 20px;
}

.nav-toggle.active span:nth-child(1) {
    top: 10px;
    transform: rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    width: 0;
}

.nav-toggle.active span:nth-child(3) {
    top: 10px;
    transform: rotate(-45deg);
}

@media (max-width: 991px) {
    .nav-toggle {
        display: block;
    }
}

/* Eliminar cualquier elemento con fondo rojo que pueda causar problemas */
[style*="background-color: red"], 
[style*="background: red"],
[style*="background-color: #ff0000"],
[style*="background: #ff0000"] {
    display: none !important;
}