/* ═══════════════════════════════════════════════════
   SIPAF · login.css
   Estética: Refinado institucional — split lateral,
   fondo izquierdo con patrón geométrico verde oscuro,
   tarjeta derecha blanca de alta contraste.
   Fuente: Sora (display) + DM Sans (body)
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    --verde:        #1e4a1e;
    --verde-oscuro: #122e12;
    --verde-claro:  #2d6a2d;
    --verde-suave:  #e4f0e4;
    --verde-borde:  #c8dfc8;
    --acento:       #4ade80;
    --acento-2:     #86efac;
    --blanco:       #ffffff;
    --gris-fondo:   #f7faf7;
    --texto-1:      #0f1f0f;
    --texto-2:      #3d5c3d;
    --texto-3:      #6b8a6b;
    --sombra:       rgba(15,31,15,.18);
    --radio:        1.5rem;
}

html, body {
    height: 100%;
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--verde-oscuro);
}

/* ══════════════════════════════════════════
   LAYOUT SPLIT: izquierda decorativa / derecha form
══════════════════════════════════════════ */
.login-bg {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* ── Panel izquierdo ── */
.login-left {
    background: var(--verde);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 3.5rem;
}

/* Patrón de círculos concéntricos decorativo */
.login-left::before {
    content: '';
    position: absolute;
    width: 700px; height: 700px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.07);
    top: -200px; right: -200px;
    pointer-events: none;
}
.login-left::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.05);
    top: -100px; right: -100px;
    pointer-events: none;
}

.left-deco-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.06);
    pointer-events: none;
}
.left-deco-ring:nth-child(1) { width:320px;height:320px; bottom:-80px;left:-80px; }
.left-deco-ring:nth-child(2) { width:220px;height:220px; bottom:-30px;left:-30px; }
.left-deco-ring:nth-child(3) { width:120px;height:120px; bottom:20px; left:20px; }

/* Punto de luz */
.left-glow {
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74,222,128,.12) 0%, transparent 70%);
    top: 30%; left: 50%;
    transform: translate(-50%,-50%);
    pointer-events: none;
}

.left-brand {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: .85rem;
}
.left-brand-logo {
    width: 48px; height: 48px;
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.2);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
}
.left-brand-logo img { width: 30px; height: 30px; object-fit: contain; filter: brightness(0) invert(1); }
.left-brand-name {
    font-family: 'Sora', sans-serif;
    font-size: 1.1rem; font-weight: 800;
    color: white; letter-spacing: .02em;
}

.left-copy { position: relative; z-index: 2; }
.left-copy-title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: white;
    line-height: 1.2;
    margin-bottom: 1rem;
}
.left-copy-title span {
    color: var(--acento);
}
.left-copy-sub {
    font-size: .92rem;
    color: rgba(255,255,255,.65);
    line-height: 1.65;
    max-width: 320px;
}

/* Tarjetas de características */
.left-features {
    position: relative; z-index: 2;
    display: flex; flex-direction: column; gap: .65rem;
}
.left-feat {
    display: flex; align-items: center; gap: .75rem;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: .85rem;
    padding: .65rem .9rem;
    backdrop-filter: blur(4px);
    transition: background .2s;
}
.left-feat:hover { background: rgba(255,255,255,.12); }
.left-feat-ico {
    width: 32px; height: 32px; border-radius: 9px;
    background: rgba(74,222,128,.18);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; color: var(--acento);
    flex-shrink: 0;
}
.left-feat-txt { font-size: .8rem; color: rgba(255,255,255,.8); font-weight: 500; }

/* ── Panel derecho (formulario) ── */
.login-right {
    background: var(--blanco);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    overflow-y: auto;
}

.login-card {
    width: 100%;
    max-width: 390px;
}

