/* ==========================================================================
   Flujo de votantes - Sistema de Votaciones CIC SENA
   Estilos mobile-first para: inicio, login, correo, token, tarjetón y cierre
   ========================================================================== */

:root {
    
    
    --sena-green: #39A900;
    --sena-green-dark: #2C7A00;
    --ink: #1f2937;
    --muted: #6b7280;
    --border: #d7dbe3;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.votante {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    font-size: 16px;
    background: linear-gradient(rgba(10, 20, 40, .74), rgba(10, 20, 40, .74)),
                url("../img/sena.jpg") center / cover no-repeat fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
}

/* Permite desplazamiento (tarjetón, listados largos) */
body.votante.votante-top { align-items: flex-start; }

/* --------------------------------------------------------------------------
   Tarjeta de formulario (login, correo, token)
   -------------------------------------------------------------------------- */
.votante-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, .97);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
    overflow: hidden;
}

.votante-head { text-align: center; padding: 28px 22px 4px; }
.votante-head img { height: 62px; width: auto; }
.votante-title { font-size: 1.3rem; font-weight: 700; margin: 12px 0 2px; }
.votante-sub { color: var(--muted); font-size: .9rem; margin: 0; }

.votante-body { padding: 18px 24px 26px; }
.votante-foot { text-align: center; padding: 0 24px 22px; color: var(--muted); font-size: .82rem; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field .form-control,
.field input[type="text"],
.field input[type="email"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 13px;
    font-size: 1rem;
    height: auto;
    background: #fff;
}
.field .form-control:focus,
.field input:focus {
    outline: none;
    border-color: var(--sena-green);
    box-shadow: 0 0 0 3px rgba(57, 169, 0, .15);
}

.hint { font-size: .92rem; color: var(--muted); text-align: center; margin: 0 0 16px; }

/* Botones */
.btn-votante {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 13px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--sena-green);
    cursor: pointer;
}
.btn-votante:hover { background: var(--sena-green-dark); }

