/* ===========================
   VARIABLES & RESET
   =========================== */
:root {
    --primary:    #1e3a5f;
    --primary-lt: #2c5282;
    --accent:     #3182ce;
    --success:    #276749;
    --success-lt: #38a169;
    --danger:     #c53030;
    --danger-lt:  #e53e3e;
    --warning:    #b7791f;
    --warning-bg: #fffbeb;
    --light:      #edf2f7;
    --border:     #e2e8f0;
    --text:       #2d3748;
    --text-muted: #718096;
    --white:      #ffffff;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.05);
    --radius:     10px;
    --radius-sm:  6px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f7fafc;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ===========================
   NAVBAR
   =========================== */
.navbar {
    background: var(--primary);
    padding: .75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.nav-toggle {
    display: none;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 1.3rem;
    padding: .35rem .65rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}
.nav-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    padding: 0 .5rem;
    display: none;        /* sólo visible en mobile */
}
.nav-group {
    display: flex;
    align-items: center;
    gap: .2rem;
    border-right: 1px solid rgba(255,255,255,.15);
    padding-right: .5rem;
    margin-right: .25rem;
}
.nav-group:last-of-type { border-right: none; }
.nav-links a {
    color: rgba(255,255,255,.82);
    font-size: .875rem;
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-links a:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: .5rem;
    padding-left: .75rem;
    border-left: 1px solid rgba(255,255,255,.15);
}
.nav-username {
    color: rgba(255,255,255,.7);
    font-size: .82rem;
    white-space: nowrap;
}
.btn-logout {
    background: rgba(197,48,48,.35);
    color: #feb2b2 !important;
    padding: .35rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 600;
    transition: background .15s;
}
.btn-logout:hover { background: var(--danger-lt) !important; color: #fff !important; }

/* ELECCIÓN BANNER */
.eleccion-bar {
    background: var(--primary-lt);
    color: rgba(255,255,255,.85);
    text-align: center;
    font-size: .82rem;
    padding: .35rem 1rem;
    letter-spacing: .01em;
}
.eleccion-bar strong { color: #fff; }

/* MOBILE NAV */
@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--primary-lt);
        flex-direction: column;
        align-items: stretch;
        padding: .75rem 1rem 1rem;
        gap: .2rem;
        box-shadow: var(--shadow);
    }
    .nav-links.open { display: flex; }
    .nav-group {
        flex-direction: column;
        align-items: stretch;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,.1);
        padding: 0 0 .5rem;
        margin: 0 0 .5rem;
    }
    .nav-section { display: block; padding: .3rem 0 .1rem; }
    .nav-links a { padding: .55rem .5rem; font-size: .95rem; }
    .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,.1);
        padding-top: .5rem;
        margin-top: .25rem;
        justify-content: space-between;
    }
    .nav-username { font-size: .9rem; }
}

/* ===========================
   LAYOUT
   =========================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    flex: 1;
}

/* ===========================
   GRIDS
   =========================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ===========================
   CARDS
   =========================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--light);
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* STAT CARDS */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--accent);
    text-align: center;
}
.stat-card.green  { border-top-color: var(--success-lt); }
.stat-card.orange { border-top-color: #ed8936; }
.stat-card.red    { border-top-color: var(--danger-lt); }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-label  { font-size: .82rem; color: var(--text-muted); margin-top: .3rem; }

/* ===========================
   PAGE HEADER
   =========================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--primary); }

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.1rem;
    font-weight: 500;
    font-size: .95rem;
}
.alert-success { background: #f0fff4; color: var(--success); border-left: 4px solid var(--success-lt); }
.alert-error   { background: #fff5f5; color: var(--danger);  border-left: 4px solid var(--danger-lt); }

/* ===========================
   FORMS
   =========================== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    color: #4a5568;
    margin-bottom: .35rem;
}
.form-control {
    width: 100%;
    padding: .6rem .9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .97rem;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
    color: var(--text);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}
select.form-control { cursor: pointer; }

/* ===========================
   BUTTONS
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s, transform .1s;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover  { filter: brightness(.92); }

.btn-primary   { background: var(--accent);      color: #fff; }
.btn-success   { background: var(--success-lt);  color: #fff; }
.btn-danger    { background: var(--danger-lt);   color: #fff; }
.btn-secondary { background: #a0aec0;            color: #fff; }
.btn-outline   { background: transparent; border: 2px solid var(--accent); color: var(--accent); }

.btn-sm    { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; padding: .75rem; font-size: 1rem; }

/* ===========================
   TABLES
   =========================== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table th {
    background: var(--primary);
    color: rgba(255,255,255,.9);
    padding: .65rem 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tbody tr:hover td { background: #f7fafc; }
table tbody tr:last-child td { border-bottom: none; }
.td-actions { white-space: nowrap; display: flex; gap: .4rem; }

/* ===========================
   BADGES & STATUS
   =========================== */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
}
.status-ok  { background: #c6f6d5; color: var(--success); font-weight:700; font-size:.78rem; padding:.2rem .65rem; border-radius:20px; }
.status-pend{ background: #fefcbf; color: #744210;         font-weight:700; font-size:.78rem; padding:.2rem .65rem; border-radius:20px; }

/* ===========================
   PROGRESS BARS
   =========================== */
.prog-wrap {
    background: var(--light);
    border-radius: 20px;
    height: 22px;
    overflow: hidden;
}
.prog-bar {
    height: 100%;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    min-width: 38px;
    transition: width .5s ease;
}
.result-row {
    margin-bottom: 1.1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .45rem;
    flex-wrap: wrap;
    gap: .3rem;
}
.result-name {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 600;
}
.dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.result-votes { text-align: right; }
.result-votes strong { font-size: 1.1rem; }
.result-votes small  { color: var(--text-muted); font-size: .82rem; }

/* Winner highlight */
.winner-box {
    background: #fffff0;
    border: 1px solid #f6e05e;
    border-radius: var(--radius-sm);
    padding: .75rem;
    margin-bottom: 1.1rem;
}

/* ===========================
   VOTE INPUT CARD
   =========================== */
.voto-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: .75rem;
    border-left: 5px solid var(--accent);
}
.voto-card .lista-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.voto-card .lista-name { flex: 1; font-weight: 600; font-size: 1rem; }
.voto-card input[type=number] {
    width: 110px;
    padding: .55rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    transition: border-color .15s;
}
.voto-card input[type=number]:focus { outline: none; border-color: var(--accent); }

/* ===========================
   LOGIN
   =========================== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 1.5rem;
}
.login-card {
    background: var(--white);
    border-radius: 14px;
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-icon  { text-align: center; font-size: 3rem; margin-bottom: .5rem; }
.login-title { text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: .25rem; }
.login-sub   { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 1.75rem; }

/* ===========================
   TABS
   =========================== */
.tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    padding-bottom: 2px;
}
.tab-link {
    padding: .55rem 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .9rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.tab-link:hover  { color: var(--accent); }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===========================
   INFO BOXES
   =========================== */
.info-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #ebf8ff;
    color: #2b6cb0;
    padding: .35rem .9rem;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 600;
}

/* ===========================
   FOOTER
   =========================== */
footer {
    text-align: center;
    padding: 1rem;
    background: var(--primary);
    color: rgba(255,255,255,.4);
    font-size: .82rem;
}

/* ===========================
   UTILITIES
   =========================== */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.flex-gap { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
