/* ═══════════════════════════════════════════════════════
   VOTER MANAGEMENT SYSTEM — Premium Design System
   ═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    /* Primary Palette */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Emerald Accent */
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;

    /* Amber Accent */
    --amber-50: #fffbeb;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;

    /* Rose Accent */
    --rose-50: #fff1f2;
    --rose-400: #fb7185;
    --rose-500: #f43f5e;
    --rose-600: #e11d48;

    /* Cyan Accent */
    --cyan-400: #22d3ee;
    --cyan-500: #06b6d4;

    /* Neutrals */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Surfaces */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(15, 23, 42, 0.8);

    /* Borders */
    --border-subtle: rgba(148, 163, 184, 0.1);
    --border-medium: rgba(148, 163, 184, 0.15);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-600); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-500); }

/* ── Page System ── */
.page {
    display: none;
    min-height: 100vh;
    animation: fadeSlideIn 0.5s ease;
}
.page.active { display: block; }

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════ */
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
        var(--bg-primary);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.login-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary-400);
    opacity: 0;
    animation: particleFloat 8s infinite;
}

@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    10% { opacity: 0.6; }
    90% { opacity: 0.2; }
    100% { opacity: 0; transform: translateY(-20vh) scale(1); }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    animation: cardAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardAppear {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    padding: 36px 32px 20px;
    text-align: center;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 20px 8px rgba(99, 102, 241, 0.1); }
}

.logo-icon svg { width: 40px; height: 40px; }

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--primary-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-body { padding: 0 32px 24px; }

/* ── Login Tabs ── */
.login-tabs {
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.login-tab:hover { color: var(--text-primary); }

.login-tab.active {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.login-tab svg { flex-shrink: 0; }

/* ── Login Forms ── */
.login-form { display: none; }
.login-form.active { display: block; animation: fadeSlideIn 0.3s ease; }

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper svg {
    margin-right: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: var(--transition-base);
}

.input-wrapper:focus-within svg { color: var(--primary-400); }

.input-wrapper input,
.input-wrapper select {
    flex: 1;
    padding: 12px 14px;
    padding-right: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.input-wrapper input::placeholder { color: var(--text-muted); }

.select-wrapper select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

.toggle-pass {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}
.toggle-pass:hover { color: var(--text-primary); }

.login-error {
    font-size: 0.85rem;
    color: var(--rose-400);
    margin-bottom: 12px;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: 0.5s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.btn-login:hover::before { left: 100%; }

.btn-login:active { transform: translateY(0); }

.login-footer {
    padding: 16px 32px 24px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

.login-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 4px 0;
}
.login-footer strong { color: var(--primary-400); }

/* ═══════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════ */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-logo { width: 40px; height: 40px; }
.nav-logo svg { width: 100%; height: 100%; }

.nav-brand h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.nav-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.enc-role {
    color: var(--emerald-400);
    background: rgba(16, 185, 129, 0.1);
}

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

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.admin-avatar {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
}

.enc-avatar {
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
    color: white;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(244, 63, 94, 0.1);
    color: var(--rose-400);
    border: 1px solid rgba(244, 63, 94, 0.15);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}
.btn-logout:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.3);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════ */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.enc-dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 28px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ── Section Headers ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header h2 svg { color: var(--primary-400); }

.section-actions {
    display: flex;
    gap: 10px;
}

/* ═══════════════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.enc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-smooth);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

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

.stat-wave {
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    opacity: 0.06;
}

/* Card Variants */
.stat-total .stat-icon { background: rgba(99, 102, 241, 0.12); }
.stat-total .stat-icon svg { color: var(--primary-400); }
.stat-total .stat-number { color: var(--primary-400); }
.stat-total .stat-wave { background: var(--primary-500); }
.stat-total { border-right: 3px solid var(--primary-500); }

.stat-encadrants .stat-icon { background: rgba(16, 185, 129, 0.12); }
.stat-encadrants .stat-icon svg { color: var(--emerald-400); }
.stat-encadrants .stat-number { color: var(--emerald-400); }
.stat-encadrants .stat-wave { background: var(--emerald-500); }
.stat-encadrants { border-right: 3px solid var(--emerald-500); }

.stat-today .stat-icon { background: rgba(251, 191, 36, 0.12); }
.stat-today .stat-icon svg { color: var(--amber-400); }
.stat-today .stat-number { color: var(--amber-400); }
.stat-today .stat-wave { background: var(--amber-500); }
.stat-today { border-right: 3px solid var(--amber-500); }

.stat-hour .stat-icon { background: rgba(34, 211, 238, 0.12); }
.stat-hour .stat-icon svg { color: var(--cyan-400); }
.stat-hour .stat-number { color: var(--cyan-400); }
.stat-hour .stat-wave { background: var(--cyan-500); }
.stat-hour { border-right: 3px solid var(--cyan-500); }

.stat-enc-total .stat-icon { background: rgba(16, 185, 129, 0.12); }
.stat-enc-total .stat-icon svg { color: var(--emerald-400); }
.stat-enc-total .stat-number { color: var(--emerald-400); }
.stat-enc-total .stat-wave { background: var(--emerald-500); }
.stat-enc-total { border-right: 3px solid var(--emerald-500); }

.stat-enc-today .stat-icon { background: rgba(99, 102, 241, 0.12); }
.stat-enc-today .stat-icon svg { color: var(--primary-400); }
.stat-enc-today .stat-number { color: var(--primary-400); }
.stat-enc-today .stat-wave { background: var(--primary-500); }
.stat-enc-today { border-right: 3px solid var(--primary-500); }

/* Stat number animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-number.animate { animation: countUp 0.4s ease; }

/* ═══════════════════════════════════════════════════════
   CENTERS
   ═══════════════════════════════════════════════════════ */
.centers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.center-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition-smooth);
    cursor: default;
}

.center-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

.center-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.center-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid;
}

