/* ===================================================
   BUZZER FORMATION - Thème Noir / Blanc / Gris
   =================================================== */

:root {
    --black: #0a0a0a;
    --black-soft: #141414;
    --gray-900: #1a1a1a;
    --gray-800: #2a2a2a;
    --gray-700: #3a3a3a;
    --gray-600: #555555;
    --gray-500: #777777;
    --gray-400: #999999;
    --gray-300: #bbbbbb;
    --gray-200: #dddddd;
    --gray-100: #eeeeee;
    --white: #ffffff;
    --danger: #cc0000;
    --danger-dark: #990000;
    --success: #00aa44;
    --success-dark: #008833;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.7);
    --transition: 0.2s ease;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--black);
    min-height: 100vh;
    color: var(--gray-200);
}

/* ===== HEADER ===== */
.header {
    background: var(--black-soft);
    color: var(--white);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-800);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--white);
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--white);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-btn {
    background: none;
    border: 1px solid var(--gray-700);
    color: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all var(--transition);
}

.header-btn:hover {
    background: var(--gray-800);
    border-color: var(--gray-500);
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== PAGE ACCUEIL ===== */
.home-container {
    max-width: 640px;
    margin: 50px auto;
    padding: 0 20px;
    text-align: center;
}

.home-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--white);
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(255,255,255,0.1);
}

.home-logo svg {
    width: 50px;
    height: 50px;
    fill: var(--black);
}

.home-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.home-subtitle {
    font-size: 1rem;
    color: var(--gray-400);
    margin-bottom: 36px;
    line-height: 1.6;
}

.home-card {
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
    text-align: left;
}

.home-card h2 {
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--white);
    text-align: center;
}

/* ===== FORMULAIRES ===== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-300);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input[type="text"],
.input-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-700);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition);
    outline: none;
    background: var(--gray-800);
    color: var(--white);
}

.input-group input:focus {
    border-color: var(--white);
}

.input-group input::placeholder {
    color: var(--gray-600);
}

/* ===== RADIO GROUPS ===== */
.radio-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-700);
    transition: all var(--transition);
    font-size: 0.95rem;
    color: var(--gray-300);
}

.radio-option:hover {
    border-color: var(--gray-500);
}

.radio-option.selected {
    border-color: var(--white);
    background: var(--gray-800);
    color: var(--white);
}

.radio-option input[type="radio"] {
    accent-color: var(--white);
    width: 16px;
    height: 16px;
}

/* ===== BOUTONS ===== */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--white);
    color: var(--black);
}

.btn-primary:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255,255,255,0.15);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-dark {
    background: var(--gray-800);
    color: var(--white);
    border: 1px solid var(--gray-600);
}

.btn-dark:hover {
    background: var(--gray-700);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-warning {
    background: var(--gray-700);
    color: var(--white);
}

.btn-warning:hover {
    background: var(--gray-600);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.05rem;
}

/* ===== HOST DASHBOARD ===== */
.host-container {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 20px 100px;
}

/* Barre de lien */
.link-bar {
    background: var(--gray-900);
    border: 1px solid var(--gray-700);
    color: var(--white);
    padding: 16px 24px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.link-bar span {
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--gray-300);
}

.link-bar strong {
    color: var(--white);
}

.link-actions {
    display: flex;
    gap: 8px;
}

.link-actions button {
    background: var(--gray-800);
    border: 1px solid var(--gray-600);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
}

.link-actions button:hover {
    background: var(--gray-700);
}

/* ===== SECTION PARTICIPANTS ===== */
.participants-section {
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.participants-section h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--white);
    letter-spacing: 0.5px;
}

.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}

.participant-card {
    text-align: center;
    padding: 16px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-800);
    background: var(--gray-800);
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

.participant-card:hover {
    border-color: var(--gray-500);
}

.participant-card.buzzed {
    border-color: var(--white);
    background: var(--gray-700);
    animation: buzzPulse 0.5s ease;
}

@keyframes buzzPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.participant-card .avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    background: var(--gray-600);
    border: 2px solid var(--gray-500);
}

