/* login.css — diseño moderno de pantalla de acceso */

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ────────────────────────────────────────────────── */
html, body {
    height: 100%;
    font-family: 'Roboto', system-ui, sans-serif;
    overflow: hidden;
}

/* ── Root: split layout ──────────────────────────────────── */
.login-root {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   PANEL IZQUIERDO — imagen institucional
   ═══════════════════════════════════════════════════════════ */
.panel-brand {
    flex: 0 0 56%;
    background: url('../../img/academic_bg.png') center / cover no-repeat;
    position: relative;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        150deg,
        rgba(8, 34, 76, 0.90) 0%,
        rgba(12, 61, 122, 0.76) 55%,
        rgba(7, 28, 62, 0.92) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-body {
    text-align: center;
    color: #fff;
    padding: 40px 52px;
    animation: fadeUp 0.65s ease both;
}

.brand-logo {
    width: 92px;
    height: 92px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.11);
    border-radius: 18px;
    padding: 10px;
    margin-bottom: 22px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.32);
}

.brand-name {
    font-size: clamp(15px, 2vw, 24px);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.38);
    text-wrap: balance;
    margin-bottom: 8px;
}

.brand-sub {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    opacity: 0.72;
}

/* Amber rule — derived from the warm wood tones in the background photo */
.brand-rule {
    width: 44px;
    height: 2px;
    background: rgba(196, 154, 45, 0.72);
    margin: 22px auto;
    border-radius: 2px;
}

.brand-chips {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.brand-chips > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.brand-chips > span .material-icons {
    font-size: 13px;
    opacity: 0.82;
}

/* ═══════════════════════════════════════════════════════════
   PANEL DERECHO — formulario
   ═══════════════════════════════════════════════════════════ */
.panel-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5fb;
    padding: 32px 24px;
    overflow-y: auto;
}

.form-shell {
    width: 100%;
    max-width: 356px;
    animation: fadeUp 0.5s 0.1s ease both;
}

/* Logo visible solo en móvil */
.mobile-logo {
    display: none;
    width: 58px;
    height: 58px;
    object-fit: contain;
    margin: 0 auto 10px;
}

/* Nombre de la UE visible solo en móvil, debajo del logo */
.mobile-school-name {
    display: none;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--primary-blue, #0c3d7a);
    margin-bottom: 22px;
    text-wrap: balance;
}

/* ── Encabezado ──────────────────────────────────────────── */
.form-heading {
    margin-bottom: 28px;
}

.form-heading h2 {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
    text-wrap: balance;
}

.form-heading p {
    font-size: 13.5px;
    color: #5a6a7e;
    font-weight: 400;
}

/* ── Alerta de error ─────────────────────────────────────── */
.alert-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff1f1;
    border: 1px solid #fecdd3;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 11px 14px;
    margin-bottom: 22px;
    color: #991b1b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.alert-error .material-icons {
    font-size: 17px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Campos de formulario ────────────────────────────────── */
/*
   DOM order dentro de .form-group:
     <input>  ←  anchor del selector ~
     <label>  ←  hermano siguiente: input:focus ~ label
     <span.field-icon>  ←  hermano siguiente: input:focus ~ .field-icon
   El posicionamiento absoluto coloca el icon a la izquierda visualmente.
*/
.form-group {
    position: relative;
    margin-bottom: 18px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    display: block;
    width: 100%;
    padding: 15px 44px 15px 44px;
    border: 1.5px solid #dde5f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    line-height: 1;
}

.form-group input:focus {
    border-color: var(--primary-blue, #0c3d7a);
    box-shadow: 0 0 0 3px rgba(12, 61, 122, 0.07);
}

/* Etiqueta flotante: reposa dentro del campo, sube al borde cuando activa */
.form-group label {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14.5px;
    color: #94a3b8;
    pointer-events: none;
    background: transparent;
    padding: 0 3px;
    line-height: 1;
    transition: top 0.16s, left 0.16s, font-size 0.16s, color 0.16s, background 0.16s;
}

.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label {
    top: 0;
    left: 12px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-blue, #0c3d7a);
    background: #fff;
    padding: 0 4px;
}

/* Ícono izquierdo — posicionado absolutamente, DOM viene después del input */
.form-group .field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 19px;
    color: #b0bec5;
    pointer-events: none;
    transition: color 0.18s;
}

.form-group input:focus ~ .field-icon,
.form-group input:not(:placeholder-shown) ~ .field-icon {
    color: var(--primary-blue, #0c3d7a);
}

/* Toggle visibilidad de contraseña */
.toggle-password {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 19px;
    color: #b0bec5;
    cursor: pointer;
    user-select: none;
    transition: color 0.18s;
    line-height: 0;
}

.toggle-password:hover { color: var(--primary-blue, #0c3d7a); }

/* ── Fila de opciones ────────────────────────────────────── */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #5a6a7e;
    font-weight: 500;
    user-select: none;
}

.check-label input[type="checkbox"] { display: none; }

.check-box {
    width: 17px;
    height: 17px;
    border: 2px solid #c4cfd8;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, border-color 0.14s;
}

.check-label input:checked ~ .check-box {
    background: var(--primary-blue, #0c3d7a);
    border-color: var(--primary-blue, #0c3d7a);
}

.check-label input:checked ~ .check-box::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(0, -1px);
}

.link-forgot {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-blue, #0c3d7a);
    text-decoration: none;
    opacity: 0.82;
    transition: opacity 0.15s;
}

.link-forgot:hover { opacity: 1; text-decoration: underline; }

/* ── Botón de envío ──────────────────────────────────────── */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: var(--primary-blue, #0c3d7a);
    color: var(--primary-blue-on, #fff);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.25px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(12, 61, 122, 0.26);
    transition: filter 0.15s, transform 0.12s, box-shadow 0.15s;
}

.btn-submit .material-icons { font-size: 17px; }

.btn-submit:hover {
    filter: brightness(1.09);
    transform: translateY(-1px);
    box-shadow: 0 7px 22px rgba(12, 61, 122, 0.32);
}

.btn-submit:active {
    transform: translateY(0);
    filter: brightness(0.97);
    box-shadow: 0 2px 8px rgba(12, 61, 122, 0.20);
}

.btn-submit:focus-visible {
    outline: 3px solid rgba(196, 154, 45, 0.58);
    outline-offset: 2px;
}

/* ── Pie de formulario ───────────────────────────────────── */
.form-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 11.5px;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

/* ── Animación de entrada ────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .brand-body, .form-shell { animation: none; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 800px) {
    html, body { overflow-y: auto; }

    .login-root {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .panel-brand { display: none; }

    .panel-form {
        min-height: 100vh;
        padding: 52px 24px;
    }

    .mobile-logo        { display: block; }
    .mobile-school-name { display: block; }

    .form-heading {
        text-align: center;
    }
}