.btn-ghost {
    display: block;
    width: 100%;
    text-align: center;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    color: var(--ink);
    background: #eef1f6;
    text-decoration: none;
    margin-top: 10px;
}
.btn-ghost:hover { background: #e2e7ef; color: var(--ink); }

/* Errores de validacion por campo (JS, sin depender de HTML5) */
.field-error { color: #b3261e; font-size: .82rem; margin: 6px 0 0; }
.field-error:empty { display: none; }
.field input.is-invalid { border-color: #b3261e; box-shadow: 0 0 0 3px rgba(179, 38, 30, .12); }

/* Alertas */
.alert-votante { border-radius: 10px; padding: 11px 13px; font-size: .9rem; margin-bottom: 14px; }
.alert-error { background: #fdecea; color: #b3261e; }
.alert-warn { background: #fff4e5; color: #8a5300; }
.alert-info { background: #e8f0fe; color: #1a4b8c; }

/* Jornadas activas en una sola línea compacta (sin ocupar espacio vertical) */
.jornada-linea {
    margin: 0 0 14px;
    padding: 6px 12px;
    background: #e8f0fe;
    color: #1a4b8c;
    border-radius: 8px;
    font-size: .82rem;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jornada-linea i { font-size: .45rem; vertical-align: middle; margin-right: 4px; }

/* --------------------------------------------------------------------------
   Acceso al panel administrativo (logo superior derecho)
   -------------------------------------------------------------------------- */
.admin-access {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, .94);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    text-decoration: none;
    color: var(--ink);
    font-size: .82rem;
    font-weight: 700;
}
.admin-access img { height: 30px; width: auto; display: block; }
.admin-access:hover { background: #fff; color: var(--sena-green); }
.admin-access-text { line-height: 1; }

/* --------------------------------------------------------------------------
   Pantalla de bienvenida (hero)
   -------------------------------------------------------------------------- */
.hero { text-align: center; color: #fff; max-width: 760px; width: 100%; }
.hero-logo { height: 88px; width: auto; margin-bottom: 12px; }
.hero h1 { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px; line-height: 1.15; }
.hero h2 { font-size: 1.05rem; font-weight: 400; opacity: .92; margin: 0 0 20px; }
.hero-meta {
    display: inline-block;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 14px;
    padding: 14px 22px;
    margin-bottom: 24px;
}
.hero-meta h3 { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; }
.hero-meta p { margin: 0; opacity: .95; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-hero {
    border: 0;
    border-radius: 12px;
    padding: 14px 24px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-hero.primary { background: var(--sena-green); color: #fff; }
.btn-hero.primary:hover { background: var(--sena-green-dark); color: #fff; }
.btn-hero.secondary { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .45); }
.btn-hero.secondary:hover { background: rgba(255, 255, 255, .28); color: #fff; }

/* --------------------------------------------------------------------------
   Tarjetón
   -------------------------------------------------------------------------- */
.tarjeton-wrap { width: 100%; max-width: 1120px; }
.tarjeton-header { text-align: center; color: #fff; margin-bottom: 24px; }
.tarjeton-header img { height: 56px; width: auto; }
.tarjeton-header h1 { font-size: 1.4rem; margin: 10px 0 0; font-weight: 700; }

.jornada-block { margin-bottom: 30px; }
.jornada-title {
    background: var(--sena-green);
    color: #fff;
    border-radius: 12px;
    padding: 11px 18px;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 16px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}

.cand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.cand-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    transition: transform .15s ease, box-shadow .15s ease;
    display: flex;
    flex-direction: column;
}
.cand-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); }

.cand-photo {
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    object-fit: contain;   /* muestra la foto completa, sin recortes ni deformación */
    background: #f3f5f9;
    display: block;
}
.cand-body { padding: 12px 14px 16px; text-align: center; display: flex; flex-direction: column; flex: 1; }
.cand-code {
    align-self: center;
    background: var(--sena-green);
    color: #fff;
    border-radius: 999px;
    padding: 2px 12px;
    font-size: .78rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.cand-name { font-weight: 700; font-size: 1rem; margin: 0 0 4px; }
.cand-jornada { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.cand-btn {
    margin-top: auto;
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--sena-green);
    cursor: pointer;
}
.cand-btn:hover { background: var(--sena-green-dark); }

.empty-note {
    background: rgba(255, 255, 255, .96);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    color: #b3261e;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

/* --------------------------------------------------------------------------
   Ajustes de modales usados en estas pantallas
   -------------------------------------------------------------------------- */
.modal-content { border-radius: 14px; overflow: hidden; }
.modal-header .btn-close {
    opacity: .9;
    filter: invert(1) grayscale(100%) brightness(200%);
}
.modal-header .btn-close:hover { opacity: 1; }

/* SweetAlert2 con identidad institucional */
.swal2-popup {
    border-radius: 16px;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.swal2-title { color: var(--ink); font-weight: 700; }
.swal2-styled.swal2-confirm { background-color: var(--sena-green) !important; }
.swal2-styled.swal2-confirm:hover { background-color: var(--sena-green-dark) !important; }
.swal2-styled.swal2-confirm:focus { box-shadow: 0 0 0 3px rgba(57, 169, 0, .35) !important; }
.swal2-styled.swal2-cancel { background-color: #6b7280 !important; }
.swal2-styled.swal2-cancel:focus { box-shadow: 0 0 0 3px rgba(107, 114, 128, .35) !important; }
.manual-frame {
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 320px;
    border: 0;
    background: #f3f5f9;
}
.md-form { margin-bottom: 14px; }
.md-form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.md-form .form-control { border-radius: 9px; border: 1px solid var(--border); height: auto; padding: 10px 12px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 576px) {
    body.votante { padding: 16px 12px; }
    .votante-card { max-width: 100%; border-radius: 14px; }
    .hero h1 { font-size: 1.6rem; }
    .hero-logo { height: 66px; }
    .tarjeton-header h1 { font-size: 1.15rem; }
    .cand-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .cand-photo { aspect-ratio: 1 / 1; }
    .cand-name { font-size: .92rem; }
}
