/* Module Auth Modal Styles - Babatsa / Melilora */
.module-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 12, 22, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
    animation: modAuthFadeIn 0.25s ease-out;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes modAuthFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.module-auth-card {
    background: linear-gradient(145deg, #131b2e, #0d1322);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 32px 28px;
    color: #e2e8f0;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    animation: modAuthSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modAuthSlideUp {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.module-auth-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px auto;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.module-auth-title {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.module-auth-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 22px;
    line-height: 1.4;
}

.module-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.module-auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.module-auth-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.module-auth-select,
.module-auth-input {
    width: 100%;
    background: #090e1a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}

.module-auth-select:focus,
.module-auth-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: #0c1222;
}

.module-auth-select option {
    background: #111827;
    color: #f3f4f6;
    padding: 10px;
}

.module-auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    display: none;
    align-items: center;
    gap: 8px;
}

.module-auth-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.98rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 6px;
}

.module-auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.module-auth-btn:active {
    transform: translateY(0);
}

.module-auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* User Badge in Nav */
.module-auth-user-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: rgba(99, 102, 241, 0.18) !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    color: #c7d2fe !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.module-auth-user-badge:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
}

@media (max-width: 768px) {
    .module-auth-user-badge {
        padding: 5px 9px !important;
        font-size: 0.76rem !important;
        max-width: 170px !important;
    }
    .module-auth-user-badge span {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* ── Estilos de Seguridad y Acceso Denegado (Babatsa) ── */
.module-auth-denied-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 12, 22, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: modAuthFadeIn 0.25s ease-out;
}

.module-auth-denied-card {
    background: linear-gradient(145deg, #161b26, #0e121a);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(239, 68, 68, 0.15);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    padding: 36px 30px;
    color: #f1f5f9;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    animation: modAuthSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.module-auth-denied-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px auto;
    background: rgba(239, 68, 68, 0.12);
    border: 2px solid rgba(239, 68, 68, 0.4);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #ef4444;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}

.module-auth-denied-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.module-auth-denied-user {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.module-auth-denied-user strong {
    color: #f8fafc;
}

.module-auth-denied-msg {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 24px;
}

.module-auth-denied-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-denied-panel {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    padding: 12px 22px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    cursor: pointer;
}

.btn-denied-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-denied-switch {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    cursor: pointer;
}

.btn-denied-switch:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.module-auth-sec-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 14px;
    text-align: left;
}

/* Ocultar de inmediato cualquier overlay o intro legado para que nunca bloquee la pantalla */
body:not(.require-module-login) #module-auth-overlay,
body:not(.require-module-login) .module-auth-overlay,
body:not(.require-module-login) #sec-modal,
body:not(.require-module-login) #dashboard-intro-overlay,
body:not(.require-module-login) #util-intro-stage,
body:not(.require-module-login) #module-auth-card {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
