:root {
    --bg-light: #f5f5f7;
    --bg-white: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --manorama-blue: #2A327D;
    --manorama-red: #E31837;
    --border-color: #e0e0e0;
    --udf-blue: #0066cc;
    --ldf-red: #cc0000;
    --nda-orange: #ff9900;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
}

.top-banner {
    position: relative;
    background: url('banner.png') center/cover no-repeat;
    color: #ffffff;
    text-align: center;
    padding: 3rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(42, 50, 125, 0.7));
    z-index: 1;
}

.banner-content {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sub-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffcccc;
}

@media (max-width: 600px) {
    .main-title {
        font-size: 1.8rem;
    }
    .sub-title {
        font-size: 1.2rem;
    }
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header Section */
.filter-header {
    background: var(--manorama-blue);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    margin-bottom: 0;
}

.filter-title-bar {
    padding: 1rem 1.5rem;
    border-bottom: 3px solid rgba(255,255,255,0.1);
    position: relative;
}

.filter-title-bar::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 1.5rem;
    width: 60px;
    height: 3px;
    background-color: var(--manorama-red);
}

.filter-title-bar h2 {
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Layout for Main Content and Sidebar */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Styles */
.sidebar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content;
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 2px solid var(--manorama-red);
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.sidebar-header h3 {
    margin: 0;
    color: var(--manorama-blue);
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: 700;
}

.sidebar-content {
    overflow-y: auto;
    padding: 0;
}

.sidebar-item {
    display: flex;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.sidebar-item:last-child {
    border-bottom: none;
}

.sidebar-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e6ed;
}

.sidebar-details {
    flex: 1;
}

.sidebar-name {
    font-size: 1rem;
    color: var(--manorama-blue);
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.sidebar-meta span {
    font-weight: 600;
}

.sidebar-won-by {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sidebar-won-by strong {
    color: var(--manorama-red);
    font-size: 1.05rem;
}

.filter-controls {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--manorama-blue);
}

.select-wrapper, .search-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select, .search-wrapper input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 4px;
    border: none;
    background: white;
    font-size: 1rem;
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
}

.select-wrapper select {
    cursor: pointer;
}

.select-wrapper select:focus, .search-wrapper input:focus {
    outline: 2px solid var(--manorama-red);
}

.select-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--manorama-blue);
}

.tally-bar {
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.tally-bar h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 800;
}

/* Candidates List */
.candidates-list {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.candidate-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.candidate-item:hover {
    background-color: #fafafa;
}

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

.candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1.5rem;
    border: 2px solid #eee;
}

.candidate-details {
    flex: 1;
}

.candidate-name {
    font-size: 1.3rem;
    color: var(--manorama-blue);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.party-alliance {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alliance-tag {
    font-weight: 600;
}

.alliance-tag.udf { color: var(--udf-blue); }
.alliance-tag.ldf { color: var(--ldf-red); }
.alliance-tag.nda { color: var(--nda-orange); }

.vote-stats {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.lost-by {
    color: var(--text-secondary);
    font-size: 1rem;
}

.vote-number {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--manorama-red); /* Highlight lost margin in red to indicate failure */
}

.total-votes {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.party-symbol {
    display: none; /* Avoid Election symbol */
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Responsive */
@media (max-width: 800px) {
    .filter-controls {
        grid-template-columns: 1fr 1fr;
    }
    .search-wrapper {
        grid-column: 1 / -1;
    }
}
@media (max-width: 600px) {
    .filter-controls {
        grid-template-columns: 1fr;
    }
    .candidate-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .candidate-photo {
        margin-bottom: 1rem;
    }
    .party-symbol {
        display: none; /* Hide symbol on small screens to save space */
    }
}

/* Footer Styles */
.app-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8f9fa;
}

.whatsapp-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(37, 211, 102, 0.2);
}

.whatsapp-link:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 211, 102, 0.3);
}

.whatsapp-link i {
    font-size: 2rem;
}

.footer-disclaimer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}
