/* ------------------------------------------- */
/* --- ESTILOS PARA LA BARRA DE NAVEGACIÓN --- */
/* ------------------------------------------- */

body {
    /* Deja un espacio superior para que el contenido no quede oculto por la navbar fija */
    overflow-x: hidden;
    /* FIX: Elimina scroll lateral indeseado */
}

.main-container {
    padding-top: 100px;
    /* 60px de la navbar + 40px de espacio extra */
}

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--card-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    display: flex;
    justify-content: center;
    /* Centra el contenido interno */
    align-items: center;
    padding: 0;
    /* Padding movido a .navbar-inner */
    z-index: 1000;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

/* --- CONTENEDOR INTERNO PARA ALINEACIÓN (1200px) --- */
.navbar-inner {
    width: 100%;
    max-width: 1200px;
    /* Coincide con .test-container.curso-page */
    margin: 0 auto;
    padding: 0 2rem;
    /* Coincide con el padding de .test-container */
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    /* Para posicionamiento absoluto del logo */
}

/* --- ESTILO DEL LOGO --- */
.navbar-logo {
    height: 42px;
    /* Aumentado a 42px por el usuario */
    width: auto;
    /* Posicionamiento absoluto para no afectar el flujo flex */
    position: absolute;
    left: 2rem;
    /* Coincide con el padding de .navbar-inner */
    top: 50%;
    transform: translateY(-50%);
    display: block;
    /* AÑADIDO: Sombra igual que en el dashboard */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}

/* --- ESTRUCTURA DE 3 COLUMNAS --- */
.navbar-left,
.navbar-center,
.navbar-right {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-left {
    flex: 1;
    /* Igual que navbar-right para mantener el centro centrado */
}

.navbar-center {
    flex: 2;
    justify-content: center;
}

.navbar-right {
    flex: 1;
    justify-content: flex-end;
    gap: 0.8rem;
    /* REDUCIDO de 1.5rem */
}

/* --- ESTILO DE LOS ENLACES --- */
.nav-item {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0 0.8rem;
    /* REDUCIDO de 1.5rem */
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: color var(--transition-fast), border-bottom-color var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text-color);
    border-bottom-color: var(--border-color);
}

.nav-item.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* --- ESTILOS UNIFICADOS PARA BOTONES DE HERRAMIENTAS --- */
.nav-tool-btn {
    font-family: 'Material Icons';
    font-size: 24px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-tool-btn:hover {
    color: var(--accent-color);
}

/* --- LÓGICA VISUAL DEL BOTÓN DE CAMBIO DE TEMA --- */
#theme-toggle-btn .icon-moon,
#theme-toggle-btn .icon-sun,
#theme-toggle-btn .icon-sepia {
    display: none;
}

html:not(.light-theme):not(.sepia-theme) #theme-toggle-btn .icon-moon {
    display: block;
}

html.light-theme #theme-toggle-btn .icon-sun {
    display: block;
}

html.sepia-theme #theme-toggle-btn .icon-sepia {
    display: block;
}

/* --- LÓGICA VISUAL DEL BOTÓN DE CAMBIO DE TEMA (MÓVIL) --- */
#theme-toggle-btn-mobile .icon-moon,
#theme-toggle-btn-mobile .icon-sun,
#theme-toggle-btn-mobile .icon-sepia {
    display: none;
}

html:not(.light-theme):not(.sepia-theme) #theme-toggle-btn-mobile .icon-moon {
    display: block;
}

html.light-theme #theme-toggle-btn-mobile .icon-sun {
    display: block;
}

html.sepia-theme #theme-toggle-btn-mobile .icon-sepia {
    display: block;
}

/* --- ESTILOS PARA LA BARRA DE NAVEGACIÓN MÓVIL (HAMBURGUESA) --- */

body.no-scroll {
    overflow: hidden;
}

.navbar-mobile-right {
    display: none;
}

.hamburger-menu-btn {
    display: none;
}

/* Overlay para oscurecer el fondo */
#mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Oscurecimiento suave */
    backdrop-filter: blur(2px);
    /* Efecto cristal */
    z-index: 999;
    /* Debajo de la navbar (1000) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

body.nav-open #mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
}

/* Estilos para el menú móvil que se desliza */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80%;
    height: 100vh;
    background-color: var(--card-color);
    box-shadow: 2px 0 10px var(--shadow-color);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    /* Animación Premium */
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.mobile-menu.is-active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.close-menu-btn {
    font-family: 'Material Icons';
    font-size: 28px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    transition: color var(--transition-fast);
}

