/* DARSI Ramadan App - Design system */
:root {
    --darsi-red: #E53935;
    --darsi-blue: #2196F3;
    --darsi-yellow: #FDD835;
    --darsi-green: #8BC34A;
    --darsi-orange: #FF9800;
    --darsi-dark: #1B2838;
}

* { box-sizing: border-box; }
body {
    font-family: 'Quicksand', -apple-system, sans-serif;
    background: var(--darsi-dark);
    color: #fff;
    min-height: 100vh;
    margin: 0;
}

a { color: var(--darsi-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(0,0,0,0.2);
    flex-wrap: wrap;
    gap: 0.75rem;
}
.app-header .logo { font-weight: 700; font-size: 1.25rem; color: #fff; }
.app-header .logo span { color: var(--darsi-yellow); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 9999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary { background: var(--darsi-yellow); color: var(--darsi-dark); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 20px rgba(253,216,53,0.5); }

.btn-secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.25); }

.btn-danger { background: var(--darsi-red); color: #fff; }
.btn-success { background: var(--darsi-green); color: #fff; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.9rem 1.75rem; font-size: 1.1rem; }

.container { max-width: 900px; margin: 0 auto; padding: 1.5rem; }

.card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; color: var(--darsi-yellow); }
.card h3 { margin: 0 0 0.5rem; font-size: 1rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; opacity: 0.9; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: rgba(255,255,255,0.4); }

.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-lock { background: var(--darsi-red); }
.badge-unlock { background: var(--darsi-green); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.list-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.quiz-option {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 1rem;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-family: inherit;
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.quiz-option:hover { border-color: var(--darsi-blue); background: rgba(33,150,243,0.15); }
.quiz-option.correct { border-color: var(--darsi-green); background: rgba(139,195,74,0.2); }
.quiz-option.wrong { border-color: var(--darsi-red); background: rgba(229,57,53,0.2); }

.leaderboard { list-style: none; padding: 0; margin: 0; }
.leaderboard li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 0.5rem;
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard .rank { font-weight: 700; color: var(--darsi-yellow); min-width: 2rem; }
.leaderboard .score { font-weight: 600; color: var(--darsi-green); }

.audio-player { margin: 0.5rem 0; }
.audio-player audio { width: 100%; max-width: 400px; height: 40px; }

/* Index: image et audio centrés, ne dépassent jamais l'écran */
.poem-card .poem-media { display: flex; justify-content: center; align-items: center; margin: 0.75rem 0; }
.poem-card .poem-image { width: 100%; display: flex; justify-content: center; }
.poem-card .poem-image img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 320px;
    border-radius: 0.75rem;
    object-fit: contain;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.poem-card .audio-player { width: 100%; justify-content: center; }
.poem-card .audio-player audio { max-width: 100%; width: 100%; height: 36px; }
.poem-card .poem-actions { text-align: center; margin: 0.5rem 0; }

.chart-container { height: 220px; margin: 1rem 0; }

/* Landing choice */
.landing-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; padding: 2rem; }
.landing-choice h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.landing-choice p { opacity: 0.85; margin-bottom: 2rem; }
.landing-btns { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.landing-btns .btn { padding: 1rem 2rem; font-size: 1.1rem; }

/* Session code big display */
.session-code { font-size: 3rem; letter-spacing: 0.5rem; font-weight: 800; color: var(--darsi-yellow); text-align: center; margin: 1rem 0; }

/* Podium (1st, 2nd, 3rd) */
.podium { margin-bottom: 1.5rem; }
.podium-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    min-width: 100px;
    order: 0;
}
.podium-place .medal { font-size: 2rem; margin-bottom: 0.25rem; }
.podium-place .pseudo { font-weight: 700; font-size: 1rem; }
.podium-place .score { font-size: 0.9rem; color: var(--darsi-green); }
.podium-place.place-1 { order: 1; background: rgba(253,216,53,0.2); border: 2px solid var(--darsi-yellow); transform: scale(1.05); }
.podium-place.place-2 { order: 0; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.3); }
.podium-place.place-3 { order: 2; background: rgba(255,152,0,0.15); border: 2px solid var(--darsi-orange); }

/* Index page: ambiance Ramadan (animations discrètes) */
.index-page { position: relative; overflow-x: hidden; }
.ramadan-deco {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.ramadan-deco .star {
    position: absolute;
    color: var(--darsi-yellow);
    opacity: 0.25;
    font-size: 1rem;
    animation: star-twinkle 3s ease-in-out infinite;
}
.ramadan-deco .star-1 { top: 12%; left: 8%; animation-delay: 0s; }
.ramadan-deco .star-2 { top: 22%; right: 15%; animation-delay: 0.8s; font-size: 0.85rem; }
.ramadan-deco .star-3 { top: 45%; left: 5%; animation-delay: 1.5s; opacity: 0.2; }
.ramadan-deco .star-4 { bottom: 30%; right: 8%; animation-delay: 0.4s; }
.ramadan-deco .star-5 { bottom: 18%; left: 12%; animation-delay: 1.2s; font-size: 0.9rem; }
.ramadan-deco .crescent {
    position: absolute;
    top: 6%;
    right: 10%;
    font-size: 2rem;
    opacity: 0.35;
    animation: crescent-float 6s ease-in-out infinite;
}
@keyframes star-twinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}
@keyframes crescent-float {
    0%, 100% { transform: translateY(0) rotate(-5deg); opacity: 0.3; }
    50% { transform: translateY(-8px) rotate(5deg); opacity: 0.45; }
}
.index-page .app-header,
.index-page .container { position: relative; z-index: 1; }

/* Lueur douce sur le titre principal (index) */
.index-page .container > h1 {
    animation: title-glow 4s ease-in-out infinite;
}
@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(253, 216, 53, 0.15); }
    50% { text-shadow: 0 0 30px rgba(253, 216, 53, 0.3); }
}

/* Responsive */
@media (max-width: 640px) {
    .session-code { font-size: 2rem; letter-spacing: 0.25rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .ramadan-deco .crescent { font-size: 1.5rem; }
    .container { padding: 1rem; }
    .app-header { padding: 0.75rem 1rem; flex-direction: column; align-items: stretch; text-align: center; }
    .app-header nav { justify-content: center; }
    .poem-card .poem-image img { max-height: 280px; }
}
@media (max-width: 380px) {
    .container { padding: 0.75rem; }
    .poem-card .poem-image img { max-height: 240px; }
    .ramadan-deco .star { font-size: 0.75rem; }
}