.participant-card .name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--white);
}

.participant-card .score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-300);
}

.participant-card .buzz-order {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--white);
    color: var(--black);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.no-participants {
    color: var(--gray-500);
    font-style: italic;
    padding: 30px;
    text-align: center;
}

/* ===== HOST CONTROLS ===== */
.host-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--black-soft);
    border-top: 1px solid var(--gray-800);
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 16px;
    z-index: 50;
}

/* ===== MODALES ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--gray-900);
    border: 1px solid var(--gray-700);
    border-radius: var(--radius);
    padding: 36px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-strong);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--white);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--white);
}

/* QR Code */
#qrcode-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    display: inline-flex;
}

/* Question Modal */
.question-icon {
    width: 160px;
    height: 130px;
    margin: 0 auto 16px;
}

.question-input-area {
    margin: 20px 0;
}

.question-input-area textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--gray-700);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    font-family: inherit;
    background: var(--gray-800);
    color: var(--white);
}

.question-input-area textarea:focus {
    border-color: var(--white);
}

.question-input-area textarea::placeholder {
    color: var(--gray-600);
}

/* Buzz Response Modal */
.buzz-response-modal .participant-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.buzz-response-modal .participant-info .avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    background: var(--gray-700);
    border: 3px solid var(--gray-500);
}

.buzz-response-modal .participant-info .name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
}

.response-field {
    background: var(--gray-800);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    min-height: 50px;
    font-style: italic;
    color: var(--gray-500);
    text-align: left;
    border: 1px solid var(--gray-700);
}

.response-field.has-text {
    color: var(--white);
    font-style: normal;
    font-weight: 500;
}

.points-input {
    margin-bottom: 20px;
    text-align: left;
}

.points-input label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-300);
}

.points-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-600);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    text-align: center;
    font-weight: 700;
    outline: none;
    background: var(--gray-800);
    color: var(--white);
}

.response-actions {
    display: flex;
    gap: 12px;
}

.response-actions .btn {
    flex: 1;
}

/* ===== STATISTIQUES ===== */
.stats-content {
    text-align: left;
}

.stats-content h3 {
    margin: 16px 0 10px;
    color: var(--white);
    font-size: 1rem;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.stat-bar .stat-name {
    width: 100px;
    font-weight: 600;
    text-align: right;
    font-size: 0.9rem;
    color: var(--gray-300);
}

.stat-bar .bar-container {
    flex: 1;
    height: 28px;
    background: var(--gray-800);
    border-radius: 14px;
    overflow: hidden;
}

.stat-bar .bar-fill {
    height: 100%;
    border-radius: 14px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--white);
    min-width: 40px;
}

.stat-bar .bar-fill.good { background: var(--white); color: var(--black); }
.stat-bar .bar-fill.bad { background: var(--gray-600); }

/* Classement */
.ranking-list {
    margin-top: 16px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
}

.ranking-item:nth-child(1) {
    background: var(--gray-700);
    border-color: var(--white);
}

.ranking-item:nth-child(2) {
    border-color: var(--gray-500);
}

.ranking-position {
    font-size: 1.3rem;
    font-weight: 800;
    width: 36px;
    text-align: center;
    color: var(--white);
}

.ranking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--gray-600);
}

.ranking-name {
    flex: 1;
    font-weight: 600;
    color: var(--white);
}

.ranking-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-300);
}

/* ===== VUE PARTICIPANT ===== */
.participant-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--black);
}

.participant-header {
    background: var(--black-soft);
    border-bottom: 1px solid var(--gray-800);
    color: var(--white);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.participant-header h1 {
    font-size: 1.2rem;
    color: var(--white);
}

/* Formulaire connexion participant */
.join-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 0 20px;
}

.join-card {
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.join-card h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--white);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.avatar-option {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gray-700);
    transition: all var(--transition);
    margin: 0 auto;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: var(--gray-500);
}

.avatar-option.selected {
    border-color: var(--white);
    box-shadow: 0 0 0 2px var(--white);
}

/* ===== BUZZER ===== */
.buzzer-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: var(--gray-900);
}

