/* ============================================================================
   Sistema de Matrículas — Auth pages (login + register)
   Split-screen layout, glassmorphism form, iridescent 3D hero, theme-aware.
   ============================================================================ */

:root {
    --auth-bg: #f5f8f3;
    --auth-surface: #ffffff;
    --auth-surface-alt: #ebf2e9;
    --auth-text: #051F20;
    --auth-text-muted: #235347;
    --auth-border: #cfdcd1;
    --auth-input-bg: #ffffff;
    --auth-input-border: #c2d1c5;
    --auth-input-focus: #163B32;
    --auth-primary: #163B32;
    --auth-primary-hover: #0B2B26;
    --auth-primary-soft: rgba(22, 59, 50, .08);
    --auth-accent: #8EB69B;
    --auth-accent-hover: #6f9a7c;
    --auth-accent-soft: rgba(142, 182, 155, .18);
    --auth-error: #b94545;
    --auth-error-soft: #fbeeee;
    --auth-visual-bg:
        linear-gradient(135deg, rgba(5, 31, 32, .55) 0%, rgba(22, 59, 50, .70) 50%, rgba(11, 43, 38, .80) 100%),
        url('../images/fachada.png') center/cover no-repeat;
    --auth-visual-text: #f5f8f3;
    --auth-body-bg: #f5f8f3;
    --auth-card-shadow: 0 24px 60px -20px rgba(28, 28, 43, .15);
    --auth-hero-light-opacity: 1;
    --auth-hero-dark-opacity: 0;
    --auth-radius: 18px;
    --auth-radius-sm: 10px;
}

[data-theme="dark"] {
    --auth-bg: #051F20;
    --auth-surface: #0B2B26;
    --auth-surface-alt: #163B32;
    --auth-text: #DAF1DE;
    --auth-text-muted: #8EB69B;
    --auth-border: rgba(218, 241, 222, .10);
    --auth-input-bg: #163B32;
    --auth-input-border: rgba(218, 241, 222, .12);
    --auth-input-focus: #8EB69B;
    --auth-primary: #8EB69B;
    --auth-primary-hover: #DAF1DE;
    --auth-primary-soft: rgba(142, 182, 155, .18);
    --auth-accent: #8EB69B;
    --auth-accent-hover: #DAF1DE;
    --auth-accent-soft: rgba(142, 182, 155, .15);
    --auth-error: #e8a0a0;
    --auth-error-soft: rgba(185, 69, 69, .18);
    --auth-visual-bg:
        linear-gradient(135deg, rgba(5, 31, 32, .82) 0%, rgba(11, 43, 38, .88) 50%, rgba(5, 31, 32, .92) 100%),
        url('../images/fachada.png') center/cover no-repeat;
    --auth-visual-text: #DAF1DE;
    --auth-body-bg: #051F20;
    --auth-card-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6);
    --auth-hero-light-opacity: 0;
    --auth-hero-dark-opacity: 1;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body.auth-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--auth-body-bg);
    color: var(--auth-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .5s ease, color .35s ease;
    min-height: 100vh;
}
body.auth-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: .6;
    mix-blend-mode: overlay;
}
[data-theme="light"] body.auth-body::before { opacity: .25; }

/* ============ SHELL ============ */
.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-grid {
    width: 100%;
    max-width: 1360px;
    background: var(--auth-surface);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-card-shadow);
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    min-height: min(820px, calc(100vh - 48px));
    transition: background .35s ease, box-shadow .35s ease;
    position: relative;
}
.auth-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, .06);
}

/* ============ FORM PANEL (LEFT) ============ */
.auth-form-panel {
    padding: 44px 60px;
    display: flex;
    flex-direction: column;
    background: var(--auth-surface);
    min-width: 0;
    position: relative;
}
[data-theme="dark"] .auth-form-panel {
    background:
        radial-gradient(80% 50% at 0% 0%, rgba(142, 182, 155, .10), transparent 60%),
        radial-gradient(60% 40% at 100% 100%, rgba(35, 83, 71, .12), transparent 60%),
        var(--auth-surface);
}

.auth-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.auth-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ffffff;
    padding: 3px;
    text-decoration: none;
    box-shadow: 0 4px 12px -4px rgba(5, 31, 32, .2);
    transition: transform .2s ease;
    overflow: hidden;
}
.auth-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}
.auth-brand-mark:hover { transform: scale(1.05); }

.auth-top-link {
    margin: 0;
    font-size: .9rem;
    color: var(--auth-text-muted);
}
.auth-top-link a {
    color: var(--auth-text);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}
.auth-top-link a:hover { color: var(--auth-primary); }

.auth-form-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form-card {
    width: 100%;
    max-width: 380px;
}

