/* =========================
   GLOBAL
========================= */
* {
    font-family: "Jost", sans-serif;
    box-sizing: border-box;
}

:root {
    --primary-green: #00ff88;
    --secondary-green: #2d5a27;
    --accent-blue: #00d4ff;
    --deep-forest: #0a1a0a;
    --light-mint: #e8fff0;
}

/* =========================
   ANIMATED BACKGROUND
========================= */
@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body
{
    margin: 0;
    background: linear-gradient(135deg, var(--deep-forest), var(--secondary-green), var(--deep-forest), var(--deep-forest), var(--secondary-green));
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    min-height: 100vh;
}

/* =========================
   KEYFRAME ANIMATIONS
========================= */
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}

@keyframes sparkleTwinkle {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50%       { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes sparkleFloat {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-40px) scale(0); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes bounceIn {
    0%   { opacity: 0; transform: scale(0.7); }
    60%  { opacity: 1; transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

@keyframes starSpin {
    0%   { transform: rotate(0deg) scale(0); opacity: 0; }
    30%  { opacity: 1; transform: rotate(180deg) scale(1.2); }
    70%  { opacity: 1; transform: rotate(270deg) scale(1); }
    100% { transform: rotate(360deg) scale(0); opacity: 0; }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 255, 136, .4); }
    50%       { box-shadow: 0 0 18px rgba(0, 212, 255, .8); }
}

@keyframes slideInCard {
    from { opacity: 0; transform: translateY(20px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================
   SPARKLE ELEMENTS
========================= */
#sparkle-container
{
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.sparkle
{
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
    animation: sparkleFloat 1.5s ease-out forwards;
}

.sparkle::before,
.sparkle::after
{
    content: '★';
    position: absolute;
    font-size: 22px;
    animation: starSpin 1.5s ease-out forwards;
}

.sparkle::before { color: var(--primary-green); }
.sparkle::after  { color: var(--accent-blue); animation-delay: .2s; font-size: 16px; top: -6px; left: 6px; }

.ambient-sparkle
{
    position: fixed;
    pointer-events: none;
    animation: sparkleTwinkle var(--dur, 3s) var(--delay, 0s) infinite ease-in-out;
    z-index: 100;
    opacity: 0;
}

/* =========================
   LIVE BADGE
========================= */
#live
{
    display: flex;
    justify-content: center;
    padding: 20px 0 10px;
}

.livenow
{
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--secondary-green), var(--deep-forest));
    color: #fff;
    padding: 8px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .12em;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(0, 255, 136, .4);
    animation: glowPulse 2s infinite;
    position: relative;
    overflow: visible;
}

.livenow div
{
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    border-radius: 50%;
    animation: livePulse 1.2s infinite;
}

.livenow::before,
.livenow::after
{
    content: '✦';
    position: absolute;
    font-size: 14px;
    color: rgba(0, 255, 136, .8);
    animation: sparkleTwinkle 1.8s infinite ease-in-out;
}

.livenow::before { top: -10px; left: -4px; animation-delay: 0s; }
.livenow::after  { bottom: -10px; right: -4px; animation-delay: .9s; }

/* =========================
   MAIN WRAPPER
========================= */
.div-bg-white
{
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 960px;
    margin: 20px auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .2);
    clear: both;
    color: #fff;
}

#logo-back img
{
    border-radius: 50%;
    border: 3px solid var(--primary-green);
    margin-bottom: 10px;
    transition: transform .3s;
}

#logo-back img:hover { transform: rotate(10deg) scale(1.1); }

.div-bg-white h2
{
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 6px 0 4px;
}

.sortnow
{
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--primary-green) !important;
    letter-spacing: .1em;
    text-transform: uppercase;
}

hr
{
    border: none;
    border-top: 1px solid rgba(0, 255, 136, .12);
    margin: 16px 0 24px;
}

/* =========================
   LOADER
========================= */
.loader-wrapper
{
    text-align: center;
    padding: 40px 0;
}

.loader-wrapper i, .loader-wrapper span {
    color: var(--primary-green) !important;
}

/* =========================
   POSITION TITLE
========================= */
.result-position-title
{
    text-align: center;
    margin: 28px 0 16px;
}

.result-position-title h1
{
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, var(--secondary-green), var(--deep-forest));
    padding: 8px 28px;
    border-radius: 30px;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    animation: bounceIn .5s cubic-bezier(.22,1,.36,1) both;
    position: relative;
    border: 1px solid var(--primary-green);
}

.result-position-title h1::before
{
    content: '✦';
    position: absolute;
    left: -18px; top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--primary-green);
    animation: sparkleTwinkle 1.5s infinite ease-in-out;
}

