﻿:root {
    --primary: #9369a0;
    /* ECM purple */
    --secondary: #682c7c;
    /* darker purple accent */
    --success: #b08fbe;
    /* light purple highlight */
    --info: #6c7a91;
    /* soft bluish-gray */
    --warning: #c77dff;
    /* optional pink/purple accent */
    --light: #f8f9fa;
    /* backgrounds */
    --dark: #2d2d2d;
    /* main text */
    --gray: #6c757d;
    /* muted text */
    --card-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
/* Ensure footer at bottom */
html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    /* pushes footer down */
}

body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    font-size: 0.9rem;
    /* globally smaller */
}
/* Thin Header */
.dashboard-header {
    background-color: none;
    border-top: 1px solid #f8f9fa;
    padding: 0.6rem 0;
    /* thinner */
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.dashboard-header .subtitle {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray);
    margin: 0;
}

.election-icon {
    color: var(--primary);
    opacity: 0.9;
}
/* Header stat hover items */
.header-stat {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: default;
}

.header-stat:hover {
    background: rgba(147, 105, 160, 0.08);
    /* light purple bg */
    transform: translateY(-2px);
}

.header-stat i {
    color: var(--primary);
    transition: color 0.2s ease, transform 0.2s ease;
}

.header-stat:hover i {
    color: var(--secondary);
    /* darker purple */
    transform: scale(1.2);
}

.header-stat strong {
    transition: color 0.2s ease;
}

.header-stat:hover strong {
    color: var(--secondary);
}
/* Cards */
.card-modern {
    background: white;
    border-radius: 10px;
    border: none;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
}

.card-header-modern {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.card-body-modern {
    padding: 1rem;
}
/* Stat cards */
.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.stat-card h3 {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.4rem;
    font-size: 1.5rem;
}

.stat-card p {
    color: var(--gray);
    margin: 0;
    font-size: 0.8rem;
}
/* Candidates */
.candidate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s;
}

.candidate:hover {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    padding-left: 8px;
    padding-right: 8px;
}

.candidate:last-child {
    border-bottom: none;
}

.candidate-info {
    flex: 1;
}

.candidate-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.candidate-party {
    color: var(--gray);
    font-size: 0.8rem;
}

.candidate-votes {
    text-align: right;
}

.candidate-votes h5 {
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--primary);
    font-size: 1rem;
}

.candidate-votes small {
    font-size: 0.75rem;
}
/* Progress bar */
.progress-bar-custom {
    height: 6px;
    border-radius: 3px;
    background-color: #e9ecef;
    margin-top: 0.4rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
}

.party-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #fff;
}
/* Sidebar */
.sidebar-modern {
    background: white;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 1rem;
}

.list-group-item-modern {
    border: none;
    padding: 0.65rem 0.9rem;
    border-radius: 6px !important;
    margin-bottom: 0.4rem;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.list-group-item-modern:hover {
    background: rgba(147, 105, 160, 0.1);
}

.list-group-item-modern.active {
    background: rgba(147, 105, 160, 0.15);
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
}

.search-modern {
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.search-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(147, 105, 160, 0.25);
    outline: none;
}
/* Boxes */
.box-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.85rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.box-item:hover {
    background: rgba(147, 105, 160, 0.05);
    transform: translateX(4px);
    border-color: rgba(147, 105, 160, 0.2);
}

.status-badges {
    display: flex;
    gap: 0.4rem;
}

.status-badges .badge {
    width: 70px;
}
/* Footer */
.footer {
    background-color: #e9ecef;
    border-top: 1px solid #f8f9fa;
    padding: 1rem 0;
    margin-top: 2rem;
}

footer small {
    font-size: 0.75rem;
    color: var(--gray);
}
/* ✅ Status inline (header use) */
.status-item {
    display: flex;
    align-items: center;
    margin-left: 1.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.status-item:first-child {
    margin-left: 0;
}

.status-item i {
    font-size: 0.9rem;
    margin-right: 0.35rem;
    color: var(--primary);
}

.status-label {
    font-weight: 500;
    color: var(--gray);
    margin-right: 0.2rem;
}

.status-value {
    font-weight: 700;
    color: var(--dark);
}
/* ✅ Status blocks (center page card) */
.status-blocks {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    text-align: center;
}

.status-blocks .status-item {
    flex-direction: column;
    margin-left: 0;
    min-width: 100px;
    padding: 0.75rem;
}

.status-blocks .status-item i {
    font-size: 1.2rem;
    margin: 0 0 0.4rem 0;
}

.status-blocks .status-label {
    font-size: 0.75rem;
    margin: 0 0 0.2rem 0;
}

.status-blocks .status-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}
/* Badge Colors */
.badge.bg-primary {
    background-color: #4a90e2 !important;
    color: #fff !important;
    font-size: 9px;
}

.badge.bg-info {
    background-color: #5bc0de !important;
    color: #fff !important;
    font-size: 9px;
}

.badge.bg-warning {
    background-color: #f7c46c !important;
    color: #2d2d2d !important;
    font-size: 9px;
}

.badge.bg-success {
    background-color: var(--success) !important;
    color: #fff !important;
    font-size: 9px;
}

.badge.bg-secondary {
    background-color: var(--secondary) !important;
    color: white !important;
}

.badge.bg-danger {
    background-color: #e74c3c !important;
    color: white !important;
}
/* Voting Statistics Styles */
.box-main-info {
    flex: 1;
}

.voting-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    justify-content: center;
    align-items: center;
    /*border-top: 1px solid rgba(0, 0, 0, 0.08);
    */
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
    white-space: nowrap;
}

