/* ================================================================
   PAGES VOTE — /vote (saisie du pseudo) et /vote/{pseudo}
   S'appuie sur znv-ui.css (boutons, cartes, alertes, formulaires).
   Accent or (rappel du lien "Voter" de la navbar).
   Hooks JS à conserver (public/js/pages/vote.js) :
   .vote-site-card[data-site], [data-status], [data-status-label],
   [data-status-icon] (.dot / .spinner), [data-timer], [data-vote-btn]
   (.disabled), [data-manual-claim] (.d-none), .vote-rank-pill,
   #reward-toast (.show), #reward-toast-text, #vote-live-status
   ================================================================ */

.vote-page {
    --accent: #FFD93D;
    --vote-line: rgba(255, 255, 255, .09);
    --vote-surface: rgba(255, 255, 255, .035);
    --vote-muted: #b9bac4;
}

.vote-gold {
    color: var(--accent);
    font-weight: 700;
}

.vote-page a:focus-visible,
.vote-page button:focus-visible,
.vote-table-scroll:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- En-tête ---------- */
.vote-hero {
    padding-top: calc(70px + clamp(2.5rem, 1.5rem + 4vw, 5.5rem));
    padding-bottom: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
}

.vote-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    gap: 2rem 3rem;
    align-items: center;
}

.vote-hero .znv-page-lead {
    margin-bottom: 1.4rem;
}

.vote-perk-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vote-perk-list li {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 36px;
    padding: .35rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--znv-line-strong);
    background: rgba(10, 12, 16, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #eceef3;
    font-size: .88rem;
    font-weight: 500;
}

.vote-perk-list .bi {
    color: var(--accent);
}

/* Panneau verre (profil joueur / formulaire) */
.vote-player-panel,
.vote-form-panel {
    padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
    border-radius: var(--znv-r-lg);
    border: 1px solid var(--znv-line-strong);
    background: rgba(10, 12, 16, .62);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

.vote-player-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem 1.1rem;
    align-items: center;
}

.vote-avatar {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    border: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
    background: #1c1f24;
    image-rendering: pixelated;
    object-fit: cover;
}

.vote-player-info {
    display: grid;
    gap: .3rem;
    justify-items: start;
    min-width: 0;
}

.vote-player-kicker {
    color: var(--vote-muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.vote-player-name {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    color: #fff !important;
    font-family: 'Paytone One', sans-serif;
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-rank-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .8rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: .88rem;
    font-weight: 600;
}

.vote-reset-line {
    grid-column: 1 / -1;
    margin: 0;
    padding-top: .9rem;
    border-top: 1px solid var(--vote-line);
    color: var(--vote-muted) !important;
    font-size: .88rem;
}

.vote-reset-line strong {
    color: #fff;
}

/* ---------- Titres de section ---------- */
.vote-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1.75rem;
}

.vote-section-head--center {
    justify-content: center;
    text-align: center;
}

.vote-h2 {
    margin: 0 0 .4rem;
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    line-height: 1.1;
    text-wrap: balance;
}

.vote-section-sub {
    max-width: 40rem;
    margin: 0;
    color: var(--vote-muted) !important;
    font-size: .98rem;
    line-height: 1.55;
}

.vote-section-head--center .vote-section-sub {
    margin: 0 auto;
}

/* Étapes 1-2-3 */
.vote-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vote-steps li {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .85rem .4rem .45rem;
    border-radius: 999px;
    border: 1px solid var(--vote-line);
    background: var(--vote-surface);
    color: #e3e5ea;
    font-size: .88rem;
}

.vote-step-num {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #0a0b0e;
    font-size: .78rem;
    font-weight: 800;
}

/* ---------- Sites de vote ---------- */
.vote-sites-section {
    background: var(--znv-bg);
}

.vote-sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    gap: 1rem;
}

.vote-site-card {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    padding: 1.35rem;
    border-radius: var(--znv-r-lg);
    border: 1px solid var(--znv-line);
    background: var(--znv-surface-2);
    transition: border-color .25s, box-shadow .25s, background-color .25s;
}

/* État "disponible" : la carte ressort (navigateurs récents) */
.vote-site-card:has(.vote-status.is-ready) {
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    background:
        radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
        var(--znv-surface-2);
}

.vote-site-card:has(.vote-status.is-ready):hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, .35);
}

.vote-site-card:has(.vote-status.is-checking) {
    border-color: rgba(56, 193, 233, .45);
}

.vote-site-card:has(.vote-status.is-claimed) {
    border-color: rgba(61, 220, 132, .4);
}

.vote-site-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .6rem;
}

.vote-site-name {
    margin: 0;
    color: #fff !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

/* Pastille d'état */
.vote-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    width: fit-content;
    padding: .25rem .7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}