.auth-icon-wrap {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: var(--auth-primary-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-primary);
    font-size: 1.4rem;
    transition: background .35s ease, color .35s ease;
}

.auth-title {
    text-align: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--auth-primary);
    letter-spacing: -0.012em;
    line-height: 1.1;
}
[data-theme="dark"] .auth-title { color: var(--auth-text); }
.auth-subtitle {
    text-align: center;
    color: var(--auth-text-muted);
    font-size: .9rem;
    margin: 0 0 24px;
}

.auth-alert {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--auth-radius-sm);
    background: var(--auth-error-soft);
    color: var(--auth-error);
    font-size: .88rem;
    margin-bottom: 18px;
    border: 1px solid rgba(220, 38, 38, .2);
}

/* Social btn */
.auth-btn-social {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--auth-radius-sm);
    border: 1px solid var(--auth-input-border);
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-weight: 600;
    font-size: .92rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
}
.auth-btn-social:hover:not([disabled]) {
    background: var(--auth-surface-alt);
    border-color: var(--auth-text-muted);
}
.auth-btn-social[disabled] { opacity: .6; cursor: not-allowed; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--auth-text-muted);
    font-size: .82rem;
    text-transform: lowercase;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

/* Fields */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--auth-text);
    letter-spacing: .01em;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-wrap input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border-radius: var(--auth-radius-sm);
    border: 1px solid var(--auth-input-border);
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: .92rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s, background .35s ease;
}
.auth-input-wrap input::placeholder { color: var(--auth-text-muted); opacity: .6; }
.auth-input-wrap input:focus {
    outline: none;
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 4px var(--auth-primary-soft);
}
.auth-input-icon {
    position: absolute;
    left: 14px;
    color: var(--auth-text-muted);
    pointer-events: none;
    font-size: .92rem;
}
.auth-pw-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--auth-text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.auth-pw-toggle:hover { color: var(--auth-primary); background: var(--auth-primary-soft); }

.auth-field-error {
    color: var(--auth-error);
    font-size: .8rem;
    margin-top: 2px;
}

/* Row remember + forgot */
.auth-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: -2px;
}
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--auth-text-muted);
    cursor: pointer;
    user-select: none;
}
.auth-check input { accent-color: var(--auth-primary); cursor: pointer; }
.auth-link-muted {
    font-size: .85rem;
    color: var(--auth-text-muted);
    text-decoration: none;
    transition: color .15s;
}
.auth-link-muted:hover { color: var(--auth-primary); }

/* Primary btn */
.auth-btn-primary {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: var(--auth-radius-sm);
    background: var(--auth-primary);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 10px 24px -10px var(--auth-primary);
    transition: background .15s, transform .1s, box-shadow .15s;
}
.auth-btn-primary:hover {
    background: var(--auth-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -10px var(--auth-primary);
}
.auth-btn-primary:active { transform: translateY(0); }
.auth-btn-primary i { transition: transform .2s; }
.auth-btn-primary:hover i { transform: translateX(3px); }

/* Form footer */
.auth-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--auth-border);
    font-size: .82rem;
    color: var(--auth-text-muted);
}
.auth-form-footer a { display: inline-flex; align-items: center; gap: 6px; }

/* ============ VISUAL PANEL (RIGHT) ============ */
.auth-visual-panel {
    background: var(--auth-visual-bg);
    background-color: #051F20;
    color: var(--auth-visual-text);
    padding: 40px 48px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: color .35s ease;
    isolation: isolate;
}
.auth-visual-panel::before {
    content: '';
    position: absolute;
    inset: -20%;
    background:
        conic-gradient(from 0deg at 50% 50%,
            rgba(142, 182, 155, .22) 0deg,
            rgba(35, 83, 71, .18) 90deg,
            rgba(218, 241, 222, .18) 180deg,
            rgba(22, 59, 50, .15) 270deg,
            rgba(142, 182, 155, .22) 360deg);
    filter: blur(60px);
    animation: authPanelShift 18s linear infinite;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}
[data-theme="light"] .auth-visual-panel::before {
    opacity: 0;
}
.auth-visual-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 85%, rgba(255, 255, 255, .15), transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .10), transparent 45%);
    pointer-events: none;
    z-index: 0;
}
[data-theme="light"] .auth-visual-panel::after {
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .35), transparent 60%);
}

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

@media (prefers-reduced-motion: reduce) {
    .auth-visual-panel::before { animation: none; }
}

.auth-visual-inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    flex: 1;
    min-height: 0;
    gap: 16px;
}