.stat-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark);
    background: var(--light);
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 60px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.box-item:hover .stat-value {
    background: rgba(147, 105, 160, 0.1);
    color: var(--secondary);
    border-color: rgba(147, 105, 160, 0.2);
}
/* Enhanced Status badges alignment */
.status-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    min-width: 80px;
}

.badge {
    font-size: 0.7em;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}
/* Text styling */
.fw-bold {
    color: var(--primary);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.text-muted.small {
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: var(--primary) !important;
}
/* Clear search button */
.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    font-size: 0.8rem;
}

.search-clear:hover {
    color: var(--primary);
}
/* Search container */
.search-container {
    position: relative;
}
/* No results message */
.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    font-style: italic;
}
.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #888;
    cursor: pointer;
    display: none; /* hidden by default */
    user-select: none;
}

.clear-btn:hover {
    color: #333;
}
/* Filter buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.candidates-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    background: rgba(147, 105, 160, 0.1);
    border: 1px solid rgba(147, 105, 160, 0.3);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--primary);
    margin-top: 6px;
}

.candidates-toggle:hover {
    background: rgba(147, 105, 160, 0.2);
    border-color: var(--primary);
}

.toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.candidates-toggle.active + .candidates-section {
    display: block;
}

.toggle-text {
    font-weight: 600;
}

.candidates-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.candidates-header {
    display: grid;
    grid-template-columns: 40px 1fr 80px 60px;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 2px solid rgba(147, 105, 160, 0.3);
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.candidate-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 60px;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
    font-size: 0.8rem;
}

.candidate-row:hover {
    background: rgba(147, 105, 160, 0.03);
    border-radius: 4px;
}

.candidate-row:last-child {
    border-bottom: none;
}

.candidate-col {
    display: flex;
    align-items: center;
}

.candidate-col.number {
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    background: rgba(147, 105, 160, 0.1);
    border-radius: 4px;
    padding: 4px;
}

.candidate-col.name {
    font-weight: 500;
    color: var(--dark);
}

.candidate-col.votes {
    justify-content: center;
    font-weight: 600;
    color: var(--secondary);
}

.candidate-col.percentage {
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    background: rgba(147, 105, 160, 0.1);
    border-radius: 12px;
    padding: 2px 8px;
}

.constituency-scroll {
    max-height: 400px;
    /* shows about 10 items */
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 10px;
    /* space above list */
    padding-top: 5px;
    /* inner spacing for first item */
}
/* Chrome, Edge, Safari */
.constituency-scroll::-webkit-scrollbar {
    width: 6px;
    /* thin scrollbar */
}

.constituency-scroll::-webkit-scrollbar-track {
    background: transparent;
    /* clean track */
}

.constituency-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(147, 105, 160, 0.6);
    /* ECM purple semi-transparent */
    border-radius: 3px;
}

.constituency-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(147, 105, 160, 0.9);
    /* darker on hover */
}
/* Firefox */
.constituency-scroll {
    scrollbar-width: thin;
    /* thin scrollbar */
    scrollbar-color: rgba(147, 105, 160, 0.6) transparent;
}

.candidates-scroll {
    max-height: 400px;
    /* adjust as needed */
    overflow-y: auto;
    padding-right: 5px;
    /* keeps content away from scrollbar */
}
/* Chrome, Edge, Safari */
.candidates-scroll::-webkit-scrollbar {
    width: 6px;
    /* thin scrollbar */
}

.candidates-scroll::-webkit-scrollbar-track {
    background: transparent;
    /* or #f1f1f1 if you want */
}

.candidates-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(147, 105, 160, 0.6);
    /* ECM purple semi-transparent */
    border-radius: 3px;
}

.candidates-scroll::-webkit-scrollbar-thumb:hover {
    background-color: rgba(147, 105, 160, 0.9);
    /* darker on hover */
}
/* Firefox */
.candidates-scroll {
    scrollbar-width: thin;
    /* makes scrollbar thinner */
    scrollbar-color: rgba(147, 105, 160, 0.6) transparent;
}