/* ── Título del form ── */
.login-form-header { margin-bottom: 2rem; }
.login-form-title {
    font-family: 'Sora', sans-serif;
    font-size: 1.6rem; font-weight: 800;
    color: var(--texto-1);
    letter-spacing: -.02em;
    margin-bottom: .35rem;
}
.login-form-sub { font-size: .87rem; color: var(--texto-3); }

/* ── Form ── */
.login-form { display: flex; flex-direction: column; gap: 1rem; }

.input-group { display: flex; flex-direction: column; gap: .3rem; }
.input-label {
    font-size: .77rem; font-weight: 600;
    color: var(--texto-2);
    display: flex; align-items: center; gap: .35rem;
    text-transform: uppercase; letter-spacing: .05em;
}
.input-label i { color: var(--verde); font-size: .75rem; }

.input-field {
    padding: .82rem 1rem;
    border: 1.5px solid var(--verde-borde);
    border-radius: .85rem;
    font-size: .92rem; font-family: 'DM Sans', sans-serif;
    color: var(--texto-1); background: var(--gris-fondo);
    outline: none; width: 100%;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-field:focus {
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(30,74,30,.1);
    background: white;
}
.input-field::placeholder { color: #a8bfa8; }

.pw-wrap { position: relative; }
.pw-wrap .input-field { padding-right: 2.8rem; }
.pw-eye {
    position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: #a8bfa8; font-size: .82rem; transition: color .15s;
}
.pw-eye:hover { color: var(--verde); }

.btn-login {
    display: flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .9rem;
    background: var(--verde); color: white; border: none;
    border-radius: .85rem;
    font-size: .95rem; font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(30,74,30,.35);
    transition: background .2s, transform .15s, box-shadow .2s;
    margin-top: .4rem;
    position: relative; overflow: hidden;
}
.btn-login::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,.08), transparent);
}
.btn-login:hover {
    background: var(--verde-claro);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(30,74,30,.42);
}
.btn-login:active { transform: scale(.97); }

/* ── Divisor ── */
.divisor {
    display: flex; align-items: center; gap: .65rem;
    margin: 1.5rem 0 1rem;
}
.divisor span { flex: 1; height: 1px; background: var(--verde-borde); }
.divisor small {
    font-size: .7rem; color: var(--texto-3);
    font-weight: 600; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
}

/* ── Selector biométrico ── */
.bio-selector {
    display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
    margin-bottom: .85rem;
}
.bio-tab {
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .6rem .5rem;
    border-radius: .85rem;
    border: 1.5px solid var(--verde-borde);
    background: var(--gris-fondo);
    font-size: .81rem; font-weight: 600; color: var(--texto-3);
    cursor: pointer; font-family: 'DM Sans', sans-serif;
    transition: all .18s;
}
.bio-tab i { font-size: .95rem; }
.bio-tab:hover { border-color: var(--verde); color: var(--verde); background: var(--verde-suave); }
.bio-tab-active {
    background: var(--verde); color: white; border-color: var(--verde);
    box-shadow: 0 4px 12px rgba(30,74,30,.28);
}
.bio-tab-active:hover { background: var(--verde-claro); }

/* ── Botón biométrico ── */
.bio-panel { margin-bottom: .25rem; }

