/* ==========================================
   1. ESTILOS GENERALES Y RESET
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f1f5f9;
    color: #0f172a;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding-bottom: 60px;
}

/* ==========================================
   2. HEADER Y BARRA DE TRANSMISIÓN
   ========================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.stream-banner {
    background-color: #0b132b;
    color: #ffffff;
    font-size: 0.85rem;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    max-height: 60px;
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stream-banner.closing {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
}

.stream-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.live-dot {
    width: 9px;
    height: 9px;
    background-color: #ef4444;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-live 1.4s infinite ease-in-out;
}

@keyframes pulse-live {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        opacity: 1;
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
        opacity: 0.4;
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        opacity: 1;
    }
}

.stream-link {
    color: #38bdf8;
    font-weight: 700;
    text-decoration: none;
}

.stream-link:hover {
    text-decoration: underline;
}

.close-banner-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.close-banner-btn:hover {
    color: #ffffff;
}

.header-main-content {
    background-color: #1b365d;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: 6px;
}

.header-titles h1 {
    font-size: 1.1rem;
    color: #ffffff;
    margin: 0;
    font-weight: 700;
}

.header-titles h2 {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin: 0;
    font-weight: 700;
}


.header-subtitle {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 2px 0 0 0;
}

.author-highlight {
    color: #3b82f6;
    font-weight: 600;
}

/* ==========================================
   3. CONTENEDORES Y VISTAS (TABS)
   ========================================== */
.main-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tab-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-color: #f8fafc;
    overflow-y: auto;
}

.tab-view.active-view {
    display: flex;
    flex-direction: column;
}

/* Envoltorio del mapa para asegurar renderizado completo */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   4. MAPA Y CONTROLES FLOTANTES (ESTILO DE LA IMAGEN)
   ========================================== */
#map {
    width: 100%;
    height: 100%;
    flex: 1;
}

.map-controls-floating {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 2000; /* Subimos el z-index para que esté siempre por encima de cualquier capa del mapa */
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.65); /* Un pelín más opaco para evitar transparencias extrañas */
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.custom-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.75);
    color: #1e293b;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
}

.btn-gps {
    width: 100%;
    background-color: rgba(37, 99, 235, 0.75);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
    transition: background-color 0.2s;
}

.btn-gps:hover {
    background-color: #1d4ed8;
}

/* ==========================================
   5. TARJETAS Y LISTADOS (SEDES Y ROL)
   ========================================== */
.view-content {
    padding: 16px;
    padding-bottom: 80px;
}

.card-match {
    background: white;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-match .badge {
    background-color: #eff6ff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.card-match .teams {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.card-match small {
    color: #64748b;
    font-size: 0.8rem;
}

/* Barra desplazable horizontal para categorías de rol de juegos */
.category-tabs-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px 0;
    margin-bottom: 12px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.cat-tab-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.cat-tab-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* ==========================================
   6. SECCIÓN DE CONTACTO Y SOPORTE
   ========================================== */
#view-contacto .view-content {
    max-width: 600px;
    margin: 0 auto;
}

#view-contacto h2 {
    color: #1b365d;
    font-size: 1.4rem;
    margin-bottom: 4px;
    font-weight: 700;
}

#view-contacto .subtitle {
    color: #64748b;
    font-size: 0.88rem;
    margin-bottom: 24px;
}

#view-contacto > div > div {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

/* ==========================================
   7. BARRA DE NAVEGACIÓN INFERIOR
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;          /* Z-index alto para que siempre esté por encima del contenido y mapa */
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05)
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
}

.nav-item.active {
    color: #2563eb;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
}

/* ==========================================
   ESTILOS PERSONALIZADOS PARA EL BOTÓN DE CIERRE DEL POPUP
   ========================================== */
.leaflet-popup-close-button {
    color: #ef4444 !important; /* Color rojo vibrante */
    font-size: 20px !important; /* Aumenta el tamaño de la 'X' */
    font-weight: bold !important; /* Hace la línea más gruesa */
    padding: 4px 8px 0 0 !important; /* Ajusta la posición para que quede bien centrada */
}

/* Efecto al pasar el cursor o presionar en dispositivos táctiles */
.leaflet-popup-close-button:hover {
    color: #dc2626 !important; /* Un tono de rojo un poco más oscuro al presionar */
}