/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
}

.header nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

/* ===== MAIN ===== */
.main {
    flex: 1;
    padding: 40px 0;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ===== POLL CARDS ===== */
.polls-grid {
    display: grid;
    gap: 20px;
}

.poll-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.poll-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08);
}

.poll-inactive {
    opacity: 0.75;
}

.poll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.poll-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.poll-title a {
    color: var(--text);
    text-decoration: none;
}

.poll-title a:hover {
    color: var(--primary);
}

.poll-desc {
    color: var(--text-muted);
    margin-bottom: 14px;
    font-size: 0.95rem;
}

.poll-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.poll-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background: #f1f5f9;
    color: #64748b;
}

/* ===== FORMS ===== */
.form-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== VOTE OPTIONS ===== */
.vote-instruction {
    font-weight: 600;
    margin-bottom: 16px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-item:hover {
    border-color: var(--primary);
    background: #f5f3ff;
}

.option-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.option-text {
    font-size: 1.05rem;
}

/* ===== RESULTS ===== */
.results-summary {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-item {
    /* nothing special */
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.result-text {
    font-weight: 500;
}

.result-stats {
    color: var(--text-muted);
    font-size: 0.95rem;
    white-space: nowrap;
}

.progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 6px;
    transition: width 0.6s ease;
}

.no-votes {
    text-align: center;
    color: var(--text-muted);
    padding: 20px 0;
}

.results-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .header .container {
        flex-direction: column;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .form-card {
        padding: 20px;
    }

    .results-summary {
        gap: 20px;
    }
}
/* ===== AUTH ===== */
.auth-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.demo-creds {
    margin-top: 20px;
    padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

.demo-creds code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text);
}

/* ===== NAV USER ===== */
.nav-user {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-admin {
    background: #7c3aed;
    color: white;
}

.btn-admin:hover {
    background: #6d28d9;
}

/* ===== ADMIN ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 18px;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.admin-table a:hover {
    text-decoration: underline;
}

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge-admin {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-user {
    background: #f1f5f9;
    color: #64748b;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .header nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===== VOTERS IN RESULTS ===== */
.voters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.voter-tag {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* ===== SEARCH & PAGINATION ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.search-bar .form-control {
    flex: 1;
    min-width: 200px;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
}
.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== CREATE FORM ===== */
.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.radio-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.radio-chip:has(input:checked) {
    border-color: var(--primary);
    background: #f5f3ff;
}
.radio-chip input {
    accent-color: var(--primary);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}
.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ===== BADGES EXTRA ===== */
.badge-type {
    background: #e0e7ff;
    color: #3730a3;
}
.badge-anon {
    background: #fef3c7;
    color: #92400e;
}
.deadline-info {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.live-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== QR ===== */
.qr-block {
    text-align: center;
}
.qr-block img {
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ===== TEXT ANSWERS ===== */
.text-answers-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.text-answer-item {
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.text-answer-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.text-answer-item p {
    margin: 0;
    white-space: pre-wrap;
}

/* ===== PROFILE ===== */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 1rem;
}
