
/* ============ CARDS (Compact Neumorphic) ============ */


.card {
    background: #f4f7fb;
    border-radius: 14px;
    padding: 1.2rem; /* reduced */
    box-shadow: 6px 6px 12px rgba(0,0,0,0.06),
                -6px -6px 12px rgba(255,255,255,0.85);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease;
}

.card h2 {
    font-size: 1.2rem; /* reduced */
    margin-bottom: 0.4rem;
    background: linear-gradient(90deg, #003399, #0077cc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card p.small {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.8rem;
}

/* Stat cards inside grid */
/* ================= STATS OVERVIEW ================= */
.stats-overview {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-family: "Segoe UI", Roboto, sans-serif;
}

.stats-overview h2 {
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.stats-overview .small {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 1rem;
}

/* Grid for cards */
.stats-overview .grid.cols-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

/* Each card */
.stats-overview .card.stat-card {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.stats-overview .card.stat-card h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

/* Counts (numbers) */
.stats-overview .card.stat-card > div:first-of-type {
    font-size: 1.5rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.5rem;
}

/* Vote line (Yes/No/Undecided) */
.vote-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.4rem 0;
}

.vote-label {
    font-weight: 500;
    color: #333;
    min-width: 60px;
    text-align: left;
}

.vote-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-pct {
    font-size: 0.85rem;
    color: #555;
}

/* Percentage bar */
.pct-bar {
    flex: 1;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-left: 0.75rem;
}

.pct-bar {
    width: 100%;
    background: #eee;
    height: 16px;
    border-radius: 6px;
    overflow: hidden;
}

.pct-fill {
    height: 100%;
    border-radius: 6px 0 0 6px;
    background: #2ecc71;
    width: var(--pct, 0%); /* JS sets this variable */
    min-width: 5%;
    max-width: 100%;
    transition: width 0.3s ease, border-radius 0.3s ease;
}

@media (max-width: 768px) {
    .pct-fill {
        border-radius: 6px !important; /* mobile uniform corners */
    }
}


/* Responsive */
/* ==============================
   CARDS & STATS - 768px MEDIA QUERY
============================== */
@media (max-width: 768px) {

    /* Main container */
    main.container {
        width: 98%;
        margin: 10px auto; /* reduce vertical spacing */
        padding: 0 8px;    /* minimal side padding */
    }

    /* Generic cards */
    .card {
        padding: 0.6rem;      /* reduced padding */
        margin-bottom: 0.8rem; /* smaller spacing between cards */
        border-radius: 10px;
    }

    .card h2 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .card p.small {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }

    /* Stats Overview container */
    .stats-overview {
        margin: 1rem auto;
        padding: 0.5rem 1rem;
        max-width: 100%;
    }

    .stats-overview h2 {
        font-size: 1.2rem;
        margin-bottom: 0.2rem;
    }

    .stats-overview .small {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    /* Grid for stat cards */
    .stats-overview .grid.cols-3 {
        grid-template-columns: 1fr; /* stack cards vertically */
        gap: 0.5rem;
    }

    /* Individual stat cards */
    .stats-overview .card.stat-card {
        padding: 0.5rem;
        border-radius: 6px;
        text-align: center;
    }

    .stats-overview .card.stat-card h3 {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .stats-overview .card.stat-card > div:first-of-type {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    

    /* Vote line adjustments */
    .vote-line {
        flex-direction: column;
        align-items: flex-start;
        margin: 0.25rem 0;
    }

    .pct-bar {
        width: 100%;
        margin-left: 0;
        margin-top: 0.2rem;
    }

    .vote-label, .stat-pct {
        font-size: 0.75rem;
    }
}



/* ============ LAYOUT HELPERS ============ */


.flex-space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 2rem;
}

.cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ============ FILTERS (Glass style) ============ */
/* ============================== */
/* FILTER CONTROLS (Glass + Neumorphic style) */
/* ============================== */
.filters {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: center;
}

.filters label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 0.5rem;
    color: #333;
    min-width: max-content;
}

.filters select,
.filters input[type="month"] {
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: none;
    background: #f0f3f8;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.08),
                inset -2px -2px 5px rgba(255,255,255,0.7);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    color: #333;
    min-width: 120px;
}

/* Hover / Focus effect */
.filters select:hover,
.filters select:focus,
.filters input[type="month"]:hover,
.filters input[type="month"]:focus {
    background: #e0e5ec;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.1),
                inset -1px -1px 3px rgba(255,255,255,0.6);
    color: #000;
}

/* Small labels for select wrappers */
.filters .small {
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {

    .filters {
        padding: 0.5rem 0.8rem;
        gap: 0.4rem 0.6rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        justify-content: flex-start;
    }

    .filters label {
        font-size: 0.8rem;
        margin-right: 0.3rem;
    }

    .filters select,
    .filters input[type="month"] {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        border-radius: 6px;
        min-width: 100px;
    }

}


/* ==============================
   LAYOUT HELPERS & FILTERS - COMPACT MOBILE
============================== */
@media (max-width: 768px) {

    /* Flex containers */
    .flex-space-between {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: flex-start; /* reduce extra space at edges */
    }

    /* Grid containers */
    .grid {
        gap: 0.5rem;
    }

    .cols-3 {
        grid-template-columns: 1fr; /* full width for small screens */
    }

    /* Filters container */
    .filters {
        padding: 0.5rem 0.8rem;
        gap: 0.4rem 0.6rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* Filter labels */
    .filters label {
        font-size: 0.8rem;
        margin-right: 0.3rem;
    }

    /* Filter selects */
    .filters select {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        border-radius: 6px;
    }
}













/* ============ DASHBOARD / STATS ============ */
/* ============ DASHBOARD / STATS ============ */

/* ---------------- Chart + Legend ---------------- */
/* ---------------- Chart + Legend Wrapper ---------------- */
.chart-legend-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start;
}


/* Chart canvas */
#chart-canvas {
    flex: 1 1 65%;
    min-width: 300px;
    max-width: 100%;
    height: auto;           /* Let Chart.js control height */
    aspect-ratio: 16 / 9;   /* Maintain consistent ratio */
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    background: #fff;
    padding: 10px;
}

/* Legend box */
#custom-legend {
    flex: 0 0 200px;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid #d1d9e6;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(145deg, #f5f7fa, #e4ebf2);
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.08),
                inset -2px -2px 6px rgba(255,255,255,0.9);
    font-size: 0.9rem;
    color: #2c3e50;
}


/* Scroll styling for legend */
#custom-legend::-webkit-scrollbar {
    width: 6px;
}
#custom-legend::-webkit-scrollbar-thumb {
    background: #9ab5d1;
    border-radius: 3px;
}

