/* --- Variables Globales --- */
:root {
    --primary-color: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --dark-glass: rgba(15, 23, 42, 0.9); /* Un poco más opaco para legibilidad */
}

/* --- Animaciones --- */
@keyframes spin-slow {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

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

/* --- Navbar Moderna --- */
header {
    position: sticky;
    top: 0;
    z-index: 1030;
    animation: fadeInDown 0.8s ease-out;
}

.navbar {
    background: var(--dark-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0; 
    transition: all 0.3s ease;
}

/* --- Logos --- */
.navbar-brand {
    display: flex;
    align-items: center; /* Centra verticalmente logo y texto */
    padding: 0;
    margin-right: 1rem;
}

#rotating-logo {
    /* Logo un poco más grande */
    height: 60px; 
    width: auto;
    animation: spin-slow 10s linear infinite;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
}

.scaled-image {
    /* CAMBIO 2: Controlamos el ANCHO, no el alto. */
    width: 150px; /* Tamaño generoso para el texto */
    height: auto; /* La altura se ajusta sola proporcionalmente */
    margin-left: 15px;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

/* --- Enlaces del Menú --- */
.nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9) !important; /* Más brillante por defecto */
    position: relative;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: #fff !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: var(--primary-gradient);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* --- FIX: DROPDOWN MENU (Estilo Glass y Lógica) --- */

.dropdown-menu-glass {
    background: rgba(15, 23, 42, 0.98); /* Fondo casi sólido para legibilidad */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-width: 240px;
    margin-top: 10px; /* Espacio justo */
    z-index: 1050; /* Asegura que flote sobre todo */
    display: none; /* Oculto por defecto */
}

.dropdown-menu-glass::after {
    content: '';
    position: absolute;
    top: -20px; /* Sube para cubrir el hueco del margin */
    left: 0;
    width: 100%;
    height: 20px; /* Altura suficiente para conectar con el botón */
    background: transparent;
}

/* Flechita decorativa arriba del menú */
.dropdown-menu-glass::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.8) !important;
    font-family: 'Poppins', sans-serif;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.2s;
    background: transparent;
}

.dropdown-item:hover {
    background: rgba(79, 70, 229, 0.2);
    color: #fff !important;
    transform: translateX(5px);
}

.dropdown-item i {
    font-size: 1.1rem;
    vertical-align: middle;
}

/* --- MAGIA: Abrir menú al pasar el mouse (Desktop) --- */
/* Esto soluciona que no funcione el click a veces en PC */
@media (min-width: 992px) {
    .nav-item.dropdown:hover .dropdown-menu {
        display: block; /* Fuerza la visualización */
        animation: fadeInUpMenu 0.3s ease-out; /* Animación de entrada */
    }
}

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

/* --- Botones del Header (Login/Logout) --- */
.navbar .btn {
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* --- SOLUCIÓN AL BOTÓN INVISIBLE --- */
.btn-login-custom {
    /* Fondo base ligeramente visible siempre */
    background: rgba(255, 255, 255, 0.15); 
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff !important; 
    display: inline-flex;
    align-items: center;
}

.btn-login-custom:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    color: #fff !important;
}

/* --- Icono hamburguesa --- */
.navbar-toggler {
    border: 1px solid rgba(255,255,255,0.3);
    outline: none;
}

.navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

/* Responsivo */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(15, 23, 42, 0.98);
        padding: 1rem;
        border-radius: 10px;
        margin-top: 15px;
        border: 1px solid rgba(255,255,255,0.1);
    }
    
    .scaled-image {
        /* En móviles reducimos un poco el texto para que quepa */
        width: 110px; 
    }
    
    #rotating-logo {
        height: 50px;
    }
    
    /* En móvil, el dropdown se comporta normal (click) */
    .dropdown-menu-glass {
        background: rgba(255,255,255,0.05);
        border: none;
        margin-top: 0;
        box-shadow: none;
        padding-left: 20px; /* Indentación en móvil */
    }
    .dropdown-menu-glass::before { display: none; } /* Ocultar flechita en móvil */
}

/* --- ESTILOS DEL MODAL (Se mantienen igual de bien) --- */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 2rem;
    background: #fff;
}

.form-control {
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    transition: all 0.3s;
}

.form-control:focus {
    background-color: #fff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.modal-body .btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    border: none;
    padding: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 10px;
    transition: transform 0.2s;
}

.modal-body .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}