.vote-status.is-ready    { color: var(--znv-success); background: rgba(61, 220, 132, .1);  border-color: rgba(61, 220, 132, .4); }
.vote-status.is-waiting  { color: var(--znv-warning); background: rgba(240, 160, 75, .1);  border-color: rgba(240, 160, 75, .4); }
.vote-status.is-checking { color: #5fd0f0;            background: rgba(56, 193, 233, .1);  border-color: rgba(56, 193, 233, .45); }
.vote-status.is-claimed  { color: var(--accent);      background: rgba(255, 217, 61, .1);  border-color: rgba(255, 217, 61, .45); }

.vote-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.vote-status.is-ready .dot,
.vote-status.is-checking .dot {
    animation: vote-pulse 1.6s ease-in-out infinite;
}

.vote-status .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: vote-spin .7s linear infinite;
}

@keyframes vote-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes vote-spin  { to { transform: rotate(360deg); } }

/* Récompense + délai */
.vote-site-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vote-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    border-radius: var(--znv-r-sm);
    border: 1px solid var(--vote-line);
    background: var(--vote-surface);
    color: #d6d8df;
    font-size: .82rem;
    font-weight: 500;
}

.vote-chip--gold {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-weight: 600;
}

/* Chrono / message (texte écrit par le JS) */
.vote-timer {
    min-height: 1.45em;
    color: #d6d8df;
    font-size: .92rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
}

.vote-site-actions {
    display: grid;
    gap: .5rem;
    margin-top: auto;
}

/* Bouton Voter */
.vote-btn {
    min-height: 52px;
    font-size: 1rem;
    letter-spacing: .02em;
}

.vote-btn .bi {
    font-size: .95em;
}

.vote-btn.disabled,
.vote-btn[aria-disabled="true"] {
    border-color: var(--vote-line);
    background: rgba(255, 255, 255, .06);
    color: var(--vote-muted) !important;
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
}

/* Bouton de secours "J'ai voté mais rien ne se passe ?" */
.vote-fallback {
    min-height: 44px;
    border-style: dashed;
    font-size: .88rem;
    font-weight: 600;
}

/* ---------- Classement ---------- */
.vote-ranking-section .znv-eyebrow {
    margin-bottom: .5rem;
}

.vote-podium {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: .75rem;
    max-width: 720px;
    margin: 0 auto 1.75rem;
    padding: 0;
    list-style: none;
}

.vote-podium-spot {
    display: grid;
    justify-items: center;
    gap: .35rem;
    min-width: 0;
    padding: 1.1rem .6rem 1rem;
    border-radius: var(--znv-r-lg);
    border: 1px solid var(--vote-line);
    background: var(--znv-surface-2);
    text-align: center;
}

/* Ordre visuel 2 - 1 - 3 (le DOM reste 1, 2, 3) */
.vote-podium-spot--1 {
    order: 2;
    padding-top: 1.6rem;
    padding-bottom: 1.5rem;
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background:
        radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
        var(--znv-surface-2);
}

.vote-podium-spot--2 { order: 1; }
.vote-podium-spot--3 { order: 3; }

.vote-podium-avatar {
    position: relative;
    margin-bottom: .35rem;
}

.vote-podium-avatar img,
.vote-podium-empty {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, .12);
    background: #1c1f24;
    color: #6c6f7a;
    font-size: 1.6rem;
    image-rendering: pixelated;
}