/* ---------------- Dashboard Layout ---------------- */
.dashboard {
    display: flex;
    flex-direction: column; /* if needed */
    min-height: 100vh;
    overflow-y: auto;       /* allow scrolling */
}






/* ---------------- Content Area ---------------- */
/* ---------------- Content Area ---------------- */
.content {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Remove overflow-y: auto from here to stop scrolling on main content */
}
/* ---------------- Chart Area ---------------- */
/* Keep chart fixed size */
#chart-area {
    background: linear-gradient(145deg, #ffffff, #f0f4f8);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 6px 6px 18px rgba(0,0,0,0.1),
                -6px -6px 18px rgba(255,255,255,0.7);
    margin-bottom: 20px;
}

#chart-title {
    margin-bottom: 20px;
    color: #284b63;
    font-weight: bold;
}

/* ---------------- Chart Type Selector ---------------- */
#chart-type {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: none;
    font-size: 0.95rem;
    background: #f5f7fa;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.08),
                inset -2px -2px 5px rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    margin-left: 10px;
}

#chart-type:hover {
    box-shadow: inset 1px 1px 4px rgba(0,0,0,0.05),
                inset -1px -1px 4px rgba(255,255,255,0.9);
    transform: scale(1.05);
}

#chart-type:focus {
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.4);
}

#chart-area label[for="chart-type"] {
    font-weight: 600;
    color: #284b63;
    font-size: 0.95rem;
}


/* Make description scrollable */
/* ---------------- Description Scroll ---------------- */
#description {
    margin-top: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(180deg,#fbfdff,#f3f7fb);
    padding: 14px;
    border-radius: 10px;
    box-shadow: inset 2px 2px 8px rgba(0,0,0,0.03);

    max-height: auto;   /* limit height */
    overflow-y: auto;    /* scroll only description */
}


#description p { margin: 0 0 8px 0; }



/* ================== General Table Styling ================== */
#chart-table {
    margin: 16px 0;
    height: auto;        /* let table expand naturally */
    max-height: none;    /* remove height restriction */
    overflow-y: visible; /* remove scroll, table expands */
    overflow-x: auto;    /* keep horizontal scroll for wide tables */
}

#chart-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    min-width: 400px;
    text-align: start !important;   /* 👈 ensures thead + tbody align to start */
}

/* Header */
#chart-table table th {
    background: #3498db;
    color: #fff;
    text-align: start !important;   /* 👈 explicit */
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    /* 👇 Make header sticky */
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Body rows */
#chart-table table td {
    text-align: start !important;   /* 👈 explicit */
    padding: 12px 16px;
    border-bottom: 1px solid #e6e6e6;
    color: #333;
}

/* Zebra striping */
#chart-table table tr:nth-child(even) td {
    background: #f9f9f9;
}

/* Hover effect */
#chart-table table tr:hover td {
    background: #f1f7ff;
}

