/* =========================================================
   SIGAD | LOGIN
   Paleta del panel principal: slate + celeste
========================================================= */

:root {
    --ink: #0f172a;
    --ink-2: #1e293b;
    --text: #0f172a;
    --muted: #64748b;
    --line: #cbd5e1;
    --line-soft: #e2e8f0;
    --bg: #f8fafc;
    --accent: #0284c7;
    --accent-text: #0369a1;
    --ring: rgba(2, 132, 199, .22);

    --red: #b42318;
    --red-soft: #fef3f2;
    --green: #047857;
    --green-soft: #ecfdf5;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden],
.hidden { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    background: #fff;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }


/* =========================================================
   PÁGINA
========================================================= */

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}


/* =========================================================
   PANEL DE MARCA
========================================================= */

.login-brand {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: clamp(32px, 5vw, 72px);
    color: #fff;
    background: var(--ink);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    font-size: 19px;
}

.brand-name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .04em;
}

.brand-body {
    margin: auto 0;
    max-width: 520px;
}

.brand-body h1 {
    margin: 0;
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.025em;
}

.brand-body p {
    margin: 16px 0 0;
    color: #94a3b8;
    font-size: 16px;
    max-width: 420px;
}

.brand-footer {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}


/* ---------- Lista de asistencia ilustrativa ---------- */

.roster {
    margin-top: 40px;
    max-width: 400px;
    padding: 6px 16px 10px;
    border: 1px solid #334155;
    border-radius: 12px;
    background: var(--ink-2);
}

.roster-head {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #334155;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
}

.roster-head span:last-child {
    color: #94a3b8;
    font-weight: 500;
}

.roster-row {
    display: grid;
    grid-template-columns: 1fr repeat(5, 30px);
    align-items: center;
    gap: 6px;
    padding: 7px 0;
}

.roster-row + .roster-row { border-top: 1px solid #263449; }

.roster-row i {
    height: 8px;
    width: 70%;
    border-radius: 4px;
    background: #475569;
}

.roster-row:nth-child(4) i { width: 55%; }
.roster-row:nth-child(5) i { width: 80%; }
.roster-row:nth-child(6) i { width: 62%; }

.roster-row b {
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.roster-days b {
    height: auto;
    color: #64748b;
    font-weight: 500;
}

.roster-row .p { background: rgba(2, 132, 199, .22); color: #7dd3fc; }
.roster-row .f { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.roster-row .r { background: rgba(251, 191, 36, .16); color: #fcd34d; }


/* =========================================================
   PANEL DE ACCESO
========================================================= */

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 64px);
    background: #fff;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-header { margin-bottom: 28px; }

.login-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.025em;
}

.login-header p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
}


/* ---------- Mensaje ---------- */

.login-message {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: var(--red);
    background: var(--red-soft);
    font-size: 14px;
}

.login-message.success {
    color: var(--green);
    background: var(--green-soft);
    border-color: #a7f3d0;
}


/* ---------- Formulario ---------- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group > label,
.password-label label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
}

.password-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.password-label a {
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.password-label a:hover { text-decoration: underline; }

.input-wrapper { position: relative; }

.input-wrapper input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    font-size: 16px; /* evita el zoom automático en iPhone */
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input-wrapper input::placeholder { color: #94a3b8; }

.input-wrapper input:hover { border-color: #94a3b8; }

.input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.input-wrapper input#password { padding-right: 48px; }

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transform: translateY(-50%);
}

.toggle-password:hover { color: var(--ink); background: var(--line-soft); }

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


/* ---------- Recordar ---------- */

.remember {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.remember input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ink);
    cursor: pointer;
}


/* ---------- Botón ---------- */

.login-button {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    background: var(--ink);
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}

.login-button:hover:not(:disabled) { background: var(--ink-2); }

.login-button:active:not(:disabled) { background: #000; }

.login-button:disabled { cursor: not-allowed; opacity: .7; }

.button-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: giro .7s linear infinite;
}

.login-button:focus-visible,
.toggle-password:focus-visible,
.password-label a:focus-visible,
.remember input:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}


/* =========================================================
   RESPONSIVO
========================================================= */

/* Pantallas grandes */
@media (min-width: 1600px) {
    .login-box { max-width: 440px; }
    .brand-body { max-width: 580px; }
    .roster { max-width: 440px; }
}

/* Laptops de poca altura: se oculta la lista para que todo quepa */
@media (min-width: 900px) and (max-height: 700px) {
    .roster { display: none; }
    .login-brand { gap: 20px; }
}

/* Tablet y móvil: la marca pasa a una franja superior */
@media (max-width: 899px) {

    .login-page {
        display: flex;
        flex-direction: column;
    }

    .login-brand {
        flex-direction: row;
        align-items: center;
        gap: 0;
        padding: 16px 24px;
    }

    .brand-body,
    .brand-footer { display: none; }

    .login-panel {
        flex: 1;
        align-items: flex-start;
        padding: 40px 24px 32px;
    }

    .login-box { margin: 0 auto; }
}

@media (max-width: 480px) {

    .login-brand { padding: 14px 20px; }

    .login-panel { padding: 28px 20px 24px; }

    .login-header { margin-bottom: 24px; }

    .login-header h2 { font-size: 26px; }

    .login-form { gap: 18px; }
}

@media (max-width: 340px) {
    .login-panel { padding: 24px 16px; }
    .login-header h2 { font-size: 24px; }
}


/* =========================================================
   LOADER DE INICIO
========================================================= */

.sigad-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    animation: entrada .2s ease;
}

.sigad-loader-content {
    width: 360px;
    max-width: 88%;
    text-align: center;
}

.sigad-loader-logo {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--ink);
}

.sigad-loader-subtitle {
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: .08em;
    color: var(--muted);
}

.sigad-loader-spinner {
    position: relative;
    width: 28px;
    height: 28px;
    margin: 30px auto 16px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--line-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: giro .8s linear infinite;
}

.spinner-dot,
.sigad-loader-percent,
.sigad-loader-terminal { display: none; }

.sigad-loader-status {
    min-height: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.sigad-loader-progress {
    height: 3px;
    margin-top: 16px;
    overflow: hidden;
    background: var(--line-soft);
    border-radius: 3px;
}

.sigad-loader-progress-bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .35s ease;
}

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

@keyframes entrada { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition: none !important;
    }
    .button-spinner,
    .spinner-ring { animation-duration: 1.6s !important; }
}


/* =========================================================
   LOGO SIGAD (img/logo.png)
========================================================= */

.brand-logo {
    display: flex;
    align-items: center;
}

.brand-logo-image {
    display: block;
    width: clamp(120px, 11vw, 170px);
    max-width: 100%;
    height: auto;
    object-fit: contain;

    /* Si tu logo es de un solo color oscuro y no se ve sobre el fondo
       oscuro, quita los comentarios de la siguiente línea para verlo blanco:
       filter: brightness(0) invert(1); */
}

@media (min-width: 1600px) {
    .brand-logo-image { width: 190px; }
}

/* Tablet y móvil: el logo se ajusta por altura para que la franja
   superior se mantenga delgada sin importar la forma del logo */
@media (max-width: 899px) {
    .brand-logo-image {
        width: auto;
        height: 34px;
        max-width: 170px;
    }
}

@media (max-width: 480px) {
    .brand-logo-image {
        height: 30px;
        max-width: 150px;
    }
}