/* ============================================================
   LA MELLERYSIENNE – Styles principaux
   Mobile First · Néon · Premium
   ============================================================ */

:root {
    --neon-red: #FF3B3B;
    --neon-red-dark: #B30000;
    --neon-gold: #FFD166;
    --black: #0B0B0B;
    --anthracite: #171717;
    --anthracite-light: #222222;
    --off-white: #F5F5F5;
    --gray: #888888;
    --gray-dark: #333333;

    --font-display: 'Bebas Neue', sans-serif;
    --font-script: 'Great Vibes', cursive;
    --font-body: 'Outfit', sans-serif;

    --glow-red: 0 0 10px var(--neon-red), 0 0 20px rgba(255, 59, 59, 0.5), 0 0 40px rgba(179, 0, 0, 0.3);
    --glow-red-sm: 0 0 8px rgba(255, 59, 59, 0.6), 0 0 16px rgba(255, 59, 59, 0.3);
    --glow-gold: 0 0 10px var(--neon-gold), 0 0 20px rgba(255, 209, 102, 0.4);

    --radius: 12px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 60px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--black);
    color: var(--off-white);
    line-height: 1.6;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--neon-red);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--neon-gold);
}

/* ---- Background néon ---- */
.neon-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--black);
    overflow: hidden;
}

.neon-bg__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: glowDrift 12s ease-in-out infinite alternate;
}

.neon-bg__glow--red {
    width: 60vw;
    height: 60vw;
    max-width: 500px;
    max-height: 500px;
    background: radial-gradient(circle, var(--neon-red) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.neon-bg__glow--gold {
    width: 50vw;
    height: 50vw;
    max-width: 400px;
    max-height: 400px;
    background: radial-gradient(circle, var(--neon-gold) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -6s;
}

.neon-bg__particles {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255, 59, 59, 0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 70%, rgba(255, 209, 102, 0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    background-size: 200px 200px;
}

/* ---- Typography ---- */
.hero__title-main,
.vote-header__title,
.qrcode-header__title,
.merci__title {
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--off-white);
    text-shadow: var(--glow-red-sm);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: linear-gradient(135deg, var(--neon-red) 0%, var(--neon-red-dark) 100%);
    color: var(--off-white);
    border-color: var(--neon-red);
    box-shadow: var(--glow-red-sm);
}

.btn--primary:hover,
.btn--primary:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--glow-red);
    color: var(--off-white);
}

.btn--ghost {
    background: transparent;
    color: var(--off-white);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn--ghost:hover {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: var(--glow-red-sm);
}

.btn--vote {
    width: 100%;
    background: transparent;
    color: var(--neon-red);
    border: 2px solid var(--neon-red);
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    box-shadow: var(--glow-red-sm);
}

.btn--vote:hover {
    background: var(--neon-red);
    color: var(--off-white);
    box-shadow: var(--glow-red);
}

.btn--glow {
    animation: btnPulse 3s ease-in-out infinite;
}

.btn--full { width: 100%; }
.btn--small { padding: 0.5rem 1rem; font-size: 0.75rem; }
.btn--danger { border-color: #ff4444; color: #ff4444; }
.btn--danger:hover { background: #ff4444; color: white; }

/* ---- Home Page ---- */
.home {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.hero {
    text-align: center;
    max-width: 520px;
    width: 100%;
    position: relative;
}

.hero__logo-img {
    width: min(280px, 70vw);
    height: auto;
    margin: 0 auto 1.5rem;
    filter: drop-shadow(0 0 20px rgba(255, 59, 59, 0.5));
}

.hero__title {
    margin-bottom: 0.5rem;
}

.hero__title-main {
    display: block;
    font-size: clamp(2rem, 8vw, 3.5rem);
    line-height: 1.1;
}

.hero__title-sub {
    display: block;
    font-family: var(--font-script);
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    color: var(--neon-gold);
    text-shadow: var(--glow-gold);
    text-transform: none;
    letter-spacing: 0;
    margin-top: 0.25rem;
}

.hero__subtitle {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    color: var(--off-white);
    margin-bottom: 1.5rem;
}

.hero__subtitle strong {
    color: var(--neon-red);
    text-shadow: var(--glow-red-sm);
}

.hero__text {
    color: var(--gray);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero__text p + p {
    margin-top: 0.75rem;
}

.hero__hint {
    font-size: 0.8125rem;
    color: var(--neon-gold);
    opacity: 0.8;
}

.hero__closed {
    color: var(--gray);
    font-style: italic;
}

.hero__decor .star {
    position: absolute;
    font-size: 1.25rem;
    animation: starTwinkle 4s ease-in-out infinite;
}

.star--red { color: var(--neon-red); text-shadow: var(--glow-red-sm); }
.star--gold { color: var(--neon-gold); text-shadow: var(--glow-gold); }
.star--1 { top: 5%; left: 10%; }
.star--2 { top: 15%; right: 8%; animation-delay: -1s; }
.star--3 { bottom: 20%; left: 5%; animation-delay: -2s; }
.star--4 { bottom: 10%; right: 12%; animation-delay: -3s; }

/* ---- Vote Page ---- */
.vote-page {
    padding: 1rem 1rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.vote-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.vote-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 59, 59, 0.3);
    color: var(--neon-red);
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: all var(--transition);
}

.vote-header__back:hover {
    background: rgba(255, 59, 59, 0.1);
    box-shadow: var(--glow-red-sm);
    color: var(--neon-red);
}

.vote-header__title {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    line-height: 1.2;
}

.vote-header__sub {
    font-size: 0.8125rem;
    color: var(--gray);
}

.vote-search {
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    margin-bottom: 0.5rem;
}

.search-box__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--gray);
    pointer-events: none;
}

.search-box__input {
    width: 100%;
    padding: 0.875rem 2.75rem 0.875rem 3rem;
    background: var(--anthracite);
    border: 1px solid rgba(255, 59, 59, 0.2);
    border-radius: var(--radius);
    color: var(--off-white);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition);
}

.search-box__input:focus {
    outline: none;
    border-color: var(--neon-red);
    box-shadow: var(--glow-red-sm);
}

.search-box__input::placeholder {
    color: var(--gray);
}

.search-box__clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.vote-count {
    font-size: 0.8125rem;
    color: var(--gray);
}

.participants-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.participant-card {
    background: var(--anthracite);
    border: 1px solid rgba(255, 59, 59, 0.15);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
}

.participant-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 59, 59, 0.4);
    box-shadow: 0 8px 32px rgba(255, 59, 59, 0.15);
}