/* Number columns alignment */
#chart-table table td:nth-child(2),
#chart-table table td:nth-child(3),
#chart-table table td:nth-child(4) {
    text-align: center;
    font-weight: 500;
    color: #2c3e50;
}



/* ---------------- Sidebar ---------------- */
/* Simple sidebar container */
/* ---------------- Sidebar ---------------- */
.sidebar-dropdown {
    width: 240px;
    padding: 16px;
    background: #355c7d;
    border-radius: 0 12px 12px 0;
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
}

/* Label */
.sidebar-dropdown label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ffd166;
}

/* Select dropdown */
.sidebar-dropdown select {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ffd166;
    background: #3c6e71;
    color: #ffd166;
    cursor: pointer;
    appearance: none; /* Remove default arrow for styling */
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Scrollbar for long dropdown */
.sidebar-dropdown select::-webkit-scrollbar {
    width: 8px;
}

.sidebar-dropdown select::-webkit-scrollbar-thumb {
    background-color: #ffd166;
    border-radius: 4px;
}

/* Hover / focus */
.sidebar-dropdown select:hover,
.sidebar-dropdown select:focus {
    background: #ffd166;
    color: #2c3e50;
    outline: none;
}

/* Optgroup styling */
.sidebar-dropdown optgroup {
    font-weight: bold;
    color: #ffd166;
    border-top: 1px solid #ffd166;
    padding: 2px 0;
}

/* Options styling */
.sidebar-dropdown option {
    background: #3c6e71;
    color: #ffd166;
    padding: 5px;
}

/* Option hover (for browsers that support it) */
.sidebar-dropdown option:hover {
    background: #ffd166;
    color: #2c3e50;
}




/* ==============================
   DASHBOARD / STATS - 768px MEDIA QUERY
============================== */
@media (max-width: 768px) {

    /* Dashboard container */
    .dashboard {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    /* Sidebar */
    .sidebar-dropdown {
        width: 100%;
        padding: 8px 12px;
        margin-bottom: 10px;
        border-radius: 0 0 10px 10px;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .sidebar-dropdown label {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .sidebar-dropdown select {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    /* Content area */
    .content {
        padding: 10px;
        gap: 10px;
    }

    /* Chart area */
    #chart-area {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    #chart-title {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    /* Chart type selector */
    #chart-type {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
        margin-left: 5px;
    }

    #chart-area label[for="chart-type"] {
        font-size: 0.85rem;
    }

    /* Chart + legend wrapper */
    .chart-legend-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    #chart-canvas {
        flex: 1 1 100%;
        min-width: 100%;
        height: auto;            /* let chart auto scale */
        aspect-ratio: 16 / 9;    /* maintain ratio for mobile */
        padding: 5px;
    }

    #custom-legend {
        flex: 1 1 100%;
        max-height: 160px;
        padding: 6px;
        font-size: 0.8rem;
    }

    
    /* Description box */
    #description {
        font-size: 0.8rem;
        max-height: 110px;
        padding: 8px;
        margin-top: 12px;
    }

    /* Chart table */
    #chart-table {
        max-height: 160px;
        font-size: 0.8rem;
        margin: 10px 0;
    }

    #chart-table table th,
    #chart-table table td {
        padding: 5px 6px;
        font-size: 0.75rem;
    }
}




/* ================= Pagination Buttons ================= */



/* ==========================
   Pagination Controls
========================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 10px 0;
    font-size: 0.95rem;
    color: #333;
}

.pagination-controls .btn {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pagination-controls .btn:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.pagination-controls .btn:disabled {
    background-color: #d6d6d6;
    color: #888;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.pagination-controls .page-info {
    font-weight: 500;
    color: #555;
    background: #f1f1f1;
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 180px;
    text-align: center;
}

.card .pagination-controls {
    border-top: 1px solid #ddd;
    margin-top: 10px;
    padding-top: 12px;
}

/* ==========================
   Pagination Controls (≤768px)
========================== */
@media (max-width: 768px) {
    .pagination-controls {
        gap: 6px;
        margin-top: 10px;
        padding: 6px 0;
        font-size: 0.8rem;
        flex-wrap: wrap; /* allow multiple rows if needed */
    }

    .pagination-controls .btn {
        width: auto;       /* remove 100% */
        max-width: 120px;  /* smaller */
        padding: 4px 8px;  /* smaller */
        font-size: 0.8rem; /* smaller */
        border-radius: 6px;
    }

    .pagination-controls .page-info {
        width: auto;       /* remove 100% */
        max-width: 120px;  /* smaller */
        font-size: 0.8rem; /* smaller */
        padding: 4px 8px;  /* smaller */
    }

    .card .pagination-controls {
        margin-top: 6px;
        padding-top: 8px;
    }
}
