/* =========================================
   ESTILOS GLOBALES
========================================= */
body { background: #080808; color: #eee; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; box-sizing: border-box; }

/* =========================================
   1. PORTADA / INICIO (index.php)
========================================= */
.landing-body { display: flex; align-items: center; justify-content: center; height: 100vh; overflow: hidden; background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%); }
.landing-container { text-align: center; animation: fadeIn 1s ease-in-out; }
.landing-title { font-size: 4rem; color: #e50914; margin: 0 0 10px 0; text-shadow: 0 4px 10px rgba(229, 9, 20, 0.4); }
.landing-subtitle { font-size: 1.5rem; color: #ccc; margin: 0 0 40px 0; font-weight: 300; }
.btn-entrar { display: inline-block; background: #e50914; color: white; padding: 15px 40px; font-size: 1.5rem; text-decoration: none; border-radius: 8px; font-weight: bold; transition: 0.3s; box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4); }
.btn-entrar:hover { background: #ff0f1f; transform: scale(1.05); box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6); }
.landing-idiomas { margin-top: 50px; font-size: 0.9rem; color: #555; }
.landing-idiomas a { color: #888; text-decoration: none; transition: 0.2s; }
.landing-idiomas a:hover { color: #fff; }
.landing-idiomas .active { color: #fff; font-weight: bold; border-bottom: 2px solid #e50914; padding-bottom: 2px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   2. INTERIOR APP (canales.php)
========================================= */
/* Barra Superior */
.top-navbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; background: #111; border-bottom: 1px solid #222; position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.logo-tv { font-size: 1.8rem; font-weight: bold; color: #e50914; margin: 0; }
.search-container input { padding: 12px 25px; border-radius: 30px; border: 1px solid #333; background: #1a1a1a; color: white; width: 350px; outline: none; -webkit-appearance: none; appearance: none; transition: 0.3s; font-size: 1rem; }
.search-container input:focus { border-color: #e50914; background: #000; box-shadow: 0 0 12px rgba(229, 9, 20, 0.4); }

/* Contenedor Principal */
.main-content { padding: 30px 40px; }
.header-action { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; }
.btn-volver { background: #222; color: white; border: 1px solid #444; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: 0.2s; font-weight: bold; }
.btn-volver:hover { background: #e50914; border-color: #e50914; }
#titulo-categoria { margin: 0; font-size: 1.8rem; font-weight: 300; }

/* === Cuadrícula de Rectángulos Apaisados === */
.grid { 
    display: grid; 
    /* Esta es la clave para que sean rectángulos: 260px de ancho mínimo */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 20px; 
}

/* Tarjetas (Cards) - Ahora son Rectángulos Horizontales */
.card { 
    background: #1a1a1a; 
    padding: 15px 20px; 
    border-radius: 8px; 
    text-align: center; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    border: 2px solid transparent; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    min-height: 110px; /* Al ser bajitas y anchas, parecen pantallas 16:9 */
}

/* 🌟 Efecto Zoom al pasar el ratón 🌟 */
.card:hover { 
    transform: scale(1.08); /* Se acerca hacia la pantalla */
    border-color: #e50914; 
    background: #222; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
    z-index: 10;
}

/* Elementos dentro de la tarjeta */
.country-flag { font-size: 2.5rem; margin-bottom: 5px; line-height: 1; }
.country-name { font-weight: bold; font-size: 1.2rem; margin-bottom: 2px; }
.country-count { color: #888; font-size: 0.85rem; }

.channel-logo { max-width: 90%; height: 50px; object-fit: contain; margin-bottom: 10px; }
.logo-placeholder { font-size: 2rem; margin-bottom: 10px; color: #444; }
.channel-name { font-weight: bold; font-size: 0.95rem; word-wrap: break-word; }

/* EPG (Guía de TV) */
.epg-preview { font-size: 0.75rem; color: #bbb; margin-top: 10px; padding-top: 8px; border-top: 1px dashed #333; width: 100%; text-align: center; }
.epg-live { color: #64b5f6; font-weight: bold; font-size: 0.7rem; display: block; margin-bottom: 2px; }

/* =========================================
   3. RESPONSIVE DESIGN (MÓVILES Y TABLETS)
========================================= */

/* Para pantallas medianas y tablets (menos de 900px) */
@media (max-width: 900px) {
    .grid { 
        /* Hacemos las tarjetas un poco más pequeñas para que quepan varias */
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    }
}

/* Para teléfonos móviles (menos de 600px) */
@media (max-width: 600px) {
    /* Portada (Index) */
    .landing-title { font-size: 2.5rem; }
    .landing-subtitle { font-size: 1.2rem; margin-bottom: 30px; }
    .btn-entrar { padding: 12px 30px; font-size: 1.2rem; }

    /* Barra Superior */
    .top-navbar { 
        flex-direction: column; /* Ponemos el buscador debajo del logo */
        gap: 15px; 
        padding: 15px 20px; 
    }
    .search-container { width: 100%; }
    /* Con Niños, Mascotas y Deportes los botones no caben en una fila: se reparten en varias, centrados */
    .nav-botones { justify-content: center; gap: 8px !important; width: 100%; }
    .nav-botones .logo-tv { width: 100%; text-align: center; font-size: 1.5rem; }
    .nav-botones > a, .nav-botones > button { padding: 7px 11px !important; font-size: .9rem; width: auto !important; flex: 0 0 auto; }
    .search-container input { 
        width: 100%; /* El buscador ocupa de lado a lado */
        box-sizing: border-box; 
    }

    /* Contenido General */
    .main-content { padding: 20px; }
    .header-action { flex-direction: column; align-items: flex-start; gap: 10px; }
    #titulo-categoria { font-size: 1.4rem; }
    
    /* El botón de volver ocupa todo el ancho en móvil para pulsarlo fácil con el dedo */
    .btn-volver { width: 100%; text-align: center; } 

    /* Cuadrícula de Tarjetas para Móvil */
    .grid { 
        /* En móvil dejamos que las tarjetas se adapten a la pantalla (mínimo 140px) */
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 15px;
    }
    .card { padding: 10px; min-height: 90px; }
    .country-flag { font-size: 2rem; }
    .country-name { font-size: 1rem; }
    .channel-logo { height: 40px; }
    .channel-name { font-size: 0.85rem; }
}
/* Sección infantil (canales.php?ninos=1) */
.btn-ninos { display: inline-block; background: #ffb300; color: #2a1600; text-decoration: none; font-weight: bold; padding: 8px 14px; border-radius: 8px; border: 1px solid #ffcb4d; white-space: nowrap; transition: 0.2s; }
.btn-ninos:hover, .btn-ninos:focus-visible { background: #ffc933; transform: scale(1.04); outline: none; }
body.ninos .top-navbar { background: linear-gradient(90deg, #2a1a40, #13283f); border-bottom-color: #ffb300; }
body.ninos .card:hover { border-color: #ffb300; }
body.ninos #titulo-categoria { color: #ffd166; }
.btn-mascotas { display: inline-block; background: #43a047; color: #fff; text-decoration: none; font-weight: bold; padding: 8px 14px; border-radius: 8px; border: 1px solid #66bb6a; white-space: nowrap; transition: 0.2s; }
.btn-mascotas:hover, .btn-mascotas:focus-visible { background: #57b85b; transform: scale(1.04); outline: none; }
body.mascotas .top-navbar { background: linear-gradient(90deg, #1b3a1f, #13283f); border-bottom-color: #66bb6a; }
body.mascotas .card:hover { border-color: #66bb6a; }
body.mascotas #titulo-categoria { color: #a5d6a7; }
.btn-deportes { display: inline-block; background: #1e88e5; color: #fff; text-decoration: none; font-weight: bold; padding: 8px 14px; border-radius: 8px; border: 1px solid #42a5f5; white-space: nowrap; transition: 0.2s; }
.btn-deportes:hover, .btn-deportes:focus-visible { background: #3d9bf0; transform: scale(1.04); outline: none; }
body.deportes .top-navbar { background: linear-gradient(90deg, #0d2a4a, #13283f); border-bottom-color: #42a5f5; }
body.deportes .card:hover { border-color: #42a5f5; }
body.deportes #titulo-categoria { color: #90caf9; }
.card.card-especial { background: linear-gradient(135deg, #2a1f05, #1a1a1a); border-color: #6b5410; }