.close-menu-btn:hover {
    color: var(--accent-color);
}

.mobile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    flex-grow: 1;
}

.mobile-nav-item {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.8rem 0;
    display: block;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.mobile-nav-item:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Media query para pantallas pequeñas (móviles) */
@media (max-width: 768px) {
    .top-navbar {
        padding: 0;
        /* Padding controlado por .navbar-inner */
    }

    .navbar-inner {
        padding: 0 1rem;
        /* Padding reducido en móvil */
    }

    /* AJUSTE LOGO MÓVIL: Oculto */
    .navbar-logo {
        display: none;
    }

    .navbar-left {
        flex-grow: 1;
        display: flex;
    }

    .navbar-mobile-right {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .desktop-nav-items {
        display: none;
    }

    .hamburger-menu-btn {
        display: inline-flex;
    }

    /* --- AJUSTES PARA EL CONTENEDOR DE NOTIFICACIONES EN MÓVIL --- */
    #notificaciones-container-mobile {
        width: 95vw;
        top: 65px;
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }

    #notificaciones-container-mobile.visible {
        transform: translateX(-50%) translateY(0);
    }
}

/* Estilo para el botón Ranking y Estadísticas en escritorio */
@media (min-width: 769px) {
    .ranking-icon-nav .nav-item-text {
        display: none;
    }

    .ranking-icon-nav .material-icons {
        margin-right: 0;
    }

    .ranking-icon-nav {
        padding-left: 10px;
        padding-right: 10px;
    }

    .stats-icon-nav {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

}

@keyframes pulse-glow-notification {
    from {
        text-shadow: 0 0 4px var(--flag-color);
    }

    to {
        text-shadow: 0 0 12px var(--flag-color), 0 0 20px color-mix(in srgb, var(--flag-color) 50%, transparent);
    }
}

.notificaciones-container {
    position: absolute;
    top: 60px;
    right: 1rem;
    width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px var(--shadow-color);
    z-index: 1010;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.notificaciones-container.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}


.notificacion-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.notificacion-item:last-child {
    border-bottom: none;
}

.notificacion-item:hover {
    background-color: var(--hover-color);
}

.notificacion-titulo {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.notificacion-contenido {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.notificacion-fecha {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    text-align: right;
}

/* --- ESTILOS PARA EL BOTÓN DE VER HISTORIAL --- */
.notificacion-historial-btn-container {
    padding: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.notificacion-historial-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--accent-color);
    color: #fff;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: background-color var(--transition-fast);
}

.notificacion-historial-btn:hover {
    background-color: var(--accent-color-darker);
}

/* --- ESTILOS PARA LA CAMPANITA ACTIVA (NUEVO) --- */
.notificacion-campana.notificacion-activa {
    color: #ff9800 !important;
    /* Naranja */
    animation: bell-shake 2s infinite;
    display: inline-block;
    /* Necesario para que funcione transform */
}

@keyframes bell-shake {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(15deg);
    }

    20% {
        transform: rotate(-15deg);
    }

    30% {
        transform: rotate(10deg);
    }

    40% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(0);
    }
}

/* --- ESTILOS PARA EL PUNTITO DE NOTIFICACIÓN EN CONTACTO (NUEVO) --- */
.nav-item.has-contact-notification,
.mobile-nav-item.has-contact-notification {
    position: relative;
}

.nav-item.has-contact-notification::after {
    content: '';
    position: absolute;
    top: 12px;
    /* Ajustar según la altura del icono */
    right: 8px;
    /* Ajustar según la anchura del icono */
    width: 8px;
    height: 8px;
    background-color: #ff9800;
    /* Naranja */
    border-radius: 50%;
    border: 2px solid var(--card-color);
    /* Borde para separar del icono */
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.6);
}

/* Ajuste específico para móvil */
.mobile-nav-item.has-contact-notification::after {
    top: 15px;
    right: auto;
    left: 35px;
    /* Posicionar cerca del icono */
    width: 8px;
    height: 8px;
    background-color: #ff9800;
    border-radius: 50%;
    border: 2px solid var(--card-color);
    content: '';
    position: absolute;
}