.result-position-title h1::after
{
    content: '✦';
    position: absolute;
    right: -18px; top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--accent-blue);
    animation: sparkleTwinkle 1.5s .75s infinite ease-in-out;
}

/* =========================
   RESULT CARD GRID
========================= */
.result-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    padding-top: 16px;
    overflow: visible;
}

/* =========================
   RESULT CARD
========================= */
.result-card
{
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 136, .12);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    position: relative;
    /*transition: box-shadow .2s, transform .2s;
    animation: slideInCard .4s ease both;*/
    min-width: 0;
    overflow: visible;
    margin-top: 16px;
}

.result-card:hover
{
    box-shadow: 0 8px 24px rgba(0, 255, 136, .18);
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
}

/* =========================
   RANK BADGE
========================= */
.result-rank-badge
{
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-green), var(--accent-blue));
    color: var(--deep-forest);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
    transition: background .4s ease;
    z-index: 2;
    white-space: nowrap;
}

/* =========================
   CARD IMAGE
========================= */
.result-img
{
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(0, 255, 136, .2);
    display: block;
    margin: 8px auto 10px;
    transition: transform .3s, border-color .3s;
}

.result-card:hover .result-img
{
    transform: scale(1.08);
    border-color: var(--primary-green);
}

/* =========================
   CARD TEXT
========================= */
.result-name
{
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    display: block;
    width: 100%;
    word-break: break-word;
    margin-bottom: 4px;
}

.result-party
{
    font-size: 10px;
    font-weight: 500;
    color: var(--primary-green);
    letter-spacing: .06em;
    text-transform: uppercase;
    display: block;
    width: 100%;
    word-break: break-word;
    margin-bottom: 10px;
}

/* =========================
   PROGRESS BAR
========================= */
.result-bar-wrap
{
    width: 100%;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 8px;
    height: 28px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.result-bar
{
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-green) 0%, var(--primary-green) 50%, var(--secondary-green) 100%);
    background-size: 200% auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
    min-width: 28px;
    transition: width .8s cubic-bezier(.22,1,.36,1);
    animation: shimmer 2.5s linear infinite;
}

/* =========================
   VOTE COUNT
========================= */
.result-votes
{
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    display: block;
}

/* =========================
   FOOTER
========================= */
footer
{
    background: var(--deep-forest);
    padding: 40px 20px 20px;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    color: #fff;
    border-top: 1px solid var(--secondary-green);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    text-align: center;
}

.footer-brand h3 {
    color: var(--primary-green);
    font-weight: 800;
    margin-bottom: 15px;
}

.footer-brand p {
    color: #ccc;
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto 20px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.social-link {
    font-size: 24px;
    text-decoration: none;
    transition: transform 0.3s;
}

.social-link:hover {
    transform: scale(1.2);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #888;
}

.footer-bottom a {
    color: var(--primary-green);
    text-decoration: none;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px)
{
    .div-bg-white   { padding: 20px 14px; margin: 10px; border-radius: 12px; }

    .result-grid
    {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        padding-top: 16px;
    }

    .result-card    { margin-top: 16px; }
    .result-img     { width: 60px; height: 60px; }
    .result-name    { font-size: 12px; }
    .result-party   { font-size: 9px; }
    .result-votes   { font-size: 11px; }
}

@media (max-width: 400px)
{
    .result-grid    { grid-template-columns: 1fr; gap: 10px; padding-top: 14px; }
    .result-card    { padding: 24px 10px 12px; margin-top: 14px; }
    .result-img     { width: 75px; height: 75px; }
    .result-name    { font-size: 13px; }
    .result-bar     { font-size: 11px; }
}

/* =========================
   ACCESSIBILITY
========================= */
@media (prefers-reduced-motion: reduce)
{
    *, *::before, *::after
    {
        animation: none !important;
        transition: none !important;
    }
}
