/* Pantallas de ingreso de SICMED (login.html y verificar_2fa.php).
   Panel de marca con cuadrícula de papel de electrocardiograma y un trazo
   que se dibuja una sola vez; a la derecha, el formulario sobre blanco. */
:root {
    --sicmed-navy: #2c3e50;
    --sicmed-azul: #2980b9;
    --sicmed-azul-osc: #21618c;
    --sicmed-azul-claro: #eaf3fb;
    --ing-tinta: #1c2b3a;
    --ing-suave: #5d6d7e;
    --ing-linea: #d5dde6;
    --ing-fondo: #f3f6f9;
}

html, body { height: 100%; }
body.ingreso {
    margin: 0;
    min-height: 100vh;
    background: #fff;
    color: var(--ing-tinta);
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    overflow-x: hidden;
}

.ingreso-grid {
    display: grid;
    grid-template-columns: minmax(360px, 44%) 1fr;
    min-height: 100vh;
}

/* ── Panel de marca ─────────────────────────────────────────────── */
.ingreso-marca {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 48px 56px 40px;
    color: #fff;
    background-color: #22374b;
    /* Papel de ECG: cuadro pequeño de 8 px y cuadro grande de 40 px */
    background-image:
        linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(160deg, #2c3e50 0%, #22374b 45%, #1d5378 100%);
    background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px, 100% 100%;
    background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px, 0 0;
}
.ingreso-logo {
    position: relative;
    display: inline-block;
    align-self: flex-start;
    background: #fff;
    border-radius: 10px;
    padding: 10px 16px;
}
.ingreso-logo img { display: block; height: 58px; width: auto; }

.ingreso-frase { position: relative; max-width: 470px; margin-top: auto; padding-bottom: 36px; }
.ingreso-frase h2 {
    font-size: 2.1rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -.01em;
    color: #fff;
    margin: 0 0 14px;
}
.ingreso-frase p {
    font-size: .95rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .72);
    margin: 0;
    max-width: 38ch;
}

.ingreso-trazo {
    position: absolute;
    left: 0;
    right: 0;
    top: 34%;
    width: 100%;
    height: 120px;
    pointer-events: none;
}
.ingreso-trazo path {
    fill: none;
    stroke: rgba(255, 255, 255, .55);
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    /* Como un monitor: el trazo barre la pantalla a ritmo constante, se
       sostiene un momento, se desvanece y vuelve a empezar. */
    animation: trazoEcg 4.5s linear .2s infinite;
}
@keyframes trazoEcg {
    0%   { stroke-dashoffset: 1000; opacity: 1; }
    72%  { stroke-dashoffset: 0;    opacity: 1; }
    88%  { stroke-dashoffset: 0;    opacity: 1; }
    100% { stroke-dashoffset: 0;    opacity: 0; }
}

.ingreso-pie {
    position: relative;
    font-size: .8rem;
    color: rgba(255, 255, 255, .55);
}

/* ── Panel del formulario ───────────────────────────────────────── */
.ingreso-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 20px;
    background: #fff;
}
/* margin auto arriba y abajo: la caja queda centrada y el crédito al pie */
.ingreso-caja { width: 100%; max-width: 360px; margin: auto 0; }
.ingreso-credito {
    width: 100%;
    padding-bottom: 4px;
    max-width: 420px;   /* en columna flexible no se ajustaba y ensanchaba el panel en celular */
    margin-top: 28px;
    font-size: .74rem;
    color: #8a96a5;
    text-align: center;
}
.ingreso-credito a { color: var(--ing-suave); text-decoration: none; font-weight: 600; }
.ingreso-credito a:hover { color: var(--sicmed-azul); text-decoration: underline; }
.ingreso-caja h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ing-tinta);
    margin: 0 0 6px;
}
.ingreso-sub {
    font-size: .9rem;
    color: var(--ing-suave);
    margin: 0 0 26px;
}

.ingreso-caja label,
.ingreso-etiqueta {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ing-tinta);
    margin-bottom: 5px;
}
.ingreso-fila-etiqueta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.ingreso-fila-etiqueta a {
    font-size: .8rem;
    color: var(--sicmed-azul);
}
.ingreso-caja .form-group { margin-bottom: 16px; }

.ingreso-caja .form-control {
    height: 38px;
    font-size: 14px;
    color: var(--ing-tinta);
    border: 1px solid var(--ing-linea);
    border-radius: 6px;
    padding: 6px 11px;
    background: #fff;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ingreso-caja .form-control::placeholder { color: #98a4b3; opacity: 1; }
.ingreso-caja .form-control:focus {
    border-color: var(--sicmed-azul);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, .18);
}

/* Ojito dentro del campo de la clave */
.campo-clave { position: relative; }
.campo-clave .form-control { padding-right: 2.6rem; }
.ver-clave {
    position: absolute;
    top: 0;
    right: 0;
    height: 38px;
    width: 38px;
    border: 0;
    background: transparent;
    color: #8a96a5;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
}
.ver-clave:hover { color: var(--ing-tinta); }
.ver-clave:focus-visible { outline: 2px solid var(--sicmed-azul); outline-offset: -2px; }

.ingreso-caja .btn-primary {
    height: 40px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 6px;
    background-color: var(--sicmed-azul);
    border-color: var(--sicmed-azul);
    margin-top: 6px;
}
.ingreso-caja .btn-primary:hover,
.ingreso-caja .btn-primary:active { background-color: var(--sicmed-azul-osc); border-color: var(--sicmed-azul-osc); }
.ingreso-caja .btn-primary:focus { box-shadow: 0 0 0 3px rgba(41, 128, 185, .3); }
.ingreso-caja .btn-primary:disabled { opacity: .7; }

.ingreso-caja a:focus-visible,
.ingreso-enlace:focus-visible { outline: 2px solid var(--sicmed-azul); outline-offset: 2px; border-radius: 2px; }

/* Texto legal: solo las políticas de SICMED. Por eso el sello de reCAPTCHA queda
   VISIBLE: Google exige mostrarlo o, si se oculta, poner su texto legal. */
.ingreso-legal {
    margin: 22px 0 0;
    padding-top: 16px;
    border-top: 1px solid #e8edf2;
    font-size: .72rem;
    line-height: 1.5;
    color: #8a96a5;
}
.ingreso-legal a { color: var(--ing-suave); text-decoration: underline; }

/* SweetAlert con el azul del tema */
.swal2-styled.swal2-confirm { background-color: var(--sicmed-azul) !important; }
.swal2-styled.swal2-confirm:focus { box-shadow: 0 0 0 3px rgba(41, 128, 185, .35) !important; }

/* ── Celular y tableta: una sola columna, marca como franja ──────── */
@media (max-width: 860px) {
    .ingreso-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .ingreso-marca {
        padding: 22px 20px;
        flex-direction: row;
        align-items: center;
    }
    .ingreso-logo { padding: 7px 12px; border-radius: 8px; }
    .ingreso-logo img { height: 40px; }
    .ingreso-frase, .ingreso-pie { display: none; }
    .ingreso-trazo { top: auto; bottom: 0; height: 60px; transform: none; opacity: .7; }
    /* abajo queda espacio para el sello de reCAPTCHA, que flota en la esquina */
    .ingreso-form { justify-content: flex-start; padding: 32px 16px 84px; }
    .ingreso-caja { margin: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .ingreso-trazo path { animation: none; stroke-dashoffset: 0; }
    .ingreso-caja .form-control { transition: none; }
}
