/* ========== RESET & BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.5;
}

/* ========== NAVBAR ========== */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e40af;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ========== LANGUAGE SELECTOR ========== */
.language-selector select {
    padding: 5px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

/* ========== USER MENU (ESTILO PÍLDORA) ========== */
.user-menu {
    position: relative;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    padding: 8px 16px;
    border-radius: 50px;
    color: #1e40af;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-user:hover {
    background: #dbeafe;
}

.nav-user .arrow {
    font-size: 0.7rem;
    opacity: 0.7;
}



.dropdown-divider {
    border: 0;
    border-top: 1px solid #f1f5f9;
    margin: 0;
}

.logout-link {
    color: #ef4444 !important;
}

/* ========== CONTAINER & DASHBOARD ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 140px);
}

/* Modo Dashboard (Pantalla Completa) */
.user-authenticated .navbar { height: 60px; }
.user-authenticated .container {
    max-width: 100%;
    padding: 0;
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    top: 1rem; right: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.modal-btn {
    width: 100%;
    padding: 12px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* ========== FOOTER ========== */
.footer {
    background: white;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .nav-container { padding: 0 1rem; }
    .user-name { display: none; } /* En móvil ocultamos el nombre, dejamos el icono/píldora */
    .nav-user { padding: 8px; }
}

/* Mejoras del menú de usuario */
.user-menu {
    position: relative;
}

.nav-user {
    background: #eff6ff;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-user:hover {
    background: #dbeafe;
}

.user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    display: none;
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
    top: 100%; /* Ajusta esto para que toque el borde del nav-user */
    margin-top: 5px;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
    transition: background 0.2s;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: #f1f5f9;
}

.logout-option {
    color: #ef4444 !important;
}

.logout-option:hover {
    background: #fef2f2 !important;
}
.user-dropdown.show {
    display: block !important;
}
/* ========== LOGIN Y FORMULARIOS ========== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
    color: #1e40af;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

.login-links {
    margin-top: 1rem;
    text-align: center;
    display: flex;
    justify-content: space-between;
}

.login-links a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.875rem;
}

.login-links a:hover {
    text-decoration: underline;
}

/* Alertas */
.alert {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Botón logout en menú */
.user-dropdown .logout-option {
    color: #ef4444 !important;
}

.user-dropdown .logout-option:hover {
    background: #fef2f2 !important;
}