.auth-visual-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.auth-brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: contain;
    background: #ffffff;
    padding: 4px;
    box-shadow:
        0 8px 22px rgba(0, 0, 0, .15),
        inset 0 -2px 4px rgba(0, 0, 0, .04);
}
[data-theme="dark"] .auth-brand-logo {
    box-shadow:
        0 8px 22px rgba(0, 0, 0, .4),
        0 0 24px rgba(142, 182, 155, .25);
}
.auth-brand h2 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: .16em;
    font-weight: 700;
}
.auth-visual-tagline {
    margin: 0;
    font-size: 1rem;
    opacity: .85;
    max-width: 380px;
    line-height: 1.45;
}
.auth-visual-tagline em {
    font-style: italic;
    font-weight: 500;
    opacity: .85;
}

/* Hero stage */
.auth-hero-stage {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    min-height: 240px;
    width: 100%;
}

.auth-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.auth-hero {
    grid-area: 1 / 1;
    width: 78%;
    max-width: 360px;
    height: auto;
    filter:
        drop-shadow(0 25px 35px rgba(0, 0, 0, .35))
        drop-shadow(0 0 40px rgba(142, 182, 155, .35));
    animation: authHeroFloat 7s ease-in-out infinite;
    transition: opacity .5s ease;
    z-index: 2;
    will-change: transform;
}
[data-theme="light"] .auth-hero {
    filter:
        drop-shadow(0 25px 35px rgba(11, 43, 38, .22))
        drop-shadow(0 0 30px rgba(218, 241, 222, .40));
}
.auth-hero-light { opacity: var(--auth-hero-light-opacity); }
.auth-hero-dark  { opacity: var(--auth-hero-dark-opacity); }

@keyframes authHeroFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-hero { animation: none; }
}

/* Visual cards */
.auth-visual-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}
[data-theme="light"] .auth-visual-cards {
    border-top-color: rgba(0, 0, 0, .08);
}
.auth-visual-card { min-width: 0; }
.auth-visual-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.auth-visual-card p {
    margin: 0;
    font-size: .85rem;
    opacity: .8;
    line-height: 1.55;
}
.auth-visual-card a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, .3);
    transition: text-decoration-color .2s;
}
[data-theme="light"] .auth-visual-card a {
    text-decoration-color: rgba(0, 0, 0, .25);
}
.auth-visual-card a:hover {
    text-decoration-color: currentColor;
}

/* ============ THEME TOGGLE ============ */
.auth-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-text);
    cursor: pointer;
    box-shadow: var(--auth-card-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, background .35s ease;
}
.auth-theme-toggle:hover { transform: rotate(20deg) scale(1.05); }
.auth-theme-toggle .fa-moon { display: none; }
.auth-theme-toggle .fa-sun  { display: inline-block; }
[data-theme="dark"] .auth-theme-toggle .fa-moon { display: inline-block; }
[data-theme="dark"] .auth-theme-toggle .fa-sun  { display: none; }

/* ============ FLASH (override app.css) ============ */
.flash-stack {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 420px;
    width: calc(100% - 32px);
}
.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--auth-surface);
    color: var(--auth-text);
    box-shadow: var(--auth-card-shadow);
    border-left: 4px solid var(--auth-primary);
    transition: opacity .35s ease;
}
.flash-success { border-left-color: #16a34a; }
.flash-error,
.flash-danger  { border-left-color: var(--auth-error); }
.flash-warning { border-left-color: #d97706; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
    .auth-shell { padding: 12px; }
    .auth-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .auth-visual-panel {
        order: -1;
        padding: 28px 28px 36px;
        min-height: 280px;
    }
    .auth-visual-inner {
        grid-template-rows: auto 1fr;
    }
    .auth-hero-stage {
        min-height: 200px;
    }
    .auth-hero { max-width: 220px; }
    .auth-form-panel { padding: 32px 28px; }
    .auth-visual-cards { display: none; }
}

@media (max-width: 480px) {
    .auth-form-panel { padding: 24px 18px; }
    .auth-title { font-size: 1.3rem; }
    .auth-form-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .auth-theme-toggle { width: 38px; height: 38px; top: 12px; right: 12px; }
}

/* ============ REGISTER VARIANT ============ */
.auth-form-card.is-wide { max-width: 440px; }
.auth-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 520px) {
    .auth-grid-two { grid-template-columns: 1fr; }
}

.auth-file-field {
    border: 1.5px dashed var(--auth-input-border);
    border-radius: var(--auth-radius-sm);
    padding: 14px;
    text-align: center;
    background: var(--auth-surface-alt);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.auth-file-field:hover {
    border-color: var(--auth-primary);
    background: var(--auth-primary-soft);
}
.auth-file-field input[type="file"] { display: none; }
.auth-file-field .auth-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--auth-text-muted);
    font-size: .88rem;
}
.auth-file-field .auth-file-label i { color: var(--auth-primary); }