.box-scroll {
    max-height: 500px;
    /* adjust for ~5 items */
    overflow-y: auto;
    padding: 10px;
    /* 👈 adds space on all sides */
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
    /* Chrome, Edge, Safari */
.box-scroll::-webkit-scrollbar {
    width: 6px;
    /* thin scrollbar */
}

.box-item {
    margin-bottom: 10px;
    /* gap between items */
}

.box-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.box-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(147, 105, 160, 0.6);
    /* ECM purple */
    border-radius: 3px;
}

    .box-scroll::-webkit-scrollbar-thumb:hover {
        background-color: rgba(147, 105, 160, 0.9);
    }
/* Firefox */
.box-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 105, 160, 0.6) transparent;
}
.candidate, .box-item, .candidates-section {
    will-change: transform, opacity;
}
/* Responsive design */
@media (max-width: 768px) {
    body {
        font-size: 0.85rem;
    }

    .dashboard-header .subtitle {
        font-size: 0.8rem;
    }

    .stat-card h3 {
        font-size: 1.25rem;
    }

    .candidate-name {
        font-size: 0.85rem;
    }

    .candidate-party {
        font-size: 0.7rem;
    }

    .candidate-votes h5 {
        font-size: 0.9rem;
    }

    .box-item {
        padding: 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .status-badges {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        flex-wrap: wrap;
    }

    .voting-stats {
        gap: 8px;
    }

    .stat-item {
        flex: 1;
        min-width: calc(50% - 8px);
        justify-content: space-between;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 0.75rem;
        padding: 1px 6px;
    }

    footer small {
        font-size: 0.65rem;
    }

    .status-blocks {
        gap: 1rem;
    }

    .status-blocks .status-item {
        min-width: 80px;
        padding: 0.5rem;
    }

    .box-header .fw-bold {
        display: block;
    }

    .box-header .fw-bold .badge {
        display: inline-block;
        margin-top: 5px;
    }

    .candidates-section {
        max-height: 250px;
        overflow-y: auto;
    }

    .candidates-section::-webkit-scrollbar {
        width: 4px;
    }

    .candidates-section::-webkit-scrollbar-thumb {
        background: rgba(147, 105, 160, 0.6);
        border-radius: 2px;
    }

    .candidates-header, .candidate-row {
        grid-template-columns: 12% 1fr 20% 18%;
        /* percentage instead of px */
        font-size: 0.75rem;
        gap: 6px;
    }

    .candidates-section {
        max-width: 100%;
        overflow-x: hidden;
        /* prevent horizontal scroll */
        padding: 8px;
    }

    .candidates-section {
        max-height: 250px;
        overflow-y: auto;
    }

    .candidates-section::-webkit-scrollbar {
        width: 4px;
    }

    .candidates-section::-webkit-scrollbar-thumb {
        background: rgba(147, 105, 160, 0.6);
        border-radius: 2px;
    }

    .candidates-header, .candidate-row {
        grid-template-columns: 40px 1fr 60px 50px;
        /* tighter grid for mobile */
        font-size: 0.75rem;
    }

    .candidate-col.name {
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .box-header .fw-bold {
        display: block;
    }

    .box-header .fw-bold .badge {
        display: inline-block;
        margin-top: 5px;
    }

    .voting-stats {
        gap: 6px;
    }

    .stat-item {
        min-width: 100%;
    }

    .filter-buttons {
        gap: 0.3rem;
    }

    .filter-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .card-body-modern {
        padding: 0.75rem;
    }

    .card-header-modern {
        padding: 0.75rem;
    }
}
/* Utility classes */
.text-primary {
    color: var(--primary) !important;
}

.text-secondary {
    color: var(--secondary) !important;
}

.text-success {
    color: green;
}

.text-indigo {
    color: #4b7bec;
}

.text-pending {
    color: #d97706;
}

.bg-light {
    background-color: var(--light) !important;
}
/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
/* Candidates section should span full box */
.candidates-wrapper {
    flex-basis: 100%;
    /* take full row in flexbox */
    order: 99;
    /* push it below badges */
    margin-top: 0.5rem;
}

.candidates-section {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: slideDown 0.3s ease;
    width: 100%;
    max-height: 400px; /* 👈 always limit height */
    overflow-y: auto; /* 👈 always scroll if overflow */
}
    /* Scrollbar styling (desktop + mobile) */
.candidates-section::-webkit-scrollbar {
    width: 6px;
}

.candidates-section::-webkit-scrollbar-thumb {
    background: rgba(147, 105, 160, 0.6);
    border-radius: 3px;
}

.candidates-section::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 105, 160, 0.9);
}
/* Firefox */
.candidates-section {
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 105, 160, 0.6) transparent;
}
/* Grid layout for header + rows */
.candidates-header, .candidate-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 70px;
    /* # | Name | Votes | % */
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.candidates-header {
    font-weight: 600;
    background: var(--light);
    color: var(--dark);
}

.candidate-row:hover {
    background: rgba(147,105,160,0.05);
    border-radius: 4px;
}

.candidate-col.votes, .candidate-col.percentage {
    text-align: right;
}