.vote-podium-spot--1 .vote-podium-avatar img {
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.vote-medal {
    position: absolute;
    right: -8px;
    bottom: -8px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #0f1014;
    color: #0d0d0f;
    font-size: .85rem;
    font-weight: 800;
}

.vote-medal--gold   { background: linear-gradient(135deg, #f6d365, #fda085); }
.vote-medal--silver { background: linear-gradient(135deg, #bdc3c7, #ececec); }
.vote-medal--bronze { background: linear-gradient(135deg, #d0a07b, #b37346); }

.vote-podium-name {
    max-width: 100%;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vote-podium-name a {
    color: #fff;
}

.vote-podium-name a:hover {
    color: var(--accent);
    text-decoration: underline !important;
}

.vote-podium-points {
    color: var(--vote-muted);
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
}

/* Tableau complet */
.vote-ranking-card {
    max-width: 820px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--znv-r-lg);
    border: 1px solid var(--vote-line);
    background: var(--znv-surface-2);
}

.vote-table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.vote-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.vote-table th,
.vote-table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    vertical-align: middle;
}

.vote-table thead th {
    border-bottom: 1px solid var(--vote-line);
    color: var(--vote-muted) !important;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.vote-table tbody tr:last-child td {
    border-bottom: 0;
}

.vote-table tbody tr {
    transition: background-color .15s;
}

.vote-table tbody tr:hover {
    background: rgba(255, 255, 255, .03);
}

.vote-col-rank  { width: 5.5rem; text-align: center; }
.vote-col-name  { text-align: left; }
.vote-col-count { width: 8rem; text-align: right; }

.rank-num {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    color: #d6d8df;
    font-size: .85rem;
    font-weight: 700;
}

.rank-num.gold   { background: linear-gradient(135deg, #f6d365, #fda085); color: #3a2300; }
.rank-num.silver { background: linear-gradient(135deg, #bdc3c7, #ececec); color: #22282f; }
.rank-num.bronze { background: linear-gradient(135deg, #d0a07b, #b37346); color: #2b1000; }

.vote-page .classement-pseudo {
    color: #eceef3;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.vote-page a.classement-pseudo:hover {
    color: var(--accent);
    text-decoration: underline !important;
}

/* Ma ligne */
.vote-table tbody tr.row-me {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.vote-table tbody tr.row-me .classement-pseudo {
    color: #fff;
}

.vote-me-badge {
    display: inline-block;
    margin-left: .4rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--accent);
    color: #0a0b0e;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.vote-table td.vote-table-empty {
    padding: 2rem 1rem;
    color: var(--vote-muted) !important;
    text-align: center;
}

/* ---------- Toast récompense ---------- */
#reward-toast {
    position: fixed;
    top: 86px;
    right: 24px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: .6rem;
    max-width: calc(100vw - 32px);
    padding: .9rem 1.2rem;
    border-radius: var(--znv-r-md);
    border: 1px solid rgba(61, 220, 132, .5);
    background: #10281b;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
    /* Caché par opacité + léger décalage : le repousser hors écran créait un
       défilement horizontal et laissait dépasser un bout du toast */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .4s;
}

#reward-toast .bi {
    color: var(--znv-success);
    font-size: 1.2rem;
}

#reward-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}

/* ---------- Page /vote : formulaire + raisons ---------- */
.vote-form-title {
    margin: 0 0 .3rem;
    font-size: 1.35rem;
}

.vote-form-sub {
    margin: 0 0 1.2rem;
    color: var(--vote-muted) !important;
    font-size: .92rem;
}

.vote-form-alert {
    margin-bottom: 1rem;
}

.vote-page .znv-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.vote-page .znv-input[aria-invalid="true"] {
    border-color: var(--znv-danger);
}

.vote-form-help {
    text-align: center;
    line-height: 1.5;
}

.vote-form-help a {
    color: var(--accent);
    font-weight: 600;
}

.vote-form-help a:hover {
    text-decoration: underline !important;
}

.vote-perks-section {
    background: var(--znv-bg);
}

.vote-perks-grid {
    gap: 1rem;
}

.vote-perk-card {
    height: 100%;
    transition: border-color .25s, transform .25s;
}

.vote-perk-card:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    transform: translateY(-3px);
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .vote-hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .vote-player-panel,
    .vote-form-panel {
        max-width: 560px;
    }
}

@media (max-width: 575.98px) {
    .vote-section-head {
        margin-bottom: 1.25rem;
    }

    .vote-site-card {
        padding: 1.1rem;
    }

    .vote-avatar {
        width: 72px;
        height: 72px;
    }

    .vote-podium {
        gap: .5rem;
    }

    .vote-podium-spot {
        padding: .9rem .35rem .8rem;
    }

    .vote-podium-spot--1 {
        padding-top: 1.2rem;
    }

    .vote-podium-avatar img,
    .vote-podium-empty {
        width: 52px;
        height: 52px;
        border-radius: 10px;
        font-size: 1.2rem;
    }

    .vote-medal {
        width: 24px;
        height: 24px;
        font-size: .75rem;
    }

    .vote-podium-name {
        font-size: .88rem;
    }

    .vote-table th,
    .vote-table td {
        padding: .6rem .6rem;
    }

    .vote-col-rank  { width: 3.5rem; }
    .vote-col-count { width: 5.5rem; }

    #reward-toast {
        top: auto;
        right: 16px;
        bottom: 16px;
        left: 16px;
        max-width: none;
        transform: translateY(12px);
    }

    #reward-toast.show {
        transform: translateY(0);
    }
}

/* ---------- Moins d'animations ---------- */
@media (prefers-reduced-motion: reduce) {
    .vote-status .dot,
    .vote-status.is-ready .dot,
    .vote-status.is-checking .dot {
        animation: none;
    }

    .vote-status .spinner {
        animation-duration: 2.4s;
    }

    .vote-site-card,
    .vote-perk-card,
    .vote-table tbody tr,
    #reward-toast {
        transition: none;
    }

    .vote-perk-card:hover {
        transform: none;
    }
}
