/* ==========================================================
   Pantalla de inicio de sesión
   Usa las variables de color de agua.css (--primary, --accent...)
   ========================================================== */

.auth {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100vh;
    background: #fff;
}

/* ---------- Panel de marca (izquierda) ---------- */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(circle at 85% 10%, rgba(45, 212, 191, .22), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(124, 58, 237, .18), transparent 40%),
        linear-gradient(160deg, #0F172A 0%, #12304A 50%, #0E7490 100%);
}

.auth-brand__top {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: .01em;
}

.auth-brand__body {
    position: relative;
    z-index: 1;
    max-width: 440px;
}

.auth-brand__body h1 {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0 0 12px;
}

.auth-brand__body p {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
    margin: 0 0 28px;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, .92);
}

.auth-features__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .14);
    color: var(--accent);
}

.auth-brand__foot {
    position: relative;
    z-index: 1;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .7);
}

/* Ondas decorativas al fondo del panel */
.auth-brand__waves {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 180px;
    pointer-events: none;
}

/* ---------- Logo (edificio) y nombre ---------- */
.auth-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.auth-logo--lg {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-light);
    box-shadow: none;
}

.auth-name {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.auth-name small {
    font-size: 12.5px;
    font-weight: 500;
    opacity: .8;
}

/* ---------- Formulario (derecha) ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 24px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.auth-card__mobile-brand {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--primary-dark);
}

.auth-card__mobile-brand .auth-name small {
    color: var(--muted);
    opacity: 1;
}

.auth-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text);
}

.auth-card__sub {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 24px;
}

/* Mensaje de error general */
.auth-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 13px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.45;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.auth-alert svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-alert--success {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #166534;
}

/* Texto de ayuda debajo de un campo */
.auth-hint {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

/* Enlaces */
.auth-link {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.auth-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

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

/* Campos */
.auth-field {
    margin-bottom: 18px;
}

.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > .auth-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    pointer-events: none;
    transition: color .15s;
}

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 44px 0 42px;
    font-size: 14.5px;
    color: var(--text);
    background: #fff;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}

.auth-input::placeholder {
    color: #94A3B8;
}

.auth-input:hover {
    border-color: #94A3B8;
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 116, 144, .14);
}

.auth-input-wrap:focus-within > .auth-input-icon {
    color: var(--primary);
}

.auth-input[aria-invalid="true"] {
    border-color: var(--danger);
}

.auth-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .12);
}

/* Botón de mostrar/ocultar contraseña */
.auth-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748B;
    cursor: pointer;
}

.auth-toggle:hover {
    background: #F1F5F9;
    color: var(--text);
}

.auth-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.auth-toggle .icon-hide { display: none; }
.auth-toggle[aria-pressed="true"] .icon-show { display: none; }
.auth-toggle[aria-pressed="true"] .icon-hide { display: block; }

/* Recordarme */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 22px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Botón principal */
.auth-submit {
    width: 100%;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: background .15s, transform .05s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(14, 116, 144, .3);
}

.auth-submit:hover {
    background: var(--primary-dark);
}

.auth-submit:active {
    transform: translateY(1px);
}

.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(14, 116, 144, .25);
}

.auth-submit:disabled {
    opacity: .75;
    cursor: wait;
}

.auth-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}

.auth-submit.is-loading .auth-spinner {
    display: inline-block;
}

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

.auth-footer {
    margin-top: 24px;
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}

/* ---------- Celular y tableta ---------- */
@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-main {
        justify-content: flex-start;
        padding-top: 48px;
        background:
            linear-gradient(180deg, #0F172A 0, #12304A 140px, var(--bg) 140px);
    }

    .auth-card__mobile-brand {
        display: flex;
    }
}

@media (max-width: 420px) {
    .auth-main {
        padding-left: 16px;
        padding-right: 16px;
    }

    .auth-card {
        padding: 28px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner { animation-duration: 1.5s; }
    .auth-input, .auth-submit { transition: none; }
}
