/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    background: #F0F4FF;
    color: #1F2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== LAYOUT ===== */
.wrapper { max-width: 700px; margin: 0 auto; padding: 0 16px; width: 100%; }
.wrapper--wide { max-width: 960px; }
main { flex: 1; padding: 32px 0; }

/* ===== HEADER ===== */
.site-header {
    background: #1E3A5F;
    color: #fff;
    padding: 18px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.site-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.3px; }
.site-header p  { font-size: .9rem; opacity: .8; margin-top: 4px; }

/* ===== FOOTER ===== */
.site-footer {
    background: #1E3A5F;
    color: rgba(255,255,255,.6);
    text-align: center;
    padding: 18px;
    font-size: .78rem;
    line-height: 1.6;
}
.site-footer a { color: rgba(255,255,255,.8); }

/* ===== CARD ===== */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: 20px;
}
.card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1E3A5F;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #E5E7EB;
}

/* ===== ALERT ===== */
.alert {
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: .9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert--info    { background: #EBF2FF; color: #1E40AF; border-left: 4px solid #2563EB; }
.alert--success { background: #D1FAE5; color: #065F46; border-left: 4px solid #10B981; }
.alert--warning { background: #FEF3C7; color: #92400E; border-left: 4px solid #F59E0B; }
.alert--error   { background: #FEE2E2; color: #991B1B; border-left: 4px solid #EF4444; }

/* ===== FORM ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    font-size: .95rem;
    color: #1F2937;
    background: #fff;
    transition: border-color .15s;
    appearance: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-hint { font-size: .8rem; color: #6B7280; margin-top: 5px; }

/* ===== VOTE CHOICES ===== */
.choices-list { list-style: none; }
.choice-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #FAFAFA;
    transition: border-color .15s, background .15s;
}
.choice-item:hover { border-color: #2563EB; background: #F0F4FF; }
.choice-name { flex: 1; font-weight: 600; color: #1F2937; font-size: 1rem; }
.choice-input {
    width: 80px;
    padding: 8px 12px;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
}
.choice-input:focus { outline: none; border-color: #2563EB; }

/* ===== VOTE COUNTER ===== */
.vote-counter {
    background: #1E3A5F;
    color: #fff;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: .95rem;
}
.vote-counter__remaining {
    font-size: 1.4rem;
    font-weight: 800;
    color: #93C5FD;
}
.vote-counter--error { background: #991B1B; }
.vote-counter--ok    { background: #065F46; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    line-height: 1;
}
.btn:active { transform: scale(.98); }
.btn--primary   { background: #2563EB; color: #fff; }
.btn--primary:hover { background: #1D4ED8; }
.btn--secondary { background: #F3F4F6; color: #374151; border: 1.5px solid #D1D5DB; }
.btn--secondary:hover { background: #E5E7EB; }
.btn--danger    { background: #EF4444; color: #fff; }
.btn--danger:hover { background: #DC2626; }
.btn--success   { background: #10B981; color: #fff; }
.btn--full      { width: 100%; }
.btn:disabled   { opacity: .5; cursor: not-allowed; }

/* ===== CODE INPUT ===== */
.code-input {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 12px;
    text-align: center;
    width: 100%;
    padding: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 10px;
    color: #2563EB;
}
.code-input:focus { border-color: #2563EB; outline: none; }

/* ===== ADMIN NAV ===== */
.admin-nav {
    background: #1E3A5F;
    padding: 0;
}
.admin-nav__bar {
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: auto;
}
.admin-nav__brand {
    color: #fff;
    font-weight: 800;
    font-size: .95rem;
    padding: 16px 16px 16px 0;
    white-space: nowrap;
    margin-right: 8px;
    border-right: 1px solid rgba(255,255,255,.2);
}
.admin-nav__link {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    padding: 16px 14px;
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
}
.admin-nav__link:hover     { color: #fff; }
.admin-nav__link--active   { color: #fff; border-bottom-color: #60A5FA; }
.admin-nav__logout {
    margin-left: auto;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: .82rem;
    padding: 16px 0 16px 14px;
}
.admin-nav__logout:hover { color: #fff; }

/* ===== ADMIN TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #E5E7EB; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
    padding: 10px 18px;
    font-size: .88rem;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tab:hover { color: #1E3A5F; background: #F3F4F6; }
.tab--active { color: #2563EB; border-bottom-color: #2563EB; background: #EBF2FF; }
.tab-panel { display: none; }
.tab-panel--active { display: block; }

/* ===== TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th {
    background: #1E3A5F;
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-size: .82rem;
    font-weight: 700;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #F3F4F6;
    color: #374151;
    vertical-align: middle;
}
.data-table tr:nth-child(even) td { background: #F9FAFB; }
.data-table tr:hover td { background: #EBF2FF; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.stat-card__value { font-size: 2rem; font-weight: 800; color: #2563EB; }
.stat-card__label { font-size: .8rem; color: #6B7280; margin-top: 4px; font-weight: 600; }
.stat-card--success .stat-card__value { color: #10B981; }
.stat-card--warning .stat-card__value { color: #F59E0B; }
.stat-card--error   .stat-card__value { color: #EF4444; }

/* ===== BADGE ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 700;
}
.badge--confirmed { background: #D1FAE5; color: #065F46; }
.badge--pending   { background: #FEF3C7; color: #92400E; }
.badge--cancelled { background: #F3F4F6; color: #6B7280; }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 10px; background: #E5E7EB; border-radius: 5px; overflow: hidden; }
.progress-bar__fill { height: 100%; background: #2563EB; border-radius: 5px; transition: width .3s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .card { padding: 20px 16px; }
    .choice-item { flex-wrap: wrap; }
    .site-header h1 { font-size: 1.1rem; }
    .admin-nav__link { padding: 12px 10px; font-size: .8rem; }
}