.participant-card[hidden] {
    display: none;
}

.participant-card__numero {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    background: var(--neon-red);
    color: var(--off-white);
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    letter-spacing: 0.05em;
    box-shadow: var(--glow-red-sm);
    line-height: 1.2;
}

.participant-card__photo-wrap {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--black);
}

.participant-card__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.participant-card:hover .participant-card__photo {
    transform: scale(1.05);
}

.participant-card__body {
    padding: 1rem 1.25rem 1.25rem;
}

.participant-card__nom {
    font-family: var(--font-display);
    font-size: 1.375rem;
    letter-spacing: 0.04em;
    color: var(--off-white);
    margin-bottom: 0.5rem;
}

.participant-card__desc {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.participant-card__voted {
    display: block;
    text-align: center;
    color: var(--neon-gold);
    font-size: 0.875rem;
    padding: 0.75rem;
    border: 1px dashed rgba(255, 209, 102, 0.3);
    border-radius: var(--radius);
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    background: var(--anthracite);
    border: 1px solid rgba(255, 59, 59, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 0 60px rgba(255, 59, 59, 0.2);
    animation: modalIn 0.3s ease;
}

.modal__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    color: var(--neon-red);
    text-shadow: var(--glow-red-sm);
}

.modal__text {
    color: var(--gray);
    font-size: 0.875rem;
}

.modal__participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.25rem;
    margin: 1rem 0;
    background: rgba(255, 59, 59, 0.05);
    border: 1px solid rgba(255, 59, 59, 0.2);
    border-radius: var(--radius);
}

