/* =====================================================
   POÉMATON - THÈME "NUIT ÉTOILÉE"
   ===================================================== */

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

html, body {
    height: 100%;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: #0f0f1a;
    color: #e2e8f0;
    line-height: 1.6;
}

/* === VARIABLES CSS === */
:root {
    --primary: #8b5cf6;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --accent: #c4b5fd;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --highlight: #fbbf24;
    --bg-dark: #0f0f1a;
    --bg-card: rgba(30, 30, 74, 0.7);
    --bg-panel: rgba(30, 30, 74, 0.6);
    --border-color: rgba(139, 92, 246, 0.3);
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
}

/* === ÉTOILES ANIMÉES (fond) === */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 230px 80px, #fff, transparent),
        radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 350px 200px, #fff, transparent),
        radial-gradient(2px 2px at 400px 50px, rgba(255,255,255,0.8), transparent);
    background-size: 450px 250px;
    animation: twinkle 5s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* === PAGE STRUCTURE === */
.page-container {
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.page-centered {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* === PAGE 1 - ACCUEIL === */
.accueil-background {
    background: 
        radial-gradient(ellipse at top, #1a1a3e 0%, #0f0f1a 50%),
        radial-gradient(ellipse at bottom, #1e1e4a 0%, #0f0f1a 50%);
}

.accueil-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    padding: 3rem 2.5rem;
    max-width: 550px;
    width: 100%;
    text-align: center;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(139, 92, 246, 0.1);
}

.logo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

.app-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--primary-light);
    margin-bottom: 1.5rem;
    font-family: 'Segoe UI', sans-serif;
}

.accroche {
    font-size: 1.8rem;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 2.5rem;
    line-height: 1.5;
    text-shadow: 0 0 30px rgba(196, 181, 253, 0.3);
}

/* === BOUTONS === */
.buttons-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-family: inherit;
    border-radius: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 40px rgba(139, 92, 246, 0.6);
}

.btn-primary:disabled {
    background: #374151;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid rgba(196, 181, 253, 0.4);
}

.btn-secondary:hover {
    background: rgba(196, 181, 253, 0.1);
    border-color: var(--accent);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
}

/* === PAGE 2 & 3 - PARTICIPATION === */
.participation-page {
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1a3e 50%, #0f0f1a 100%);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* === GRILLE PARTICIPATION === */
.participation-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    max-height: calc(100vh - 2rem);
}

/* === PANNEAU TEXTE === */
.text-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    text-align: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.panel-header h2 {
    color: var(--primary-light);
    font-size: 1.1rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.3);
    transition: all 0.3s;
}

.step-dot.active {
    background: var(--primary-light);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

.poem-info {
    margin-top: 0.5rem;
}

.poem-title-small {
    color: var(--accent);
    font-style: italic;
    font-size: 1rem;
}

.poem-author-small {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    margin-top: 0.25rem;
}

.poem-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
}

.poem-line {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin: 0.2rem 0;
    padding-left: 1rem;
    border-left: 2px solid transparent;
    transition: all 0.3s ease;
}

