/* ==========================================
   1. VARIABLES Y BASES
   ========================================== */
:root {
    --azul-maranata: #1D2B53;
    --amarillo-maranata: #F9C80E;
    --blanco: #ffffff;
    --gris-fondo: #f4f7f6;
    --sidebar-width: 260px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--gris-fondo);
    margin: 0;
    padding-top: 70px; /* Espacio para el navbar fijo */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* Colores institucionales */
.text-yellow { color: var(--amarillo-maranata) !important; }
.bg-maranata { background-color: var(--azul-maranata) !important; }

.main-content, 
main, 
.container, 
.container-fluid {
    flex: 1 0 auto;
    padding-top: 0 !important;
    margin-top: 0 !important;
}
footer {
    margin-top: auto;
    flex-shrink: 0;
}
/* ==========================================
   2. COMPONENTES GLOBALES (BOTONES Y ALERTAS)
   ========================================== */
.text-yellow { color: var(--amarillo-maranata) !important; }

.btn-maranata {
    background-color: var(--amarillo-maranata) !important;
    color: var(--azul-maranata) !important;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    padding: 10px 24px;
    transition: all 0.3s ease;
}

.btn-maranata:hover {
    background-color: #e0b40d !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

/* Estilo para errores de Login/Registro */
.auth-error-message {
    background-color: #fff5f8; 
    color: #fa032c;           
    border: 1px solid #fa6502;
    padding: 12px;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 500;
}

/* ==========================================
   3. NAVBAR PRINCIPAL
   ========================================== */
.navbar-maranata { 
    background-color: var(--azul-maranata) !important; 
    border-bottom: 3px solid var(--amarillo-maranata); 
}
.navbar-maranata .container {
    max-width: 100% !important;
    padding-left: 30px;
    padding-right: 30px;
}

.navbar-brand img { height: 60px; margin-right: 40px; }

/* ==========================================
   4. HERO SECTION (PÁGINA DE INICIO)
   ========================================== */
/* --- COMPACTACIÓN DEL HERO --- */
/* --- COMPACTACIÓN TOTAL DEL HERO --- */
.hero-section {
    min-height: 300px !important; /* Reducimos drásticamente la altura */
    padding: 20px 0 60px !important; /* Menos espacio arriba, un poco más abajo para el traslape */
    background: radial-gradient(circle at center, #ffffff 0%, #f4f7f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-title { 
    color: var(--azul-maranata); 
    font-size: 1.6rem !important; /* Título más pequeño y discreto */
    margin-bottom: 15px !important;
    line-height: 1.2;
}

/* --- SUBIR LAS PLATAFORMAS (CONTENEDOR) --- */
.platforms-container {
    margin-top: -50px !important; /* Sube las tarjetas para que "muerdan" el hero */
    position: relative; 
    z-index: 100;
}

/* Ajuste para el botón de Panel Administrador */
.hero-section .btn {
    padding: 8px 25px !important;
    font-size: 0.9rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}
/* ==========================================
   5. ESTRUCTURA ADMIN (SIDEBAR Y MAIN)
   ========================================== */
/* --- ESTILOS PARA ESCRITORIO (PC) --- */
/* 1. Usar todo el ancho disponible con un margen elegante */
.navbar-maranata .container {
    max-width: 100% !important;
    padding-left: 30px;
    padding-right: 30px;
}

/* 2. Reducir el tamaño de fuente y padding de los links en escritorio */
@media (min-width: 992px) {
    .navbar-nav .nav-link {
        font-size: 0.85rem !important; /* Fuente un poco más pequeña */
        padding-left: 10px !important;
        padding-right: 10px !important;
        white-space: nowrap; /* Evita que el texto se parta en dos líneas */
    }

    /* Reducir espacio de los iconos */
    .navbar-nav .nav-link i {
        margin-right: 4px !important;
        font-size: 1rem;
    }

    /* Ajuste del botón de Administrador para que no sea tan gigante */
    .navbar-nav.ms-auto .btn-warning {
        font-size: 0.85rem !important;
        padding: 6px 15px !important;
    }
}

/* 3. Mejorar el aspecto de los Dropdowns */
.dropdown-menu {
    font-size: 0.85rem;
    border-radius: 12px;
    padding: 10px 0;
}

/* 4. Estilo de la línea activa (más fina) */
@media (min-width: 992px) {
    .navbar-nav .nav-link.active {
        border-bottom: 3px solid var(--amarillo-maranata) !important;
        padding-bottom: 5px;
    }
}

/* --- ESTILOS PARA MÓVIL (OFFCANVAS / SIDEBAR) --- */
@media (max-width: 991.98px) {
     /* Hacemos que el botón ocupe el ancho disponible pero con márgenes */
    .navbar-nav.ms-auto .btn-warning {
        margin: 15px !important;
        border-radius: 12px !important; /* Menos redondeado en móvil se ve mejor */
        justify-content: space-between; /* Separa el nombre de la flechita del dropdown */
        width: calc(100% - 30px) !important;
    }

    /* Ajustamos el ancho máximo del nombre en el menú lateral */
    .navbar-nav.ms-auto .btn-warning span {
        max-width: 180px !important; /* Un poco más de espacio en móvil */
        text-align: left;
    }
    .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    }
    .offcanvas { 
        background-color: var(--azul-maranata) !important; 
        color: white !important; 
        width: 280px !important; 
    }

    .offcanvas-header { 
        border-bottom: 1px solid rgba(255,255,255,0.1); 
    }

    /* Links del menú lateral */
    .navbar-nav .nav-link { 
        color: rgba(255,255,255,0.8) !important; 
        padding: 12px 20px !important;
        border-radius: 8px;
        margin: 4px 10px;
        border-bottom: none !important; /* Quitamos la línea de PC */
    }

    /* ESTADO ACTIVO EN MÓVIL: Fondo amarillo, texto azul */
    .navbar-nav .nav-link.active, 
    .dropdown-item.active { 
        background-color: var(--amarillo-maranata) !important; 
        color: var(--azul-maranata) !important; 
        font-weight: bold; 
    }

    /* Submenús (Dropdowns) en móvil */
    .dropdown-menu { 
        background-color: rgba(0,0,0,0.15) !important; 
        border: none; 
        margin: 0 15px !important;
        padding: 10px 0;
    }

    .dropdown-item { 
        color: rgba(255,255,255,0.7) !important; 
        padding: 10px 25px !important;
        border-radius: 5px;
        font-size: 0.9rem;
    }

    .dropdown-item:hover {
        background-color: rgba(255,255,255,0.1);
        color: var(--amarillo-maranata) !important;
    }

    /* Botón de usuario en móvil */
    .navbar-nav.ms-auto .btn-warning {
        margin: 20px 15px !important;
        display: block;
        width: calc(100% - 30px);
    }
}

/* Icono de hamburguesa en amarillo */
.navbar-toggler {
    border: none !important;
}
.navbar-toggler:focus {
    box-shadow: none !important;
}

/* --- LINKS DEL SIDEBAR --- */
.admin-nav .nav-link {
    color: rgba(255, 255, 255, 0.75) !important;
    padding: 12px 20px;
    margin: 5px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: 0.3s;
}

.admin-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--amarillo-maranata) !important;
}

