/* =============================================================
   style_login.css  –  Estilos compartidos: Login & Recuperar Contraseña
   Nubeico / Portal de Asociados
   ============================================================= */

/* ── Google Fonts import ────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables de tema ──────────────────────────────────────── */
:root {
    /* Paleta corporativa */
    --color-primary:        #0f3a5e;
    --color-primary-light:  #1a5c94;
    --color-primary-dark:   #092135;
    --color-accent:         #0d8abc;
    --color-accent-light:   #e0f2fe;

    /* Fondo y tarjeta — idénticos en ambas páginas */
    --bg-body:  #f4f7fe;
    --card-bg:  rgba(255, 255, 255, 0.96);

    /* Texto */
    --text-main:      #1e2a45;
    --text-primary:   #1e2a45;
    --text-muted:     #a3aed0;
    --text-secondary: #65719b;

    /* Estados */
    --status-success: #05cd99;
    --success-color:  #05cd99;
    --error-color:    #ee5d50;

    /* Inputs / bordes */
    --border-color:   #dce3f3;
    --input-bg:       #f8faff;
    --input-bg-focus: #ffffff;
    --input-focus:    var(--color-primary);

    /* Brand dinámico (fallback corporativo cuando no hay aliado) */
    --brand-color1: var(--color-primary);
    --brand-color2: var(--color-accent);
    --brand-color3: var(--color-primary-light);

    /* Sombras */
    --shadow-card:  0 24px 48px -12px rgba(9, 33, 53, 0.22), 0 0 0 1px rgba(255,255,255,0.12);
    --shadow-input: 0 1px 2px 0 rgba(15, 58, 94, 0.06);
    --shadow-btn:   0 4px 14px 0 rgba(15, 58, 94, 0.25);

    /* Transición global */
    --transition:    all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset básico ───────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ── Body / fondo ───────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(
        140deg,
        var(--color-primary-dark)  0%,
        #0d3658                    35%,
        var(--color-primary)       65%,
        var(--color-primary-light) 100%
    );
    min-height: 100vh;
    margin:  0;
    padding: 0;
    position: relative;
    overflow-x: hidden;
    display:         flex;
    align-items:     center;
    justify-content: center;
}

/* Textura decorativa de fondo */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 70% 0%,  rgba(13,138,188,0.18) 0%, transparent 60%),
        radial-gradient(ellipse 60% 70% at 10% 100%, rgba(255,255,255,0.05) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 40px,
            rgba(255,255,255,0.012) 40px,
            rgba(255,255,255,0.012) 80px
        );
    z-index: 0;
    pointer-events: none;
}

/* ── Contenedor principal ───────────────────────────────────── */
.login-container,
.recovery-container {
    width: 100%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:  20px 15px;
    position: relative;
    z-index:  1;
    min-height: 100vh;
}

/* ── Tarjeta central ────────────────────────────────────────── */
.login-card,
.recovery-card {
    background:    var(--card-bg);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-radius: 24px;
    box-shadow:    var(--shadow-card);
    border:        1px solid rgba(255, 255, 255, 0.55);
    max-width: 460px;
    width: 100%;
    padding: 44px 40px 40px;
    position: relative;
    overflow: hidden;
    animation: cardSlideIn 0.55s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

/* Barra superior de color corporativo */
.login-card::before,
.recovery-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-color1), var(--brand-color2), var(--brand-color3));
    border-radius: 24px 24px 0 0;
}