.btn-bio {
    width: 100%;
    display: flex; align-items: center; gap: .9rem;
    padding: .85rem 1rem;
    border-radius: 1rem;
    border: 1.5px solid var(--verde-borde);
    background: var(--gris-fondo);
    cursor: pointer; font-family: 'DM Sans', sans-serif;
    transition: all .22s;
    position: relative;
}
.btn-bio:hover {
    border-color: var(--verde);
    background: white;
    box-shadow: 0 6px 18px rgba(30,74,30,.1);
    transform: translateY(-1px);
}
.btn-bio:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.bio-icon-wrap {
    width: 48px; height: 48px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; border: 1.5px solid;
    transition: all .2s;
}
.bio-icon-huella { background: #e3f2e3; border-color: var(--verde-borde); color: var(--verde); }
.bio-icon-facial  { background: #f0eeff; border-color: #d4c8f8; color: #6d28d9; }

.bio-svg { width: 30px; height: 30px; transition: color .2s; }

.bio-label { text-align: left; flex: 1; }
.bio-tit { display: block; font-size: .87rem; font-weight: 700; color: var(--texto-1); line-height: 1.2; }
.bio-sub { display: block; font-size: .72rem; color: var(--texto-3); margin-top: .06rem; }

/* Flecha indicador */
.btn-bio::after {
    content: '→';
    position: absolute; right: 1rem;
    color: var(--texto-3); font-size: .85rem;
    transition: transform .2s, color .2s;
}
.btn-bio:hover::after { transform: translateX(3px); color: var(--verde); }
.btn-bio:disabled::after { display: none; }

/* ═══════════════════════════════════════
   CÁMARA FACIAL
═══════════════════════════════════════ */
.cam-wrap {
    border-radius: 1rem; overflow: hidden;
    margin-bottom: .85rem;
    position: relative; background: #080808;
    box-shadow: 0 6px 20px rgba(0,0,0,.22);
    border: 1.5px solid #1a1a1a;
}
.cam-video { width: 100%; height: 185px; object-fit: cover; display: block; }

.cam-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

.cam-oval { width: 110px; height: 142px; position: relative; }
.cam-oval-ring {
    position: absolute; inset: 0;
    border: 2px solid rgba(255,255,255,.5);
    border-radius: 50%;
    transition: border-color .3s, box-shadow .3s;
}
.cam-scan-bar {
    position: absolute; left: 6%; right: 6%; height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,.9), transparent);
    animation: camScan 2s ease-in-out infinite;
}
@keyframes camScan { 0%{top:5%;opacity:0;} 8%{opacity:1;} 92%{opacity:1;} 100%{top:95%;opacity:0;} }

.cam-corner { position: absolute; width: 13px; height: 13px; border: 2px solid white; }
.cam-c-tl { top:-2px;left:-2px;  border-right:none;border-bottom:none;border-radius:3px 0 0 0; }
.cam-c-tr { top:-2px;right:-2px; border-left:none; border-bottom:none;border-radius:0 3px 0 0; }
.cam-c-bl { bottom:-2px;left:-2px;  border-right:none;border-top:none;border-radius:0 0 0 3px; }
.cam-c-br { bottom:-2px;right:-2px; border-left:none; border-top:none;border-radius:0 0 3px 0; }

.cam-lm {
    position: absolute;
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(74,222,128,.9);
    transform: translate(-50%,-50%);
    box-shadow: 0 0 6px rgba(74,222,128,.8);
    opacity: 0; transition: opacity .3s;
}
.oval-activo .cam-oval-ring { border-color: rgba(74,222,128,.8) !important; box-shadow: 0 0 14px rgba(74,222,128,.25); }
.oval-activo .cam-lm {
    opacity: 1;
    animation: lmPulse 1.3s ease-in-out infinite;
}
.oval-activo .cam-lm:nth-child(4){animation-delay:.15s;}
.oval-activo .cam-lm:nth-child(5){animation-delay:.3s;}
.oval-activo .cam-lm:nth-child(6){animation-delay:.45s;}
.oval-activo .cam-lm:nth-child(7){animation-delay:.6s;}
.oval-activo .cam-lm:nth-child(8){animation-delay:.75s;}
.oval-activo .cam-lm:nth-child(9){animation-delay:.9s;}
@keyframes lmPulse { 0%,100%{opacity:1;transform:translate(-50%,-50%) scale(1);}50%{opacity:.1;transform:translate(-50%,-50%) scale(.35);} }

.cam-instr {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.65);
    color: rgba(255,255,255,.9); font-size: .74rem; font-weight: 600;
    text-align: center; padding: .45rem;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: .01em;
}

