/* ================= GLOBAL ================= */
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}

/* ================= HEADER ================= */
.site-header {
    background: linear-gradient(to right, #ffffff 0%, #f8fafc 50%, #ffffff 100%);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}
.header-inner {
    max-width: 1200px;
    margin: auto;
    padding: 14px 20px;
    position: relative;
}
.logo-box {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}
.site-logo { height: 48px; width: auto; object-fit: contain; }
.site-title {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.5px;
}
@media (max-width: 768px) {
    .logo-box { position: static; transform: none; justify-content: center; margin-bottom: 6px; }
    .header-inner { text-align: center; }
    .site-title { font-size: 19px; }
    .site-logo { height: 40px; }
}

/* ================= CONTAINER ================= */
.container { max-width: 1200px; margin: auto; padding: 20px 20px 50px; }
h1 { text-align: center; margin-bottom: 18px; font-size: 30px; }
h2 { margin-top: 40px; margin-bottom: 16px; font-size: 22px; color: #0f172a; }

/* ================= INFO BOX ================= */
.info-box { text-align: center; margin-bottom: 18px; color: #475569; font-size: 15px; }

/* ================= FILTER BAR ================= */
.filters {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.filters select, .filters button { padding: 10px 14px; font-size: 15px; border-radius: 8px; }
.filters select { border: 1px solid #cbd5e1; min-width: 220px; }
.filters button { background: #2563eb; color: white; border: none; cursor: pointer; }
.filters button:hover { background: #1d4ed8; }

/* ================= RESULTS GRID ================= */
.results {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}
@media (max-width: 768px) { .results { grid-template-columns: 1fr; } }

/* ================= AREA CARD ================= */
.area-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-top: 4px solid var(--accent, #2563eb);
}
.area-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.11);
}

/* ===== CARD HEADER ===== */
.area-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.area-card-title {
    font-weight: 800;
    font-size: 17px;
    color: #1e3a8a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Winner chip in header */
.area-winner-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(var(--accent-rgb,37,99,235), 0.08);
    border: 1px solid rgba(var(--accent-rgb,37,99,235), 0.2);
    border-radius: 999px;
    padding: 3px 10px 3px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent, #2563eb);
    flex-shrink: 0;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chip-photo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--accent, #2563eb);
    flex-shrink: 0;
}

/* ================= CANDIDATE LIST ================= */
.candidate-list {
    padding: 6px 0;
    max-height: 300px;
    overflow-y: auto;
}
.candidate-list::-webkit-scrollbar { width: 4px; }
.candidate-list::-webkit-scrollbar-track { background: #f8fafc; }
.candidate-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ================= BASE CANDIDATE ROW ================= */
.c-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
    position: relative;
}
.c-row:last-child { border-bottom: none; }
.c-row:not(.c-winner):hover { background: #f8fafc; }

/* ===== RANK BADGE ===== */
.c-rank-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.winner-rank {
    background: transparent;
    font-size: 14px;
}

/* ===== PHOTO ===== */
.c-photo-wrap {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}
.c-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    display: block;
}
.c-tick {
    position: absolute;
    bottom: -1px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--pc, #16a34a);
    color: white;
    font-size: 8px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ===== INFO ===== */
.c-info { flex: 1; min-width: 0; }

.c-name {
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.c-name:hover { color: #2563eb; text-decoration: underline; }
.winner-name  { font-size: 15px; font-weight: 800; color: var(--pc); }
.winner-name:hover { color: var(--pc); opacity: 0.85; text-decoration: underline; }

.c-party {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.c-party span { font-size: 11px; color: #64748b; font-weight: 500; }
.c-party-symbol {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.85;
}

/* BAR */
.c-bar-wrap {
    width: 100%;
    height: 4px;
    background: #f1f5f9;
    border-radius: 4px;
    margin-top: 6px;
    overflow: hidden;
}
.c-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    min-width: 4px;
}

/* ===== RIGHT SIDE ===== */
.c-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.c-votes {
    font-size: 13px;
    font-weight: 800;
    color: #475569;
    white-space: nowrap;
}
.winner-votes { color: var(--pc); font-size: 14px; }

.c-vijay-badge {
    background: var(--pc);
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* ===== WINNER ROW STYLES ===== */
.c-winner {
    background: linear-gradient(90deg,
        rgba(var(--rgb),0.07) 0%,
        rgba(var(--rgb),0.03) 100%
    );
    border-left: 3px solid var(--pc);
    border-bottom: 1px solid rgba(var(--rgb),0.12) !important;
    padding-left: 11px;
}
.c-winner .c-photo {
    border-color: var(--pc);
    box-shadow: 0 0 0 3px rgba(var(--rgb),0.18);
    width: 48px;
    height: 48px;
}
.c-winner .c-photo-wrap {
    width: 48px;
    height: 48px;
}

/* ================= FOOTER ================= */
.site-footer {
    margin-top: 60px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.04);
}
.footer-inner {
    max-width: 1200px;
    margin: auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #475569;
}
.footer-left strong { color: #0f172a; }
@media (max-width: 600px) { .footer-inner { flex-direction: column; gap: 8px; text-align: center; } }

/* ================= ADMIN ================= */
.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #2563eb;
    font-weight: 600;
    transition: all 0.25s ease;
}
.admin-text { max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: all 0.25s ease; }
.admin-link:hover .admin-text { max-width: 120px; opacity: 1; }
.admin-link:hover { background: #2563eb; color: white; }
.admin-hidden { opacity: 0.6; }
.admin-hidden:hover { opacity: 1; }

/* ================= ANIMATION ================= */
.profile-card { animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================= PARTY RESULTS BAR ================= */
.party-results-wrap {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 10px;
}
.party-results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.party-results-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}
.party-results-row:last-child { border-bottom: none; }
.party-results-row:hover { background: #f8faff; }

.pr-col-party { flex: 0 0 220px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.pr-col-bar   { flex: 1; min-width: 0; }
.pr-col-stat  { flex: 0 0 64px; text-align: center; }

.pr-icon-wrap {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.pr-symbol { width: 26px; height: 26px; object-fit: contain; }
.pr-icon-fallback { font-size: 16px; }
.pr-name { font-size: 13px; font-weight: 600; color: #0f172a; line-height: 1.3; word-break: break-word; white-space: normal; }

.pr-bar-labels { display: flex; gap: 10px; margin-bottom: 4px; font-size: 11px; font-weight: 600; min-height: 16px; }
.pr-bar-label-won  { font-weight: 700; }
.pr-bar-label-lead { color: #92400e; opacity: 0.8; }

.pr-track {
    height: 14px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    display: flex;
    position: relative;
}
.pr-majority-line {
    position: absolute;
    left: 50.3%; top: 0; bottom: 0;
    width: 2px;
    background: rgba(0,0,0,0.25);
    z-index: 2;
}
.pr-bar-won {
    height: 100%;
    border-radius: 99px 0 0 99px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.pr-bar-leading {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1) 0.1s;
    flex-shrink: 0;
}
.pr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 800;
}
.pr-won     { background: #dcfce7; color: #166534; }
.pr-leading { background: #fef9c3; color: #854d0e; }
.pr-total   { background: #e0e7ff; color: #3730a3; }
.pr-stat-won   { color: #86efac; }
.pr-stat-lead  { color: #fde68a; }
.pr-stat-total { color: #c7d2fe; }

.pr-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
}
.pr-legend-item    { display: flex; align-items: center; gap: 6px; }
.pr-legend-dot     { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pr-legend-majority { margin-left: auto; font-weight: 700; color: #475569; }

@media (max-width: 768px) {
    .pr-col-party         { flex: 0 0 150px; }
    .pr-name              { font-size: 12px; }
    .pr-col-stat          { flex: 0 0 48px; }
    .pr-badge             { font-size: 11px; padding: 2px 6px; min-width: 28px; }
    .party-results-header { font-size: 10px; gap: 8px; padding: 10px 12px; }
    .party-results-row    { padding: 10px 12px; gap: 8px; }
    .pr-icon-wrap         { width: 32px; height: 32px; }
    .pr-symbol            { width: 22px; height: 22px; }
    .pr-legend            { gap: 12px; font-size: 11px; }
    .pr-legend-majority   { margin-left: 0; }
}
@media (max-width: 480px) {
    .pr-col-party  { flex: 0 0 120px; }
    .pr-bar-labels { display: none; }
}