.modal__numero {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--neon-red);
    text-shadow: var(--glow-red-sm);
}

.modal__nom {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal__warning {
    font-size: 0.8125rem;
    color: var(--neon-gold);
    margin-bottom: 1.25rem;
    text-align: center;
}

.modal__actions {
    display: flex;
    gap: 0.75rem;
}

.modal__actions .btn {
    flex: 1;
}

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    pointer-events: none;
}

/* ---- Alerts ---- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.alert--info {
    background: rgba(255, 209, 102, 0.1);
    border: 1px solid rgba(255, 209, 102, 0.3);
    color: var(--neon-gold);
}

.alert--error {
    background: rgba(255, 59, 59, 0.1);
    border: 1px solid rgba(255, 59, 59, 0.3);
    color: var(--neon-red);
}

.alert--success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.alert__link {
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* ---- Merci Page ---- */
.merci-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.merci {
    text-align: center;
    max-width: 480px;
}

.merci__animation {
    position: relative;
    margin-bottom: 2rem;
}

.merci__checkmark {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.checkmark-svg {
    width: 100%;
    height: 100%;
}

.checkmark-circle {
    stroke: var(--neon-red);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: strokeCircle 0.6s ease forwards;
}

.checkmark-check {
    stroke: var(--neon-gold);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: strokeCheck 0.4s 0.5s ease forwards;
}

.merci__title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    margin-bottom: 0.25rem;
}

.merci__subtitle {
    font-family: var(--font-script);
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: var(--neon-gold);
    text-shadow: var(--glow-gold);
    margin-bottom: 1.5rem;
}

.merci__message {
    font-size: 1.125rem;
    color: var(--neon-red);
    font-weight: 600;
    margin-bottom: 1rem;
    text-shadow: var(--glow-red-sm);
}

.merci__detail {
    color: var(--gray);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.merci__actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ---- QR Code Page ---- */
.qrcode-page {
    padding: 2rem 1.25rem 3rem;
    max-width: 600px;
    margin: 0 auto;
}

.qrcode-header {
    text-align: center;
    margin-bottom: 2rem;
}

.qrcode-header__title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin-bottom: 0.5rem;
}

.qrcode-header__sub {
    color: var(--gray);
    font-size: 0.9375rem;
}

.qrcode-card {
    background: var(--anthracite);
    border: 1px solid rgba(255, 59, 59, 0.2);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 59, 59, 0.1);
}

.qrcode-card__frame {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    display: inline-block;
    margin-bottom: 1.5rem;
    box-shadow: var(--glow-red-sm);
}

#qrcodeCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.qrcode-svg {
    display: none;
}

.qrcode-card__url {
    margin-bottom: 1.5rem;
    text-align: left;
}

.qrcode-card__label {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.qrcode-card__url-row {
    display: flex;
    gap: 0.5rem;
}

.qrcode-card__input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--black);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--off-white);
    font-size: 0.8125rem;
    font-family: monospace;
}

.qrcode-card__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qrcode-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 59, 59, 0.05);
    border: 1px solid rgba(255, 59, 59, 0.15);
    border-radius: var(--radius-lg);
}

.qrcode-info h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    color: var(--neon-red);
    margin-bottom: 1rem;
}

.qrcode-info ul {
    list-style: none;
    padding: 0;
}

.qrcode-info li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    font-size: 0.875rem;
    color: var(--gray);
}

.qrcode-info li::before {
    content: '★';
    position: absolute;
    left: 0;
    color: var(--neon-gold);
    font-size: 0.75rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

/* ---- Responsive ---- */
@media (min-width: 480px) {
    .participants-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .qrcode-card__actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .participants-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .vote-page {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .participants-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media print {
    .neon-bg, .qrcode-info, .qrcode-card__actions, .qrcode-card__url {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .qrcode-card {
        border: none;
        box-shadow: none;
    }
}
