/**
 * marduk-auth.css — Sistema visual minimalista y moderno para las vistas
 * de autenticación: login, register, forgot-password, reset-password.
 *
 * Diseño split-screen DEAJ: panel institucional con gradiente azul
 * institucional + cinta amarilla + pattern sutil a la izquierda;
 * formulario limpio sobre fondo blanco a la derecha. En móvil el panel
 * se vuelve un encabezado compacto y el form ocupa el resto.
 *
 * Tokens DEAJ oficiales (extractados del manual de marca):
 *   primary deep   #033e75   primary-bright #2680eb
 *   primary digital#144f9c   secondary      #71ce82
 *   yellow         #fdb611   coral          #e96b64
 */

:root {
    --auth-primary:        #033e75;
    --auth-primary-deep:   #021b3a;
    --auth-primary-bright: #2680eb;
    --auth-primary-digital:#144f9c;
    --auth-yellow:         #fdb611;
    --auth-secondary:      #71ce82;
    --auth-secondary-deep: #39a44c;
    --auth-coral:          #e96b64;
    --auth-grad: linear-gradient(135deg, #033e75 0%, #144f9c 45%, #2680eb 100%);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.auth-body {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #1f2937;
    background: #f5f8fc;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

/* ── LAYOUT split-screen ────────────────────────────────────────────── */
.auth-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, 480px) 1fr;
}
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
}

/* ── PANEL institucional (izquierda) ────────────────────────────────── */
.auth-aside {
    position: relative;
    overflow: hidden;
    background: var(--auth-grad);
    color: #fff;
    padding: 3rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    isolation: isolate;
}
.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 25%, rgba(125, 158, 218, .35) 0%, transparent 38%),
        radial-gradient(circle at 85% 80%, rgba(253, 182, 17, .18) 0%, transparent 42%),
        radial-gradient(circle at 60% 40%, rgba(113, 206, 130, .12) 0%, transparent 35%);
    z-index: -1;
}
.auth-aside::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 4px;
    background: var(--auth-yellow);
    z-index: 1;
}

.auth-aside-top {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.auth-aside-top .logo-circle {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.auth-aside-top .logo-circle img {
    width: 32px; height: 32px;
    object-fit: contain;
}
.auth-aside-top .brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}
.auth-aside-top .brand-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    opacity: .75;
}

.auth-aside-hero {
    margin-top: 4rem;
}
.auth-aside-hero .eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--auth-yellow);
    font-weight: 600;
    margin-bottom: .85rem;
}
.auth-aside-hero h2 {
    font-size: 2.1rem;
    line-height: 1.15;
    font-weight: 700;
    margin: 0 0 1rem;
    letter-spacing: -.02em;
}
.auth-aside-hero h2 em {
    font-style: italic;
    color: var(--auth-yellow);
    font-weight: 600;
}
.auth-aside-hero p {
    color: rgba(255, 255, 255, .82);
    line-height: 1.6;
    font-size: .95rem;
    max-width: 38ch;
    margin: 0;
}

.auth-aside-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-top: 2.5rem;
}
.auth-aside-stats .stat {
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    padding: .85rem .9rem;
}
.auth-aside-stats .stat strong {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}
.auth-aside-stats .stat span {
    display: block;
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .65);
    margin-top: .35rem;
}

.auth-aside-bottom {
    margin-top: auto;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: end;
    font-family: 'JetBrains Mono', monospace;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}
.auth-aside-bottom a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.auth-aside-bottom a:hover { color: var(--auth-yellow); }

/* En móvil el aside se compacta en un header */
@media (max-width: 991.98px) {
    .auth-aside { padding: 1.5rem 1.5rem 1.75rem; }
    .auth-aside-hero { margin-top: 1.5rem; }
    .auth-aside-hero h2 { font-size: 1.45rem; }
    .auth-aside-hero p { font-size: .88rem; }
    .auth-aside-stats { display: none; }
    .auth-aside-bottom { display: none; }
}

/* ── PANEL formulario (derecha) ─────────────────────────────────────── */
.auth-main {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    min-height: 100%;
    position: relative;
}

.auth-form-wrap {
    width: 100%;
    max-width: 460px;
    animation: authFadeIn .55s cubic-bezier(.18,.89,.32,1.28) both;
}
.auth-form-wrap.wide { max-width: 580px; }

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

.auth-form-wrap h1 {
    color: var(--auth-primary);
    font-weight: 800;
    font-size: 1.85rem;
    letter-spacing: -.02em;
    margin-bottom: .5rem;
}
.auth-form-wrap .lead {
    color: #6b7280;
    font-size: .95rem;
    margin-bottom: 2rem;
}

