/* ============================
   Nepal Election 2082 Tracker
   Premium Modern Design System
   ============================ */

:root {
    /* Nepal Flag Colors */
    --nepal-red: #DC143C;
    --nepal-blue: #003893;

    /* Premium Palette */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

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

    --accent-1: #DC143C;
    --accent-2: #003893;
    --accent-3: #6366f1;
    --accent-4: #22d3ee;
    --accent-5: #10b981;
    --accent-6: #f59e0b;

    --gradient-primary: linear-gradient(135deg, #DC143C 0%, #003893 100%);
    --gradient-accent: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

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

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

/* ============================
   Animated Background
   ============================ */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(220, 20, 60, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 56, 147, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: float 20s infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(220, 20, 60, 0.06);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: rgba(0, 56, 147, 0.06);
    top: 50%;
    right: -50px;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: rgba(99, 102, 241, 0.04);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

/* ============================
   Header
   ============================ */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 24px;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.year-badge {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

.last-updated {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(220, 20, 60, 0.12);
    border: 1px solid rgba(220, 20, 60, 0.25);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #DC143C;
    letter-spacing: 0.1em;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #DC143C;
    border-radius: 50%;
    animation: pulse-live 2s infinite;
}

@keyframes pulse-live {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.4);
    }

    50% {
        opacity: 0.6;
        box-shadow: 0 0 0 6px rgba(220, 20, 60, 0);
    }
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.refresh-btn svg {
    transition: transform 0.5s ease;
}

.refresh-btn:hover svg {
    transform: rotate(180deg);
}

/* ============================
   Main Content
   ============================ */
main {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ============================
   Stats Overview
   ============================ */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-total::before {
    background: var(--gradient-primary);
}

.stat-declared::before {
    background: var(--gradient-success);
}

.stat-counting::before {
    background: var(--gradient-warm);
}

.stat-parties::before {
    background: var(--gradient-accent);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.12);
}

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

.stat-total .stat-icon {
    background: rgba(220, 20, 60, 0.1);
    color: #DC143C;
}

.stat-declared .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-counting .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-parties .stat-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ============================
   Search & Filter
   ============================ */
.search-filter-section {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.search-bar {
    flex: 1;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.search-bar:focus-within {
    border-color: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    width: 100%;
    padding: 14px 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

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

.filter-controls {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.search-btn {
    padding: 12px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.filter-controls select {
    padding: 12px 36px 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all var(--transition-normal);
}

.filter-controls select:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-controls select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============================
   Glass Card
   ============================ */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

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

.section-header.full-width {
    margin-bottom: 20px;
}

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

.section-header h2 svg {
    color: var(--accent-3);
}

.badge {
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.badge-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.see-more-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-3);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-normal);
}

.see-more-link:hover {
    color: #818cf8;
    gap: 10px;
}

/* ============================
   Main Grid
   ============================ */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* ============================
   Party Table
   ============================ */
.party-results {
    margin-bottom: 24px;
}

.party-table-wrapper {
    overflow-x: auto;
    max-height: 550px;
    overflow-y: auto;
}

.party-table-wrapper::-webkit-scrollbar {
    width: 6px;
}

.party-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.party-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

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

.party-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.party-table th {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.party-table td {
    padding: 10px 12px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.party-table tbody tr {
    transition: all var(--transition-fast);
}

.party-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.text-center {
    text-align: center !important;
}

.party-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.party-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.party-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.won-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    font-family: 'Outfit', sans-serif;
}

.won-count {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.lead-count {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.total-count {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    font-weight: 800;
}

/* ============================
   Map Section
   ============================ */
.map-section {
    display: flex;
    flex-direction: column;
}

.map-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.map-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-normal);
}

.map-tab:hover {
    color: var(--text-secondary);
}

.map-tab.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 400px;
}

.nepal-map {
    width: 100%;
    max-width: 100%;
}

.nepal-map svg {
    width: 100%;
    height: auto;
}

.nepal-map svg path {
    transition: all var(--transition-normal);
    cursor: pointer;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 0.5;
}

.nepal-map svg path:hover {
    filter: brightness(1.3);
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 1;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.map-tooltip {
    position: fixed;
    padding: 10px 16px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px);
    transition: all var(--transition-fast);
    z-index: 1000;
    max-width: 250px;
}

.map-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   Province Breakdown
   ============================ */
.province-breakdown {
    margin-bottom: 24px;
}

.province-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.province-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.province-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.1);
}

.province-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.province-card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.province-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
}

.province-seat-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.province-mini-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mini-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-bar-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.mini-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.mini-bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
    font-family: 'Outfit', sans-serif;
}

/* ============================
   Results Tab Bar
   ============================ */
.results-tab-bar {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 24px;
}

.results-tab {
    padding: 10px 28px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.results-tab:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.results-tab.active {
    background: var(--nepal-blue);
    border-color: var(--nepal-blue);
    color: white;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 400;
}

/* ============================
   Popular Candidates
   ============================ */
.popular-candidates {
    margin-bottom: 24px;
}

.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.constituency-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.constituency-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.constituency-card.hidden {
    display: none;
}

.constituency-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.constituency-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.03em;
}

.constituency-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 1.4rem;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

.constituency-card:hover .constituency-arrow {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.elected-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.elected-badge.elected {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.elected-badge.counting {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.candidates-list {
    padding: 12px 18px;
}

.candidate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.candidate-row:last-child {
    border-bottom: none;
}

.candidate-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.candidate-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.candidate-avatar.top-candidate {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.candidate-details {
    overflow: hidden;
}

.candidate-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.candidate-badge {
    display: block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

.candidate-badge.winner {
    color: #DC143C;
}

.candidate-badge.leading {
    color: #22d3ee;
}

.candidate-party-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.candidate-votes-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.candidate-votes {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.candidate-row:first-child .candidate-votes {
    color: var(--text-primary);
}

.votes-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.08em;
    margin-top: 1px;
}

/* Vote bar */
.vote-bar-container {
    margin-top: 8px;
    padding: 0 18px 14px;
}

.vote-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    display: flex;
    overflow: hidden;
}

.vote-bar-segment {
    height: 100%;
    transition: width 1s ease;
}

/* ============================
   Proportional Results
   ============================ */
.proportional-results {
    margin-bottom: 24px;
}

.proportional-chart {
    width: 100%;
    height: 40px;
    display: flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.03);
}

.chart-segment {
    height: 100%;
    position: relative;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.chart-segment:hover {
    filter: brightness(1.2);
}

.chart-segment-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    font-size: 0.72rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 10;
}

.chart-segment:hover .chart-segment-tooltip {
    opacity: 1;
}

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

.pr-party-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
}

.pr-party-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
}

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

.pr-party-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.pr-party-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.pr-party-pct {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.pr-party-pct-sign {
    font-size: 1.2rem;
    font-weight: 600;
}

.pr-party-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin: 10px 0;
    overflow: hidden;
}

.pr-party-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

.pr-party-votes {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================
   Pagination & Results Count
   ============================ */
.results-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 8px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-btn {
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    color: #818cf8;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.page-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

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

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 90px;
    text-align: center;
}

.constituency-district {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

/* ============================
   Footer
   ============================ */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--glass-border);
    padding: 24px;
    margin-top: 40px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-brand p {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-sub {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    margin-top: 4px;
}

.footer-links {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================
   Loading Overlay
   ============================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-3);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* ============================
   Animations
   ============================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 1024px) {
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-inner {
        height: auto;
        padding: 14px 0;
        flex-wrap: wrap;
        gap: 12px;
    }

    .stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px 16px;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    .search-filter-section {
        flex-direction: column;
    }

    .filter-controls {
        flex-direction: column;
    }

    .candidates-grid {
        grid-template-columns: 1fr;
    }

    .province-cards {
        grid-template-columns: 1fr;
    }

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

    .results-tab-bar {
        justify-content: center;
    }

    main {
        padding: 16px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

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

    .logo-text h1 {
        font-size: 1.1rem;
    }

    .section-header h2 {
        font-size: 1rem;
    }
}