.buzzer-button {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    background: radial-gradient(circle at 40% 35%, #ff4444, #cc0000 50%, #880000);
    box-shadow:
        0 8px 0 #550000,
        0 12px 30px rgba(0,0,0,0.6),
        inset 0 -4px 12px rgba(0,0,0,0.3),
        inset 0 8px 20px rgba(255,255,255,0.1);
    transition: all 0.1s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.buzzer-button::before {
    content: '';
    position: absolute;
    top: -16px;
    left: -16px;
    right: -16px;
    bottom: -16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #333, #0a0a0a);
    z-index: -1;
    box-shadow: 0 4px 30px rgba(0,0,0,0.7);
}

.buzzer-button:active {
    transform: translateY(4px);
    box-shadow:
        0 4px 0 #550000,
        0 6px 15px rgba(0,0,0,0.6),
        inset 0 -2px 8px rgba(0,0,0,0.3),
        inset 0 4px 10px rgba(255,255,255,0.05);
}

.buzzer-button.disabled {
    background: radial-gradient(circle at 40% 35%, #555, #333 50%, #222);
    box-shadow:
        0 8px 0 #111,
        0 12px 30px rgba(0,0,0,0.6),
        inset 0 -4px 12px rgba(0,0,0,0.3);
    cursor: not-allowed;
}

.buzzer-button.buzzed {
    background: radial-gradient(circle at 40% 35%, #eee, #bbb 50%, #888);
    box-shadow:
        0 8px 0 #555,
        0 12px 30px rgba(255,255,255,0.1),
        inset 0 -4px 12px rgba(0,0,0,0.2),
        inset 0 8px 20px rgba(255,255,255,0.3);
    animation: buzzSuccess 0.3s ease;
}

@keyframes buzzSuccess {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95); }
}

.buzzer-status {
    margin-top: 24px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-400);
    text-align: center;
}

.participant-score-bar {
    background: var(--black-soft);
    border-top: 1px solid var(--gray-800);
    padding: 16px;
    text-align: center;
}

.participant-score-bar .score-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.participant-score-bar .score-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--white);
}

/* En attente */
.waiting-message {
    text-align: center;
    padding: 60px 20px;
}

.waiting-message .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gray-800);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.waiting-message p {
    font-size: 1.1rem;
    color: var(--gray-500);
}

/* Réponse écrite */
.write-response-area {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.write-response-area p {
    color: var(--gray-300);
}

.write-response-area textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--gray-600);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    outline: none;
    font-family: inherit;
    margin-bottom: 12px;
    background: var(--gray-800);
    color: var(--white);
}

.write-response-area textarea::placeholder {
    color: var(--gray-600);
}

/* Question affichée au participant */
.question-display {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    padding: 16px 20px;
    margin: 12px 20px;
    border-radius: var(--radius);
    text-align: center;
}

.question-display h3 {
    color: var(--gray-400);
    font-size: 0.9rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-display p {
    font-size: 1.05rem;
    color: var(--white);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    color: var(--white);
    font-weight: 600;
    z-index: 300;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
    box-shadow: var(--shadow);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--gray-700); border: 1px solid var(--gray-500); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== CREDIT FOOTER ===== */
.site-credit {
    text-align: center;
    padding: 14px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.site-credit a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color var(--transition);
}

.site-credit a:hover {
    color: var(--gray-300);
}

.site-credit--participant {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
}

.site-credit--participant a {
    pointer-events: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .home-title { font-size: 1.5rem; }
    .home-card { padding: 24px; }
    .buzzer-button { width: 200px; height: 200px; }
    .host-controls { flex-wrap: wrap; }
    .host-controls .btn { flex: 1; min-width: 100px; font-size: 0.85rem; padding: 12px 14px; }
    .link-bar { flex-direction: column; text-align: center; }
    .modal { padding: 24px; margin: 10px; }
    .avatar-grid { grid-template-columns: repeat(5, 1fr); }
    .header h1 { font-size: 1.1rem; }
    .response-actions { flex-direction: column; }
    .radio-row { flex-direction: column; gap: 8px; }
}