/* === AUDIO GUIDE === */
.audio-guide {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.audio-guide-label {
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-player {
    width: 100%;
    height: 40px;
    border-radius: 20px;
}

/* === PANNEAU VIDÉO === */
.video-panel {
    background: var(--bg-panel);
    border: 2px solid var(--primary);
    border-radius: 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
}

.video-panel.recording {
    border-color: var(--danger);
    box-shadow: 0 0 60px rgba(239, 68, 68, 0.3);
}

.video-container {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    position: absolute;
    color: var(--primary-dark);
    text-align: center;
}

.video-placeholder .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* === BARRE DE PERMISSION === */
.permission-banner {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.permission-banner.pending {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: var(--warning);
    border-top: 1px solid rgba(251, 191, 36, 0.3);
}

.permission-banner.granted {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: var(--success);
    border-top: 1px solid rgba(34, 197, 94, 0.3);
}

.permission-banner.denied {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: var(--danger);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
}

.permission-banner button {
    padding: 0.5rem 1rem;
    background: var(--warning);
    color: #1a1a2e;
    border: none;
    border-radius: 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.permission-banner button:hover {
    background: #fbbf24;
    transform: scale(1.05);
}

.permission-banner.denied button {
    background: var(--danger);
    color: white;
}

/* === CONTRÃ”LES === */
.controls-bar {
    padding: 1rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn-record {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 3rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-record.start {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-record.start:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 40px rgba(139, 92, 246, 0.6);
}

.btn-record.start:disabled {
    background: #374151;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-record.stop {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
    animation: glow-red 1.5s ease-in-out infinite;
}

@keyframes glow-red {
    0%, 100% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 50px rgba(239, 68, 68, 0.8); }
}

/* === INDICATEUR ENREGISTREMENT === */
.recording-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.recording-badge.warning {
    background: var(--danger);
    color: white;
    animation: pulse-warning 0.5s infinite;
}

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

.rec-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* === PAGE 4 - MONTAGE COLLECTIF === */
.collectif-grid {
    grid-template-columns: 1fr 2fr;
}

.collectif-text-panel {
    display: flex;
    flex-direction: column;
}

.collectif-title {
    font-size: 1.4rem !important;
    font-style: italic;
    color: var(--accent) !important;
    margin-bottom: 0.25rem !important;
}

.collectif-author {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

.poem-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* === STROPHES ET HIGHLIGHT === */
.poem-strophe {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.poem-strophe.highlight {
    background: rgba(251, 191, 36, 0.1);
    border-left-color: var(--highlight);
}

.poem-strophe.highlight .poem-line {
    color: var(--highlight) !important;
}

.collectif-video-panel {
    display: flex;
    flex-direction: column;
}

.collectif-video-panel .video-container {
    flex: 1;
}

.collectif-video-panel .video-container video {
    border-radius: 0;
}

/* === PAGE 4B - CONSENTEMENT ENFANTS === */
.consent-page {
    background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f0f1a 70%);
}

.consent-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 243, 255, 0.98) 100%);
    border-radius: 2.5rem;
    padding: 3rem 2.5rem;
    max-width: 480px;
    width: 100%;
    color: #1e1b4b;
    box-shadow: 
        0 25px 80px rgba(139, 92, 246, 0.3),
        0 0 0 1px rgba(139, 92, 246, 0.1);
    text-align: center;
}

.consent-mascot {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.consent-title {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.consent-subtitle {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.consent-question {
    font-size: 1.2rem;
    color: #374151;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.consent-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-consent {
    padding: 1.3rem 2rem;
    font-size: 1.15rem;
    border-radius: 1.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 500;
}

.btn-consent-yes {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-consent-yes:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-consent-no {
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.btn-consent-no:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.consent-reassurance {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 1rem;
    font-size: 0.95rem;
    color: var(--primary-dark);
}

/* === ERREURS === */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 500px;
    margin: 2rem auto;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .participation-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }
    
    .video-panel {
        order: -1;
        max-height: 50vh;
    }
    
    .text-panel {
        max-height: 40vh;
    }
    
    .video-container {
        min-height: 250px;
    }
    
    .collectif-grid {
        grid-template-columns: 1fr;
    }
    
    .poem-scroll {
        max-height: 150px;
    }
    
    .accroche {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    .accueil-card {
        padding: 2rem 1.5rem;
    }
    
    .participation-page {
        padding: 0.5rem;
    }
    
    .text-panel {
        padding: 1rem;
    }
    
    .poem-line {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .consent-card {
        padding: 2rem 1.5rem;
    }
    
    .panel-header h2 {
        font-size: 1rem;
    }
    
    /* Masquer le nom du poème et auteur en mobile */
    .poem-info {
        display: none;
    }
    
    /* Réduire le bandeau permission en mobile */
    .permission-banner {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.5rem;
    }
    
    .permission-banner button {
        padding: 0.3rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .permission-banner.granted {
        padding: 0.3rem 0.5rem;
    }
    
    /* Boutons côte à côte en page 4 */
    .controls-bar {
        flex-direction: row !important;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .controls-bar .btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        flex: 1;
        min-width: auto;
    }
    
    /* Réduire le header en mobile */
    .panel-header {
        margin-bottom: 0.5rem;
    }
    
    .step-indicator {
        margin-bottom: 0.25rem;
    }
    
    /* Page 3 - question et boutons validation */
    .validation-question {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .validation-buttons {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .validation-buttons .btn {
        flex: 1;
        padding: 0.7rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* === PAGE 3 - VALIDATION === */
.validation-question {
    color: var(--accent);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.validation-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* === UTILITAIRES === */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }