:root {
    --primary-color: #1a1a1a;
    --secondary-color: #666;
    --background-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-radius: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --font-family: 'Inter', sans-serif;

    /* Party Colors */
    --color-psoe: #E30613;
    --color-pp: #0056A3;
    --color-vox: #63BE21;
    --color-up: #6B1F5F;
    --color-cs: #EB6109;
    --color-others: #999999;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    margin: 0;
    padding: 40px 20px;
    color: var(--primary-color);
}

.election-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
}

.dashboard-header p {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin: 0;
}

.widgets-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.election-widget {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.election-widget:hover {
    transform: translateY(-2px);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 16px;
}

.widget-header h2 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.status-badge {
    background: #e6f4ea;
    color: #1e8e3e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}

.stats-summary {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* Dashboard Controls */
.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -8px;
}

.search-result-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-family);
    font-size: 0.95rem;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-item:last-child {
    border-radius: 0 0 8px 8px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* Refresh Button */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.refresh-btn:hover {
    background: #c72a35;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.refresh-btn svg {
    flex-shrink: 0;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 4px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Views */
.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

/* Tables */
.election-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.election-table th,
.election-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.election-table th {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.election-table td {
    font-size: 1rem;
}

.party-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Votes Chart */
.votes-chart-title {
    text-align: center;
    margin: 30px 0 20px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.votes-chart-container {
    width: 100%;
    margin-bottom: 20px;
}

/* Participation Table */
.participation-header {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.participation-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 600;
}

.participation-table {
    width: 100%;
}

.participation-table th {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    padding: 16px 12px;
}

.participation-table td {
    padding: 14px 12px;
}

.participation-table td:first-child {
    font-weight: 600;
    color: var(--secondary-color);
}

.participation-table td:not(:first-child) {
    text-align: center;
}

.participation-table .percentage {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .dashboard-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        max-width: 100%;
    }

    .tabs-container {
        overflow-x: auto;
    }
}