/* Brillo sutil en esquina superior derecha */
.login-card::after,
.recovery-card::after {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(13,138,188,0.07) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ── Logo ───────────────────────────────────────────────────── */
.logo-container {
    text-align:    center;
    margin-bottom: 28px;
}

.company-logo {
    max-height: 52px;
    max-width:  220px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
    transition: var(--transition);
}

.company-logo:hover {
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
    transform: translateY(-1px);
}

/* ── Divisor decorativo con ícono ───────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color));
}

.auth-divider::after {
    background: linear-gradient(to left, transparent, var(--border-color));
}

.auth-divider-icon {
    width:  36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 10px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    color:      white;
    font-size:  14px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(15, 58, 94, 0.3);
}

/* ── Títulos ────────────────────────────────────────────────── */
.login-title,
.recovery-title {
    text-align:    center;
    margin-bottom: 6px;
    color:         var(--text-primary);
    font-size:     26px;
    font-weight:   800;
    letter-spacing: -0.03em;
    line-height:   1.2;
}

.login-subtitle,
.recovery-subtitle {
    text-align:    center;
    color:         var(--text-secondary);
    font-size:     14px;
    margin-bottom: 32px;
    font-weight:   400;
    line-height:   1.5;
}

/* ── Separador de sección ───────────────────────────────────── */
.form-section-title {
    font-size:    11px;
    font-weight:  700;
    color:        var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

/* ── Grupos de formulario ───────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display:       block;
    margin-bottom: 7px;
    color:         var(--text-primary);
    font-weight:   600;
    font-size:     13px;
    letter-spacing: 0.015em;
}

/* ── Inputs ─────────────────────────────────────────────────── */
.form-control {
    width:      100%;
    padding:    13px 16px;
    border:     1.5px solid var(--border-color);
    border-radius: 12px;
    font-size:  14.5px;
    font-family: inherit;
    font-weight: 400;
    transition: var(--transition);
    background: var(--input-bg);
    color:      var(--text-main);
    box-shadow: var(--shadow-input);
    outline:    none;
    appearance: none;
}

.form-control:hover:not(:focus) {
    border-color: #b0bedd;
    background:   #f4f7ff;
}

.form-control:focus {
    border-color: var(--color-primary);
    background:   var(--input-bg-focus);
    box-shadow:   0 0 0 4px rgba(15, 58, 94, 0.1), var(--shadow-input);
    color:        var(--text-main);
}

.form-control::placeholder {
    color:   var(--text-muted);
    font-weight: 400;
    opacity: 0.85;
}

.form-control.is-invalid {
    border-color: var(--error-color);
    background:   #fff8f8;
    box-shadow:   0 0 0 4px rgba(238, 93, 80, 0.1);
}

.form-control.is-valid {
    border-color: var(--status-success);
    background:   #f8fffc;
    box-shadow:   0 0 0 4px rgba(5, 205, 153, 0.1);
}

/* ── Campo de contraseña ────────────────────────────────────── */
.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 48px;
}

.toggle-password {
    position:    absolute;
    right:       14px;
    top:         50%;
    transform:   translateY(-50%);
    background:  none;
    border:      none;
    color:       var(--text-muted);
    cursor:      pointer;
    font-size:   15px;
    padding:     4px 6px;
    border-radius: 6px;
    transition:  var(--transition);
    z-index:     10;
    line-height: 1;
}

.toggle-password:hover {
    color:      var(--color-primary);
    background: rgba(15, 58, 94, 0.08);
}

.toggle-password:focus {
    outline: none;
}

/* ── Botón primario ─────────────────────────────────────────── */
.btn-primary {
    width:         100%;
    padding:       14px 20px;
    background:    linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    border:        none;
    border-radius: 12px;
    color:         white;
    font-size:     15px;
    font-weight:   700;
    font-family:   inherit;
    letter-spacing: 0.02em;
    transition:    var(--transition-slow);
    position:      relative;
    overflow:      hidden;
    margin-bottom: 12px;
    cursor:        pointer;
    display:       block;
    text-align:    center;
    text-decoration: none;
    box-shadow:    var(--shadow-btn);
}

/* Brillo deslizante al hacer hover */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width:  60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
    transform: skewX(-15deg);
}

.btn-primary:hover {
    transform:       translateY(-2px);
    box-shadow:      0 8px 28px rgba(15, 58, 94, 0.38);
    background:      linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-accent) 100%);
    color:           white;
    text-decoration: none;
}

.btn-primary:hover::before {
    left: 140%;
}

.btn-primary:active {
    transform:  translateY(0);
    box-shadow: var(--shadow-btn);
}

/* ── Botón secundario ───────────────────────────────────────── */
.btn-secondary {
    width:         100%;
    padding:       12px 20px;
    background:    rgba(240, 245, 255, 0.7);
    border:        1.5px solid var(--border-color);
    border-radius: 12px;
    color:         var(--text-secondary);
    font-size:     14px;
    font-weight:   600;
    font-family:   inherit;
    letter-spacing: 0.01em;
    transition:    var(--transition);
    text-decoration: none;
    display:       block;
    text-align:    center;
    cursor:        pointer;
}

.btn-secondary:hover {
    background:      rgba(15, 58, 94, 0.06);
    border-color:    var(--color-primary);
    color:           var(--color-primary);
    text-decoration: none;
    transform:       translateY(-1px);
}

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

/* ── Mensajes de éxito / error ──────────────────────────────── */
.error-message,
.message.error {
    background:      #fff2f1;
    color:           #c0392b;
    border:          1.5px solid #fdd;
    border-left:     4px solid var(--error-color);
    border-radius:   12px;
    padding:         13px 16px;
    margin-bottom:   20px;
    font-size:       13.5px;
    font-weight:     500;
    display:         flex;
    align-items:     flex-start;
    gap:             10px;
    line-height:     1.45;
    animation:       msgSlideIn 0.3s ease;
    transition:      opacity 0.3s ease;
}

.success-message,
.message.success {
    background:      #f0fdf8;
    color:           #0b7a5e;
    border:          1.5px solid #bbf7d0;
    border-left:     4px solid var(--status-success);
    border-radius:   12px;
    padding:         13px 16px;
    margin-bottom:   20px;
    font-size:       13.5px;
    font-weight:     500;
    display:         flex;
    align-items:     flex-start;
    gap:             10px;
    line-height:     1.45;
    animation:       msgSlideIn 0.3s ease;
    transition:      opacity 0.3s ease;
}

