/* VoterBloc Admin — Design System */

:root {
    /* Primary */
    --primary: #2D5BE3;
    --primary-light: #EBF0FC;
    --primary-dark: #1E3FA6;

    /* Text */
    --text-primary: #2D2420;
    --text-secondary: #4A3F3A;
    --text-tertiary: #7A6E67;
    --text-muted: #A89E98;

    /* Backgrounds */
    --bg: #FAF7F5;
    --surface: #FFFFFF;
    --surface-secondary: #F5F0ED;

    /* Borders */
    --border: #E0D8D3;
    --border-light: #EDE8E4;

    /* Status */
    --success: #4A7C59;
    --success-light: #EAF2EC;
    --error: #B5362A;
    --error-light: #FCEEED;
    --warning: #D4943A;
    --warning-light: #FDF5EA;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-xxl: 24px;
    --space-xxxl: 40px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--text-primary);
    color: white;
    padding: var(--space-xl);
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-xxxl);
    color: white;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.sidebar-nav li { margin-bottom: var(--space-xs); }

.main-content {
    flex: 1;
    padding: var(--space-xxxl);
    max-width: 1200px;
}

/* Page header */
.page-header {
    margin-bottom: var(--space-xxl);
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xxl);
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xxl);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th {
    text-align: left;
    padding: var(--space-md) var(--space-xl);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-light);
}

.table-card td {
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-secondary);
}

.table-card tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.badge-api { background: var(--primary-light); color: var(--primary); }
.badge-bulk { background: var(--success-light); color: var(--success); }
.badge-manual { background: var(--warning-light); color: var(--warning); }
.badge-user { background: var(--surface-secondary); color: var(--text-tertiary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error { background: #fde8e8; color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-disabled { background: var(--surface-secondary); color: var(--text-tertiary); }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    padding: var(--space-xxxl);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: var(--space-sm);
}

.login-card .subtitle {
    color: var(--text-tertiary);
    margin-bottom: var(--space-xxl);
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 16px;
    color: var(--text-primary);
    background: var(--surface);
    margin-bottom: var(--space-lg);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

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

/* Alerts */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 14px;
}

.alert-error { background: var(--error-light); color: var(--error); }
.alert-success { background: var(--success-light); color: var(--success); }

/* Buttons — small & ghost variants */
.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 13px;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--surface-secondary);
}

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

.btn-sm:not(.btn-ghost):hover {
    background: var(--primary-dark);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress bar */
.progress-bar {
    display: none;
    margin-top: var(--space-xs);
}

.progress-bar.active {
    display: block;
}

.progress-track {
    height: 6px;
    background: var(--surface-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-fill.indeterminate {
    width: 30%;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.progress-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}
