:root {
    --color-blue-900: #001c51;
    --color-blue-950: #030d22;
    --color-blue-925: #07122a;
    --color-accent-yellow: #ffd000;
    --color-accent-gold-500: #cbb059;
    --color-accent-gold-400: #dfb841;
    --color-white: #ffffff;
    --color-off-white: #e2e8f0;
    --color-muted: #5e6e88;
    --color-ink: #0b1220;
    --color-ink-soft: #102033;
    --bg: var(--color-blue-900);
    --bg-alt: var(--color-blue-950);
    --surface: rgba(7, 18, 42, 0.92);
    --surface-soft: rgba(11, 24, 53, 0.9);
    --surface-glass: rgba(255, 255, 255, 0.08);
    --surface-glass-strong: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.14);
    --line-strong: rgba(255, 255, 255, 0.24);
    --text: var(--color-off-white);
    --text-strong: var(--color-white);
    --text-muted: var(--color-muted);
    --on-accent: var(--color-ink);
    --gradient-bg-main: linear-gradient(145deg, #001c51 0%, #07122a 52%, #030d22 100%);
    --gradient-hero: linear-gradient(160deg, rgba(0, 28, 81, 0.92) 0%, rgba(3, 13, 34, 0.76) 58%, rgba(3, 13, 34, 0.95) 100%);
    --gradient-cta: linear-gradient(135deg, #ffd000 0%, #ffbf00 100%);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --font-sans: "Segoe UI", "Trebuchet MS", "Helvetica Neue", Arial, sans-serif;
    --text-xs: 12px;
    --text-sm: 14px;
    --text-md: 16px;
    --text-lg: 18px;
    --text-xl: 34px;
    --brand-logo-size: 250px;
    --brand-logo-size-mobile: 88px;
    --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.38);
    --hover-overlay-light: rgba(255, 255, 255, 0.08);
    --focus-ring: 0 0 0 3px rgba(255, 208, 0, 0.35);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #60a5fa;
    --on-success: #05130a;
    --on-danger: #fff1f2;
}

* {
    box-sizing: border-box;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.auth-shell {
    width: 100%;
    max-width: 1180px;
    display: grid;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(3, 13, 34, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-title {
    font-size: var(--text-xl);
    line-height: 1.05;
    color: var(--text-strong);
    letter-spacing: -0.04em;
    font-weight: 700;
}

.auth-subtitle {
    color: rgba(226, 232, 240, 0.8);
    line-height: 1.65;
    font-size: var(--text-md);
}

.form-control {
    width: 100%;
    min-height: 54px;
    padding: 0 16px;
    background: rgba(11, 24, 53, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--text-strong);
    font-size: var(--text-md);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control::placeholder {
    color: rgba(94, 110, 136, 0.94);
}

.form-control:focus {
    border-color: rgba(255, 208, 0, 0.65);
    box-shadow: var(--focus-ring);
    background: rgba(11, 24, 53, 1);
}

.form-control.error {
    border-color: var(--danger);
}

.form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}

.form-control.success {
    border-color: var(--success);
}

.input-shell,
.password-container {
    position: relative;
}

.password-container .form-control {
    padding-right: 56px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--color-accent-gold-400);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.toggle-password:hover {
    color: var(--color-accent-yellow);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.btn-auth,
.btn-login,
.btn-register,
.btn-reset {
    width: 100%;
    min-height: 54px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-cta);
    color: var(--on-accent);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(255, 208, 0, 0.16);
    transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-auth:hover:not(:disabled),
.btn-login:hover:not(:disabled),
.btn-register:hover:not(:disabled),
.btn-reset:hover:not(:disabled) {
    filter: brightness(1.03);
    box-shadow: 0 18px 34px rgba(255, 208, 0, 0.2);
}

.btn-auth:active:not(:disabled),
.btn-login:active:not(:disabled),
.btn-register:active:not(:disabled),
.btn-reset:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-auth:disabled,
.btn-login:disabled,
.btn-register:disabled,
.btn-reset:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-link,
.link {
    color: var(--color-accent-gold-400);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.auth-link:hover,
.link:hover {
    color: var(--color-accent-gold-500);
    text-decoration: underline;
}

.auth-alert,
.helper-note,
.status-message,
.error-message {
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(226, 232, 240, 0.92);
}

.auth-alert {
    padding: var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.auth-alert--error,
.status-message.error,
.error-message {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.auth-alert--success,
.status-message.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.auth-alert--warning,
.status-message.warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
}

.auth-alert--info,
.status-message.info {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.12);
    color: #bfdbfe;
}

.helper-note,
.status-message {
    padding: var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.error-message {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    display: none;
}

.error-message.show {
    display: block;
}

.auth-field-label,
.field label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--text-strong);
    font-size: var(--text-md);
    font-weight: 500;
}

.auth-text-muted {
    color: rgba(226, 232, 240, 0.72);
    font-size: var(--text-sm);
}

/* ============================================
   REDIRECT OVERLAY — Transición visual
   ============================================ */
.redirect-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt, #030d22);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.redirect-overlay.open {
    opacity: 1;
}

.redirect-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
}

.redirect-brand {
    margin-bottom: 36px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.redirect-overlay.open .redirect-brand {
    opacity: 1;
    transform: scale(1);
}

.redirect-brand img {
    width: 160px;
    height: auto;
    display: block;
}

.redirect-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 28px;
}

.redirect-ring-svg {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.redirect-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}

.redirect-ring-fg {
    fill: none;
    stroke: url(#redirectGradient);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.redirect-overlay.open .redirect-ring-fg {
    stroke-dashoffset: 0;
}

.redirect-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s ease 1.1s;
}
.redirect-overlay.open .redirect-check {
    opacity: 1;
}

.redirect-check svg {
    width: 48px;
    height: 48px;
}

.redirect-check-path {
    fill: none;
    stroke: #ffd000;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transition: stroke-dashoffset 0.45s ease 1.25s;
}
.redirect-overlay.open .redirect-check-path {
    stroke-dashoffset: 0;
}

.redirect-glow {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 208, 0, 0.18) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.6s ease 1.1s;
}
.redirect-overlay.open .redirect-glow {
    opacity: 1;
}

.redirect-text {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease 1.3s, transform 0.4s ease 1.3s;
}
.redirect-overlay.open .redirect-text {
    opacity: 1;
    transform: translateY(0);
}

.redirect-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.redirect-subtitle {
    margin: 0;
    font-size: 14px;
    color: #5e6e88;
    line-height: 1.5;
}

.redirect-progress {
    margin-top: 36px;
    width: 200px;
    height: 3px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease 1.5s;
}
.redirect-overlay.open .redirect-progress {
    opacity: 1;
}

.redirect-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #ffd000, #ffbf00);
    transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.redirect-overlay.open .redirect-progress-bar {
    width: 100%;
}

.redirect-message {
    margin-top: 12px;
    font-size: 12px;
    color: rgba(94, 110, 136, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease 1.7s;
}
.redirect-overlay.open .redirect-message {
    opacity: 1;
}

@media (max-width: 640px) {
    .auth-page {
        padding: var(--space-3);
    }

    .auth-shell {
        border-radius: 18px;
    }

    .redirect-card {
        padding: 32px 24px;
    }
    .redirect-ring-wrap {
        width: 96px;
        height: 96px;
    }
    .redirect-ring-svg {
        width: 96px;
        height: 96px;
    }
    .redirect-brand img {
        width: 120px;
    }
}