.auth-form-wrap .form-floating > .form-control,
.auth-form-wrap .form-floating > .form-select {
    border-radius: 12px;
    border: 1.5px solid #e5e7eb;
    background: #fafbfc;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-form-wrap .form-floating > .form-control:focus,
.auth-form-wrap .form-floating > .form-select:focus {
    border-color: var(--auth-primary-bright);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(38, 128, 235, .12);
}
.auth-form-wrap .form-floating > label {
    color: #6b7280;
}
.auth-form-wrap .form-floating > label > i {
    color: var(--auth-primary);
    margin-right: .35rem;
}

/* CTA principal — gradiente DEAJ con sombra azul institucional */
.auth-form-wrap .btn-cta {
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-bright) 100%);
    border: 0;
    color: #fff;
    font-weight: 600;
    letter-spacing: .01em;
    padding: .85rem 1rem;
    border-radius: 12px;
    width: 100%;
    box-shadow: 0 6px 18px -6px rgba(3, 62, 117, .55), 0 1px 0 rgba(255, 255, 255, .25) inset;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    position: relative;
    overflow: hidden;
}
.auth-form-wrap .btn-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .65s ease;
}
.auth-form-wrap .btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px -6px rgba(3, 62, 117, .65), 0 1px 0 rgba(255, 255, 255, .25) inset;
}
.auth-form-wrap .btn-cta:hover::before { transform: translateX(100%); }
.auth-form-wrap .btn-cta:active { transform: translateY(0); }
.auth-form-wrap .btn-cta:disabled { opacity: .7; cursor: not-allowed; transform: none; }

/* Toggle de visibilidad de contraseña */
.auth-form-wrap .pwd-wrap { position: relative; }
.auth-form-wrap .pwd-toggle {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s ease, background .15s ease;
    z-index: 5;
}
.auth-form-wrap .pwd-toggle:hover { color: var(--auth-primary); background: rgba(3, 62, 117, .06); }

/* Spinner integrado */
.auth-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin .8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Selector de roles minimalista (register) */
.auth-form-wrap .role-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
@media (max-width: 575.98px) { .auth-form-wrap .role-grid { grid-template-columns: repeat(2, 1fr); } }

.auth-form-wrap .role-card {
    border: 1.5px solid #e5e7eb;
    background: #fafbfc;
    border-radius: 12px;
    padding: .85rem .55rem;
    cursor: pointer;
    text-align: center;
    transition: all .18s ease;
    user-select: none;
}
.auth-form-wrap .role-card:hover {
    border-color: var(--auth-primary-bright);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px -8px rgba(3, 62, 117, .35);
}
.auth-form-wrap .role-card.selected {
    border-color: var(--auth-primary);
    background: linear-gradient(135deg, rgba(3, 62, 117, .08), rgba(38, 128, 235, .06));
    box-shadow: 0 0 0 3px rgba(3, 62, 117, .12);
}
.auth-form-wrap .role-card i {
    display: block;
    font-size: 1.3rem;
    color: var(--auth-primary);
    margin-bottom: .35rem;
}
.auth-form-wrap .role-card.selected i { color: var(--auth-primary-bright); }
.auth-form-wrap .role-card span {
    display: block;
    font-size: .76rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.25;
}

/* Strength meter (register) */
.pwd-strength {
    display: flex; gap: 4px; margin-top: .5rem;
}
.pwd-strength span {
    flex: 1; height: 4px; border-radius: 2px; background: #e5e7eb;
    transition: background .25s ease;
}
.pwd-strength[data-level="1"] span:nth-child(1) { background: var(--auth-coral); }
.pwd-strength[data-level="2"] span:nth-child(-n+2) { background: var(--auth-yellow); }
.pwd-strength[data-level="3"] span:nth-child(-n+3) { background: var(--auth-secondary); }
.pwd-strength[data-level="4"] span { background: var(--auth-secondary-deep); }
.pwd-hint {
    margin-top: .35rem;
    font-size: .75rem;
    color: #6b7280;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: .04em;
}

/* Demo info card (login) */
.auth-demo {
    margin-top: 1.25rem;
    background: linear-gradient(135deg, #fafbfc, #f3f6fa);
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    padding: .85rem 1rem;
    font-size: .8rem;
    color: #4b5563;
}
.auth-demo strong {
    color: var(--auth-primary);
    font-weight: 600;
    display: block;
    margin-bottom: .35rem;
}
.auth-demo code {
    background: rgba(3, 62, 117, .07);
    color: var(--auth-primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .76rem;
}

/* Divisor minimalista */
.auth-divider {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: 1.5rem 0;
    color: #9ca3af;
    font-size: .76rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

/* Links del footer del form */
.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .9rem;
    color: #6b7280;
}
.auth-links a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-links a:hover { color: var(--auth-primary-bright); text-decoration: underline; }

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: 1rem;
    color: #9ca3af;
    font-size: .82rem;
    text-decoration: none;
}
.auth-back:hover { color: var(--auth-primary); }

/* Alertas */
.auth-form-wrap .alert {
    border-radius: 10px;
    border: 0;
    padding: .65rem .85rem;
    font-size: .85rem;
    margin-bottom: 1rem;
}
.auth-form-wrap .alert-danger  { background: rgba(233, 107, 100, .1); color: #b91c1c; border-left: 3px solid var(--auth-coral); }
.auth-form-wrap .alert-success { background: rgba(113, 206, 130, .12); color: #166534; border-left: 3px solid var(--auth-secondary-deep); }
.auth-form-wrap .alert-info    { background: rgba(38, 128, 235, .1); color: #1e3a8a; border-left: 3px solid var(--auth-primary-bright); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .auth-form-wrap, .auth-form-wrap .btn-cta { animation: none !important; transition: none !important; }
    .auth-form-wrap .btn-cta::before { display: none; }
}