.admin-nav .nav-link.active {
    background-color: var(--amarillo-maranata) !important;
    color: var(--azul-maranata) !important;
    font-weight: 600;
}

/* ==========================================
   6. FOOTER MARANATA
   ========================================== */
.bg-maranata {
    background-color: var(--azul-maranata) !important;
    border-top: 5px solid var(--amarillo-maranata);
}

.social-icon {
    width: 40px; height: 40px;
    background: rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; color: white; transition: 0.3s;
    text-decoration: none;
}

.social-icon:hover {
    background: var(--amarillo-maranata);
    color: var(--azul-maranata);
    transform: translateY(-3px);
}

.hover-yellow:hover { color: var(--amarillo-maranata) !important; }

/* ==========================================
   7. TABLAS Y CARDS
   ========================================== */
.card { border-radius: 15px; border: 1px solid #eee !important; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.table-responsive { border-radius: 10px; }

    /* Estilos para los puestos del Ranking */
    .rank-badge {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        color: white;
    }
    .rank-badge.gold { background: linear-gradient(45deg, #FFD700, #FFA500); box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3); }
    .rank-badge.silver { background: linear-gradient(45deg, #C0C0C0, #A9A9A9); }
    .rank-badge.bronze { background: linear-gradient(45deg, #CD7F32, #8B4513); }

    .text-maranata { color: var(--azul-maranata); }
    
    /* Resaltar al primer lugar */
    .table-hover tbody tr:first-child {
        background-color: rgba(249, 200, 14, 0.03);
    }

    @media (max-width: 768px) {
        .rank-badge { width: 30px; height: 30px; font-size: 0.8rem; }
    }
     .btn-outline-maranata-quiz {
        border: 2px solid #eee;
        border-radius: 15px;
        transition: 0.2s;
    }
    .btn-check:checked + .btn-outline-maranata-quiz {
        background-color: var(--azul-maranata);
        color: white;
        border-color: var(--azul-maranata);
    }

    .score-circle {
        width: 200px; height: 200px;
        border-radius: 50%; border: 10px solid;
        display: flex; flex-direction: column;
        justify-content: center; align-items: center;
        background-color: #f8f9fa;
    }
    .timer-wrapper {
        width: 100%;
        max-width: 500px;
        height: 45px;
        background-color: #e9ecef;
        border-radius: 50px;
        margin: 0 auto;
        position: relative;
        overflow: hidden;
        border: 4px solid #fff;
    }

    .timer-bar {
        width: 100%; /* Empieza llena */
        height: 100%;
        background-color: #28a745;
        position: absolute;
        left: 0;
        top: 0;
        transition: width 0.1s linear, background-color 0.3s ease;
    }

    .timer-text {
        position: relative;
        z-index: 2;
        line-height: 37px;
        font-weight: 800;
        color: #1D2B53;
        font-size: 1.3rem;
    }

    .bg-timer-warning { background-color: #ffc107 !important; }
    .bg-timer-danger { background-color: #dc3545 !important; }

    .btn-outline-maranata-quiz {
        border: 2px solid #e9ecef;
        border-radius: 16px;
        background-color: #ffffff;
        transition: all 0.2s;
        box-shadow: 0 4px 0 #e9ecef;
    }

    .btn-check:checked + .btn-outline-maranata-quiz {
        background-color: var(--azul-maranata) !important;
        color: #ffffff !important;
        border-color: var(--azul-maranata) !important;
        box-shadow: 0 4px 0 #121b35;
        transform: translateY(2px);
    }

    .options-disabled { pointer-events: none; opacity: 0.6; }

    /* Estilo para los submenús */
.admin-nav .collapse .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.6);
}

.admin-nav .collapse .nav-link:hover {
    color: #ffcc00;
}

.admin-nav .collapse .nav-link.active {
    color: #ffcc00 !important;
    background: transparent !important;
    font-weight: bold;
}

/* Animación de la flecha */
.arrow-icon {
    transition: transform 0.3s ease;
}

.nav-link.collapsed .arrow-icon {
    transform: rotate(-90deg);
}

/* Ajuste de hover para los padres colapsables */
.admin-nav .nav-link[data-bs-toggle="collapse"] {
    cursor: pointer;
}


.dropdown-menu {
    z-index: 1010; /* Asegura que esté por encima de otros elementos */
}

.table-responsive {
    border-radius: 10px;
}
.table-hover tbody tr:first-child {
        background-color: rgba(249, 200, 14, 0.03);
    }

@media (max-width: 768px) {
    /* Ocultar cabecera de tabla en móvil */
    .table-responsive-stack thead {
        display: none;
    }
    .table-responsive-stack tr {
        display: block;
        border: 1px solid #e0e0e0;
        margin-bottom: 1rem;
        background: #fff;
        border-radius: 10px;
        padding: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid #eee;
        padding: 8px 5px;
    }
    .table-responsive-stack td:last-child {
        border-bottom: none;
        justify-content: center;
        padding-top: 15px;
    }
    /* Insertar el nombre de la columna antes del dato */
    .table-responsive-stack td:before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: #666;
    }
}

.modal-backdrop {
    z-index: 1040 !important;
}
.modal {
    z-index: 1050 !important;
}
/* Color por defecto (Escritorio - Fondo Blanco) */
.dropdown-header {
    color: #6c757d; /* Un gris elegante */
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding-top: 10px;
}

/* Color para Móvil (Offcanvas - Fondo Azul) */
@media (max-width: 991.98px) {
    .offcanvas .dropdown-header {
        color: var(--amarillo-maranata) !important; /* Amarillo en fondo azul */
        opacity: 0.8;
        padding-left: 20px !important;
        margin-top: 10px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 5px;
    }
}