.center-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.center-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.center-enc-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.center-stats-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.center-voter-count {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.center-voter-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.center-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 6px;
}

.center-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.center-percentage {
    font-size: 0.78rem;
    font-weight: 600;
    display: block;
    margin-bottom: 14px;
}

.center-divider {
    height: 1px;
    background: var(--border-subtle);
    margin-bottom: 14px;
}

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

.center-encadrant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.center-encadrant-row:hover {
    background: rgba(15, 23, 42, 0.7);
}

.center-enc-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.center-enc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.center-enc-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.center-enc-count {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════
   ENCADRANT MANAGER
   ═══════════════════════════════════════════════════════ */
.enc-add-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.enc-add-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.enc-add-btn-group {
    margin-bottom: 0;
}

.btn-add-enc {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    height: 46px;
}

.btn-add-enc:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-add-enc:active { transform: translateY(0); }

.enc-voter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-400);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .enc-add-form-grid {
        grid-template-columns: 1fr;
    }
    .btn-add-enc {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════════════════ */
.search-bar { margin-bottom: 16px; }

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 4px 16px;
    transition: var(--transition-base);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), var(--shadow-md);
}

.search-input-wrapper svg {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition-base);
}
.search-input-wrapper:focus-within svg:first-child { color: var(--primary-400); }

.search-input-wrapper input {
    flex: 1;
    padding: 14px 12px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}
.search-input-wrapper input::placeholder { color: var(--text-muted); }

.search-clear {
    display: none;
    padding: 6px;
    background: rgba(148, 163, 184, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}
.search-clear.visible { display: flex; }
.search-clear:hover { background: rgba(148, 163, 184, 0.2); color: var(--text-primary); }

.search-results-count {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════════════ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-table thead {
    background: rgba(15, 23, 42, 0.6);
}

.data-table th {
    padding: 14px 18px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 14px 18px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition-fast);
}

.data-table tbody tr {
    transition: var(--transition-base);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

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

.data-table .voter-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voter-name-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-400);
    flex-shrink: 0;
}

.data-table .encadrant-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.encadrant-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald-400);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.datetime-cell {
    color: var(--text-secondary);
    font-size: 0.82rem;
    direction: ltr;
    text-align: right;
    white-space: nowrap;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(244, 63, 94, 0.08);
    color: var(--rose-400);
    border: 1px solid rgba(244, 63, 94, 0.12);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}
.btn-delete:hover {
    background: rgba(244, 63, 94, 0.18);
    border-color: rgba(244, 63, 94, 0.25);
    transform: translateY(-1px);
}

/* ── Action Buttons Container ── */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-400);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}
.btn-edit:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

/* ── Inline Edit ── */
.inline-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.edit-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--primary-500);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    transition: var(--transition-base);
    min-width: 120px;
}

.edit-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-edit-save,
.btn-edit-cancel {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-edit-save {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-400);
}
.btn-edit-save:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: scale(1.1);
}