.error-message i,
.success-message i,
.message.error i,
.message.success i {
    flex-shrink:  0;
    font-size:    15px;
    margin-top:   1px;
}

/* ── Info de recuperación ───────────────────────────────────── */
.recovery-info {
    background:      linear-gradient(135deg, #eff6ff, #dbeafe);
    border:          1.5px solid #bfdbfe;
    border-left:     4px solid var(--color-accent);
    border-radius:   12px;
    padding:         16px;
    margin-bottom:   24px;
}

.recovery-info h6 {
    color:         var(--color-accent);
    margin-bottom: 6px;
    font-weight:   700;
    font-size:     13px;
    letter-spacing: 0.01em;
}

.recovery-info p {
    color:       var(--text-secondary);
    margin: 0;
    font-size:   12.5px;
    line-height: 1.5;
}

/* ── Info de contacto ───────────────────────────────────────── */
.contact-info {
    text-align:  center;
    margin-top:  24px;
    padding-top: 20px;
    border-top:  1px solid rgba(220, 227, 243, 0.7);
}

.contact-info small {
    color:       var(--text-secondary);
    font-size:   12.5px;
    line-height: 1.5;
}

/* ── Enlace de retorno ──────────────────────────────────────── */
.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    color:           var(--text-secondary);
    text-decoration: none;
    font-size:       13px;
    font-weight:     500;
    transition:      color 0.25s ease;
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
}

.back-link a:hover {
    color: var(--color-primary);
}

/* ── Feedback de validación ─────────────────────────────────── */
.invalid-feedback {
    display:     block;
    color:       var(--error-color);
    font-size:   12px;
    margin-top:  5px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── Loading spinner (inline en botón) ──────────────────────── */
.loading-spinner {
    display:       inline-block;
    width:  16px;
    height: 16px;
    border:           2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius:    50%;
    animation:        spin 0.75s linear infinite;
    margin-right:     8px;
    vertical-align:   middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-loading {
    position:       relative;
    pointer-events: none;
    opacity:        0.8;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading .loading-spinner {
    position:  absolute;
    left: 50%;
    top:  50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.form-loading {
    pointer-events: none;
    opacity: 0.65;
}

.form-loading .form-control {
    background-color: #f0f3fb;
    color:            var(--text-muted);
}

/* ── Overlay de carga ───────────────────────────────────────── */
.login-overlay {
    display:          none;
    position:         fixed;
    inset:            0;
    background-color: rgba(5, 15, 30, 0.72);
    z-index:          9999;
    justify-content:  center;
    align-items:      center;
    flex-direction:   column;
    backdrop-filter:  blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.login-overlay.active {
    display: flex;
    animation: overlayIn 0.25s ease;
}

.login-overlay .spinner-container {
    background:    white;
    padding:       36px 48px;
    border-radius: 20px;
    box-shadow:    0 24px 60px rgba(0,0,0,0.35);
    text-align:    center;
    animation:     cardSlideIn 0.35s ease;
}

.login-overlay .spinner-large {
    width:          52px;
    height:         52px;
    border:         4px solid #e8eef8;
    border-top:     4px solid var(--color-primary);
    border-radius:  50%;
    animation:      spin 0.9s linear infinite;
    margin:         0 auto 18px;
}

.login-overlay .spinner-text {
    color:       var(--text-primary);
    font-size:   15px;
    font-weight: 600;
    margin-top:  4px;
    letter-spacing: -0.01em;
}

/* ── Animaciones ────────────────────────────────────────────── */
@keyframes cardSlideIn {
    from {
        opacity:   0;
        transform: translateY(28px) scale(0.97);
    }
    to {
        opacity:   1;
        transform: translateY(0) scale(1);
    }
}

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

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

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 520px) {
    .login-card,
    .recovery-card {
        padding:   32px 24px 28px;
        max-width: 100%;
        border-radius: 20px;
    }

    .login-title,
    .recovery-title {
        font-size: 22px;
    }

    .company-logo {
        max-height: 44px;
    }
}

@media (max-width: 380px) {
    .login-card,
    .recovery-card {
        padding: 28px 18px 24px;
    }
}

@media (max-height: 680px) {
    .login-card,
    .recovery-card {
        padding:       24px 32px;
        border-radius: 18px;
    }

    .logo-container {
        margin-bottom: 20px;
    }

    .login-title,
    .recovery-title {
        font-size:     22px;
        margin-bottom: 4px;
    }

    .login-subtitle,
    .recovery-subtitle {
        margin-bottom: 20px;
        font-size:     13px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .form-control {
        padding: 11px 14px;
    }
}