/* ═══════════════════════════════════════
   ESTADOS BIOMÉTRICOS
═══════════════════════════════════════ */
.bio-estado-scanning   { background:#dbeafe!important; border-color:#93c5fd!important; color:#2563eb!important; }
.bio-estado-esperando  { background:#dbeafe!important; border-color:#93c5fd!important; color:#2563eb!important; }
.bio-estado-scanning .bio-svg,
.bio-estado-esperando .bio-svg { animation: svgPulse 1.5s ease-in-out infinite; }

.bio-estado-verifying  { background:#fef9c3!important; border-color:#fde68a!important; color:#b45309!important; }
.bio-estado-verificando{ background:#fef9c3!important; border-color:#fde68a!important; color:#b45309!important; }
.bio-estado-verifying .bio-svg,
.bio-estado-verificando .bio-svg { animation: svgVerify .9s ease-in-out infinite; }

.bio-estado-exito      { background:#dcfce7!important; border-color:#86efac!important; color:#16a34a!important; }
.bio-estado-success    { background:#dcfce7!important; border-color:#86efac!important; color:#16a34a!important; }
.bio-estado-exito .bio-svg,
.bio-estado-success .bio-svg { animation: svgBounce .4s cubic-bezier(.34,1.56,.64,1); }

.bio-estado-error      { background:#fee2e2!important; border-color:#fca5a5!important; color:#dc2626!important; }
.bio-estado-error .bio-svg { animation: svgShake .4s ease; }

/* Animar líneas de huella */
.bio-estado-scanning .scan-line,
.bio-estado-esperando .scan-line  { opacity:1!important; stroke:#2563eb; animation:scanAnim 1.4s ease-in-out infinite; }
.bio-estado-scanning .track-line,
.bio-estado-esperando .track-line { opacity:1!important; stroke:#2563eb; animation:scanAnim 1.4s ease-in-out infinite; }

@keyframes svgPulse   { 0%,100%{opacity:1;transform:scale(1);}50%{opacity:.65;transform:scale(1.06);} }
@keyframes svgVerify  { 0%,100%{opacity:1;}50%{opacity:.5;} }
@keyframes svgBounce  { 0%{transform:scale(.6);}70%{transform:scale(1.12);}100%{transform:scale(1);} }
@keyframes svgShake   { 0%,100%{transform:translateX(0);}25%{transform:translateX(-6px);}75%{transform:translateX(6px);} }
@keyframes scanAnim   { 0%{opacity:0;}10%{opacity:1;}90%{opacity:1;}100%{opacity:0;} }

/* ═══════════════════════════════════════
   MENSAJES
═══════════════════════════════════════ */
.login-estado {
    padding: .7rem 1rem;
    border-radius: .85rem;
    font-size: .82rem; font-weight: 500;
    text-align: center;
    margin-top: .75rem;
    border: 1px solid;
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.login-estado-ok    { background:#f0fdf4; color:#15803d; border-color:#86efac; }
.login-estado-error { background:#fee2e2; color:#b91c1c; border-color:#fca5a5; }
.login-estado-warn  { background:#fef9c3; color:#92400e; border-color:#fde68a; }

/* ── Links ── */
.login-links { text-align: center; margin-top: 1.25rem; }
.login-link {
    font-size: .79rem; color: var(--texto-3);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: .3rem;
    transition: color .15s;
}
.login-link:hover { color: var(--verde); }

/* ═══════════════════════════════════════
   RESPONSIVE — colapsa a una columna
═══════════════════════════════════════ */
@media (max-width: 820px) {
    .login-bg { grid-template-columns: 1fr; }
    .login-left { display: none; }
    .login-right { padding: 2.5rem 1.5rem; min-height: 100vh; }
}
@media (max-width: 480px) {
    .login-right { padding: 2rem 1.25rem; }
    .login-form-title { font-size: 1.35rem; }
    .cam-video { height: 160px; }
    .bio-selector { grid-template-columns: 1fr 1fr; }
}