.btn-edit-cancel {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}
.btn-edit-cancel:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose-400);
    transform: scale(1.1);
}

.table-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: var(--text-muted);
    gap: 16px;
}

.table-empty.visible {
    display: flex;
}

.table-empty svg { opacity: 0.3; }
.table-empty p { font-size: 0.95rem; }

/* ═══════════════════════════════════════════════════════
   FILTERS
   ═══════════════════════════════════════════════════════ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.filter-select {
    padding: 8px 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-base);
    appearance: auto;
}

.filter-select:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.btn-reset-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}
.btn-reset-filter:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════
   ACTION BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-export {
    background: rgba(16, 185, 129, 0.08);
    color: var(--emerald-400);
    border-color: rgba(16, 185, 129, 0.15);
}
.btn-export:hover {
    background: rgba(16, 185, 129, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* ═══════════════════════════════════════════════════════
   ADD VOTER SECTION
   ═══════════════════════════════════════════════════════ */
.add-voter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.add-voter-card:hover {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(16, 185, 129, 0.08);
}

.add-voter-header {
    text-align: center;
    padding: 36px 24px 20px;
}

.add-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-icon svg {
    width: 30px;
    height: 30px;
    color: var(--emerald-400);
}

.add-voter-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.add-voter-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.add-voter-form {
    padding: 0 32px 32px;
}

.required { color: var(--rose-400); }

.btn-save {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-save::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: 0.5s;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}
.btn-save:hover::before { left: 100%; }
.btn-save:active { transform: translateY(0); }

/* Save animation */
@keyframes saveSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(0.96); }
    100% { transform: scale(1); }
}
.btn-save.success {
    animation: saveSuccess 0.3s ease;
    background: linear-gradient(135deg, var(--emerald-400), var(--emerald-500));
}

/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.visible { display: flex; }

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 36px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon.danger {
    background: rgba(244, 63, 94, 0.12);
}
.modal-icon.danger svg {
    width: 30px;
    height: 30px;
    color: var(--rose-400);
}

.modal-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.btn-modal {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    border: none;
}

.btn-cancel {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-cancel:hover { background: rgba(148, 163, 184, 0.18); color: var(--text-primary); }

.btn-danger {
    background: linear-gradient(135deg, var(--rose-500), var(--rose-600));
    color: white;
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 420px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.toast-icon svg { width: 18px; height: 18px; }

.toast.success { border-right: 3px solid var(--emerald-500); }
.toast.success .toast-icon { background: rgba(16, 185, 129, 0.15); color: var(--emerald-400); }

.toast.error { border-right: 3px solid var(--rose-500); }
.toast.error .toast-icon { background: rgba(244, 63, 94, 0.15); color: var(--rose-400); }

.toast.info { border-right: 3px solid var(--primary-500); }
.toast.info .toast-icon { background: rgba(99, 102, 241, 0.15); color: var(--primary-400); }

.toast.warning { border-right: 3px solid var(--amber-500); }
.toast.warning .toast-icon { background: rgba(251, 191, 36, 0.15); color: var(--amber-400); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 16px;
        gap: 10px;
    }

    .nav-brand h2 { font-size: 1rem; }
    .nav-user span { display: none; }

    .btn-logout span { display: none; }
    .btn-logout {
        padding: 8px;
        border-radius: var(--radius-sm);
    }

    .dashboard, .enc-dashboard { padding: 20px 16px 40px; gap: 24px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .stat-card { padding: 18px; gap: 12px; }
    .stat-number { font-size: 1.6rem; }
    .stat-icon { width: 44px; height: 44px; }
    .stat-icon svg { width: 22px; height: 22px; }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        gap: 6px;
    }

    .filter-select { width: 100%; }

    .data-table th, .data-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .section-header { flex-direction: column; align-items: flex-start; }

    .login-card { border-radius: var(--radius-xl); }
    .login-header { padding: 28px 24px 16px; }
    .login-body { padding: 0 24px 20px; }
    .login-footer { padding: 14px 24px 20px; }

    .add-voter-form { padding: 0 24px 24px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }

    .login-logo h1 { font-size: 1.25rem; }
    .logo-icon { width: 60px; height: 60px; }
    .logo-icon svg { width: 34px; height: 34px; }

    .modal-card { padding: 28px 20px; }
}

/* ── Utility: Responsive Table Scroll ── */
@media (max-width: 640px) {
    .table-container { overflow-x: auto; }
    .data-table { min-width: 520px; }
}