/**
 * QURAN PLAYER UI - Moustaqim.com
 * Theme Kaaba: Or/Noir - Style professionnel
 */

#global {
    margin-bottom: 48px;
}

/* ========================================
   VARIABLES LOCALES
   ======================================== */
.qr-bar,
.qp-progress-box {
    --qp-gold: #E8C968;
    --qp-gold-light: #F4DC8F;
    --qp-black: #1a1a1a;
    --qp-black-light: #2d2d2d;
    --qp-white: #ffffff;
    --qp-gray: #6b7280;
    --qp-radius: 0;
}

/* Le wrapper .quran-player (SANS qp-progress-box) est layout-transparent
   pour que position:sticky sur .qr-bar fonctionne (rail = #contenu, pas le wrapper).
   Ne pas appliquer sur #lecteur qui a aussi la classe quran-player.
   Exception : .quran-page (conteneur des versets) doit rester display:block. */
.quran-player:not(.qp-progress-box):not(.quran-page) { display: contents; }
.quran-page.quran-player { display: block; }

/* ========================================
   BARRE QR-BAR (nouveau player inline sticky, unifié avec pages récitateurs)
   Remplace qp-mini (barre noire fixed) par une carte dorée inline sticky.
   ======================================== */
.qr-overlay {
    position: fixed; inset: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2147483646;
}
.qr-bar {
    background: linear-gradient(135deg, #fffdf6 0%, #fcf6e4 100%);
    border: 1px solid #e8d99a;
    border-radius: 14px;
    padding: 12px 16px;
    margin: 10px 0 18px;
    position: sticky;
    top: calc(var(--header-height, 74px) + 6px);
    z-index: 2147483647;
    align-self: start; /* clé pour sticky dans un flex container */
    box-shadow: 0 4px 14px rgba(160, 130, 30, 0.12);
    text-align: center;
}
.qr-now {
    font-family: 'Amiri', serif;
    font-size: 1.15rem;
    color: #7a6a2f;
    min-height: 1.4em;
    margin-bottom: 10px;
}
.qr-now-sep { color: #b8941f; margin: 0 4px; }
.qr-controls {
    display: flex;
    direction: ltr;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.qr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8d99a;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    color: #1a1a1a;
    transition: 0.15s;
    font-family: inherit;
    padding: 0;
}
.qr-btn:hover { border-color: #d4af37; }
.qr-nav { width: 42px; height: 42px; font-size: 1.1rem; }
.qr-play2 {
    width: 58px; height: 58px;
    background: #1a1a1a; color: #fff;
    border-color: #1a1a1a;
}
.qr-play2:hover { background: #2a2a2a; }
.qr-play2.playing { background: #2a2a2a; }
.qr-icon {
    width: auto; min-width: 42px; height: 42px;
    border-radius: 21px;
    padding: 0 14px;
    font-size: 1.1rem;
    gap: 6px;
}
.qr-icon.active { background: #fffdf5; border-color: #d4af37; color: #7a6a2f; }
.qr-arrow { font-size: 0.8em; }
.qr-options-label { font-size: 0.95rem; }
.qr-select {
    font-family: 'Amiri', serif;
    font-size: 1rem;
    padding: 7px 12px;
    border: 1px solid #e8d99a;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
    max-width: 220px;
    min-width: 0;
    flex: 0 1 auto;
}
.qr-select:focus { outline: 2px solid #d4af37; outline-offset: 1px; }
[dir="rtl"] .qr-select { font-family: 'Amiri', serif; }

/* Options inline (.qr-opts) - comme les pages qari : repeat/rate/showFr sur 1 ligne */
.qr-opts {
    display: none;  /* caché par défaut, affiché via .opts-open ou .is-pinned */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0e6c0;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    color: #8a7a4a;
}
.qr-bar.opts-open .qr-opts,
.qr-bar.is-mini.is-pinned .qr-opts { display: flex; }
.qr-opts select {
    font-family: 'Amiri', serif;
    font-size: 1rem;
    padding: 5px 9px;
    border: 1px solid #e8d99a;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
}
.qr-opts label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #1a1a1a;
    cursor: pointer;
}
.dark .qr-opts { border-top-color: #5a4a20; color: #e8d99a; }
.dark .qr-opts select { background: #2d2d2d; color: #fff; border-color: #b8941f; }

/* Bouton ⋯ toggle (pour rouvrir options quand is-mini) - caché par défaut, visible en mini */
.qr-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid #e8d99a;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #1a1a1a;
    padding: 0;
    font-family: inherit;
}
.qr-toggle:hover { border-color: #d4af37; }

/* État mini (quand la barre atteint le header en scrollant) */
.qr-bar.is-mini {
    padding: 6px 12px;
    border-radius: 10px;
    box-shadow: 0 5px 16px rgba(160, 130, 30, 0.22);
}
.qr-bar.is-mini .qr-toggle { display: inline-flex; }
/* En mini : TOUJOURS cacher label sourate, select recitateur, boutons lecture/Options */
.qr-bar.is-mini .qr-now,
.qr-bar.is-mini .qr-select,
.qr-bar.is-mini .qr-icon,
.qr-bar.is-mini .qr-options-label,
.qr-bar.is-mini .qr-arrow { display: none !important; }
.qr-bar.is-mini:not(.is-pinned) .qr-play2 { width: 46px; height: 46px; }
.qr-bar.is-mini:not(.is-pinned) .qr-nav { width: 36px; height: 36px; }
/* En mini + pinned : tout réaffiché (comportement normal) */
.dark .qr-toggle { background: #2d2d2d; color: #fff; border-color: #b8941f; }

@media (max-width: 768px) {
    .qr-bar { padding: 10px 12px; border-radius: 12px; }
    .qr-now { font-size: 1rem; margin-bottom: 8px; }
    .qr-controls { flex-wrap: wrap; justify-content: center; }
    .qr-nav { width: 38px; height: 38px; font-size: 1rem; }
    .qr-play2 { width: 50px; height: 50px; }
    .qr-select { max-width: 100%; width: 100%; font-size: 0.9rem; margin: 6px 0 0; order: 10; }
    .qr-icon { min-width: 38px; height: 38px; padding: 0 10px; font-size: 1rem; }
    .qr-options-label { display: none; }
    .qr-toggle { width: 34px; height: 34px; }
}
@media (max-width: 480px) {
    .qr-controls { gap: 6px; }
}

/* ========================================
   PANNEAU QR-PANEL (unifié avec qr-bar, remplace qp-panel visuellement)
   Layout vertical aéré, hiérarchie claire, DA moustaqim (crème/or/noir)
   ======================================== */
.qr-panel {
    background: #fffdf6 !important;
    border: 1px solid #e8d99a !important;
    border-radius: 14px !important;
    margin: 10px 0 18px !important;
    box-shadow: 0 8px 28px rgba(160, 130, 30, 0.18) !important;
    padding: 0 !important;
    color: #1a1a1a !important;
    position: relative !important;
    z-index: 2147483647 !important;
}

/* === ONGLETS : barre supérieure, fond crème foncé === */
.qr-panel .qp-tabs {
    background: #f5edd0 !important;
    border-bottom: 1px solid #e8d99a !important;
    border-radius: 14px 14px 0 0 !important;
    display: flex !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}
.qr-panel .qp-tab {
    flex: 1;
    background: transparent !important;
    color: #8a7a3f !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    padding: 14px 8px !important;
    cursor: pointer !important;
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    transition: all 0.15s !important;
}
.qr-panel .qp-tab-icon { font-size: 1.25rem !important; line-height: 1 !important; }
.qr-panel .qp-tab.active {
    background: #fffdf6 !important;
    border-bottom-color: #d4af37 !important;
    color: #1a1a1a !important;
    font-weight: 600 !important;
}
.qr-panel .qp-tab:hover:not(.active) { background: rgba(212, 175, 55, 0.12) !important; color: #5a4a20 !important; }

/* === CONTENU ONGLET : layout vertical propre (override la grille desktop confuse) === */
.qr-panel .qp-tab-content {
    display: none !important;
    padding: 18px 20px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
}
.qr-panel .qp-tab-content.active {
    display: block !important;
}
@media (min-width: 769px) {
    .qr-panel .qp-tab-content.active {
        display: block !important;
        grid-template-columns: none !important;
    }
}

/* === GROUPES : sections bien séparées, carte subtile === */
.qr-panel .qp-group {
    background: rgba(255, 253, 246, 0.6);
    border: 1px solid #f0e6c0;
    border-radius: 10px;
    padding: 14px 16px !important;
    margin-bottom: 14px !important;
    display: block !important;
}
.qr-panel .qp-group:last-child { margin-bottom: 0 !important; }
.qr-panel .qp-group-title {
    color: #7a6a2f !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 0.74rem !important;
    letter-spacing: 0.06em !important;
    margin: 0 0 12px 0 !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #f0e6c0 !important;
}

/* === RANGEES : controls alignés proprement === */
.qr-panel .qp-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
}
.qr-panel .qp-row:last-child { margin-bottom: 0 !important; }

/* === CONTROLS : selects, inputs, ranges === */
.qr-panel .qp-select,
.qr-panel select {
    background: #fff !important;
    color: #1a1a1a !important;
    border: 1px solid #d4af37 !important;
    border-radius: 8px !important;
    padding: 9px 12px !important;
    font-size: 0.92rem !important;
    cursor: pointer !important;
    flex: 1 !important;
    min-width: 120px !important;
    outline: none !important;
    transition: border-color 0.15s !important;
}
.qr-panel .qp-select:focus { border-color: #b8941f !important; box-shadow: 0 0 0 3px rgba(212,175,55,0.15) !important; }
.qr-panel .qp-input {
    background: #fff !important;
    color: #1a1a1a !important;
    border: 1px solid #d4af37 !important;
    border-radius: 8px !important;
    padding: 9px 12px !important;
    font-size: 0.92rem !important;
    outline: none !important;
}
.qr-panel .qp-range { accent-color: #d4af37 !important; width: 100% !important; max-width: 200px !important; }
.qr-panel .qp-checkbox { color: #1a1a1a !important; display: inline-flex !important; align-items: center !important; gap: 6px !important; cursor: pointer !important; }
.qr-panel .qp-label { color: #5a4a20 !important; font-size: 0.88rem !important; font-weight: 500 !important; }
.qr-panel .qp-badge { background: rgba(212,175,55,0.2) !important; color: #7a6a2f !important; padding: 2px 8px !important; border-radius: 10px !important; font-size: 0.78rem !important; font-weight: 600 !important; }

/* === BOUTONS : 3 variantes cohérentes === */
.qr-panel .qp-btn {
    background: #fff !important;
    color: #1a1a1a !important;
    border: 1px solid #d4af37 !important;
    border-radius: 8px !important;
    padding: 9px 16px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}
.qr-panel .qp-btn:hover { background: #fcf6e4 !important; border-color: #b8941f !important; }
.qr-panel .qp-btn-primary {
    background: #1a1a1a !important;
    color: #fff !important;
    border-color: #1a1a1a !important;
    font-weight: 600 !important;
}
.qr-panel .qp-btn-primary:hover { background: #2d2d2d !important; }
.qr-panel .qp-btn-success {
    background: #fff !important;
    color: #5a4a20 !important;
    border: 1px solid #b8941f !important;
}
.qr-panel .qp-btn.active { background: #fcf6e4 !important; border-color: #b8941f !important; font-weight: 600 !important; }

/* === ÉLÉMENTS SPÉCIFIQUES : bookmarks, A-B loop, mémorisation === */
.qr-panel .qp-bookmark-item {
    background: #fff !important;
    border: 1px solid #f0e6c0 !important;
    color: #1a1a1a !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    margin-bottom: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    font-size: 0.88rem !important;
}
.qr-panel .qp-ab-info {
    background: rgba(212,175,55,0.12) !important;
    color: #5a4a20 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    margin-top: 8px !important;
}

/* === BOUTON FERMER en bas === */
.qr-panel .qp-close-row {
    padding: 12px 20px !important;
    border-top: 1px solid #f0e6c0 !important;
    background: #fcf6e4 !important;
    display: flex !important;
    justify-content: flex-end !important;
    margin: 0 !important;
}
.qr-panel .qp-close-btn {
    background: transparent !important;
    color: #7a6a2f !important;
    border: 1px solid #d4af37 !important;
    border-radius: 8px !important;
    padding: 8px 18px !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}
.qr-panel .qp-close-btn:hover { background: #fff !important; color: #1a1a1a !important; }

/* === SCROLLBAR discrète dans le panneau === */
.qr-panel .qp-tab-content::-webkit-scrollbar { width: 6px; }
.qr-panel .qp-tab-content::-webkit-scrollbar-track { background: transparent; }
.qr-panel .qp-tab-content::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 3px; }
.qr-panel .qp-group { color: #1a1a1a; }
.qr-panel .qp-close-row { text-align: right; padding: 8px 16px; border-top: 1px solid #f0e6c0; }
.qr-panel .qp-close-btn { background: none; border: none; color: #7a6a2f; cursor: pointer; font-size: 0.9rem; text-decoration: underline; }
/* Dark mode */
.dark .qr-bar, .dark .qr-panel {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-color: #b8941f;
    color: #fff;
}
.dark .qr-now { color: #e8d99a; }
.dark .qr-btn { background: #2d2d2d; color: #fff; border-color: #b8941f; }
.dark .qr-play2 { background: #e8d99a; color: #1a1a1a; }
.dark .qr-select { background: #2d2d2d; color: #fff; border-color: #b8941f; }
.dark .qr-panel .qp-tabs { background: #2d2d2d; border-bottom-color: #5a4a20; }
.dark .qr-panel .qp-tab { color: #e8d99a; }
.dark .qr-panel .qp-tab.active { background: #1a1a1a; border-bottom-color: #e8d99a; color: #fff; }
.dark .qr-panel .qp-select { background: #2d2d2d; color: #fff; }
.dark .qr-panel .qp-btn { background: #2d2d2d; color: #fff; }

/* ========================================
   BARRE REDUITE (MINI PLAYER) - ancien qp-mini, conservé pour référence
   ======================================== */
.qp-mini {
    background: linear-gradient(135deg, var(--qp-black) 0%, var(--qp-black-light) 100%);
    border-bottom: 2px solid var(--qp-gold);
    border-top: none;
    padding: 8px 16px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.qp-mini-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--qp-white);
    font-size: 13px;
}

.qp-mini-surah {
    color: var(--qp-gold);
    font-weight: 600;
}

.qp-mini-ayah {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* Controles audio mini */
.qp-mini-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qp-mini-btn {
    background: transparent;
    border: 1px solid rgba(212, 175, 55,0.3);
    color: var(--qp-gold);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.qp-mini-btn:hover {
    background: var(--qp-gold);
    color: var(--qp-black);
}

.qp-mini-btn.playing {
    background: var(--qp-gold);
    color: var(--qp-black);
}

/* Bouton Options */
.qp-options-btn {
    margin-left: auto;
    background: var(--qp-gold);
    color: var(--qp-black);
    border: none;
    padding: 6px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.qp-options-btn:hover {
    background: var(--qp-gold-light);
}

.qp-options-btn .arrow {
    transition: transform 0.2s;
}

.qp-options-btn.active .arrow {
    transform: rotate(180deg);
}

/* Select recitant mini */
.qp-mini-select {
    background: var(--qp-black-light);
    border: 1px solid rgba(212, 175, 55,0.3);
    color: var(--qp-white);
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.qp-mini-select:focus {
    outline: none;
    border-color: var(--qp-gold);
}

/* ========================================
   PANNEAU OPTIONS (ETENDU)
   ======================================== */
.qp-panel {
    background: var(--qp-black);
    border-bottom: 2px solid var(--qp-gold);
    overflow: hidden;
}

/* Onglets */
.qp-tabs {
    display: flex;
    background: var(--qp-black-light);
    border-bottom: 1px solid rgba(212, 175, 55,0.2);
}

.qp-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
}

.qp-tab > span {
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.qp-tab:hover {
    color: var(--qp-white);
    background: rgba(212, 175, 55,0.05);
}

.qp-tab.active {
    color: var(--qp-gold);
    border-bottom-color: var(--qp-gold);
    background: rgba(212, 175, 55,0.1);
}

.qp-tab-icon {
    font-size: 16px;
}

/* Contenu des onglets */
.qp-tab-content {
    padding: 16px;
    display: none;
}

.qp-tab-content.active {
    display: block;
}

/* ========================================
   COMPOSANTS COMMUNS
   ======================================== */

/* Groupe de controles */
.qp-group {
    margin-bottom: 16px;
}

.qp-group:last-child {
    margin-bottom: 0;
}

.qp-group-title {
    color: var(--qp-gold);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* Ligne de controles */
.qp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Labels */
.qp-label {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    min-width: 80px;
}

/* Selects */
.qp-select {
    background: var(--qp-black-light);
    border: 1px solid rgba(212, 175, 55,0.3);
    color: var(--qp-white);
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    min-width: 120px;
}

.qp-select:focus {
    outline: none;
    border-color: var(--qp-gold);
}

/* Boutons */
.qp-btn {
    background: transparent;
    border: 1px solid rgba(212, 175, 55,0.5);
    color: var(--qp-gold);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.qp-btn:hover {
    background: var(--qp-gold);
    color: var(--qp-black);
}

.qp-btn-primary {
    background: var(--qp-gold);
    color: var(--qp-black);
    border-color: var(--qp-gold);
}

.qp-btn-primary:hover {
    background: var(--qp-gold-light);
}

.qp-btn-success {
    border-color: #10b981;
    color: #10b981;
}

.qp-btn-success:hover {
    background: #10b981;
    color: var(--qp-black);
}

.qp-btn-success.active {
    background: #10b981;
    color: var(--qp-white);
}

.qp-btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.qp-btn-danger:hover {
    background: #ef4444;
    color: var(--qp-white);
}

/* Inputs */
.qp-input {
    background: var(--qp-black-light);
    border: 1px solid rgba(212, 175, 55,0.3);
    color: var(--qp-white);
    padding: 8px 12px;
    font-size: 13px;
    width: 80px;
}

.qp-input:focus {
    outline: none;
    border-color: var(--qp-gold);
}

/* Range sliders */
.qp-range {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 4px;
    background: rgba(212, 175, 55,0.2);
    outline: none;
}

.qp-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--qp-gold);
    cursor: pointer;
}

.qp-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--qp-gold);
    border: none;
    cursor: pointer;
}

/* Checkboxes */
.qp-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
}

.qp-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--qp-gold);
}

/* Badges */
.qp-badge {
    background: rgba(212, 175, 55,0.2);
    color: var(--qp-gold);
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   SECTION MEMORISATION (A-B)
   ======================================== */
.qp-ab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.qp-ab-info {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(212, 175, 55,0.2);
}

.qp-ab-point {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.qp-ab-point.point-a {
    color: #10b981;
}

.qp-ab-point.point-b {
    color: #ef4444;
}

.qp-ab-hint {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-top: 8px;
}

/* ========================================
   FAVORIS
   ======================================== */
.qp-bookmarks-list {
    max-height: 150px;
    overflow-y: auto;
}

.qp-bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(212, 175, 55,0.1);
}

.qp-bookmark-item:hover {
    background: rgba(212, 175, 55,0.05);
}

.qp-bookmark-label {
    color: var(--qp-white);
    font-size: 13px;
    cursor: pointer;
}

.qp-bookmark-label:hover {
    color: var(--qp-gold);
}

/* ========================================
   BOUTON FERMER
   ======================================== */
.qp-close-row {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(212, 175, 55,0.1);
}

.qp-close-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.qp-close-btn:hover {
    border-color: var(--qp-gold);
    color: var(--qp-gold);
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Desktop: layout vertical aéré (plus de grille 2 colonnes confuse) */
@media (min-width: 769px) {
    .qp-tab-content {
        padding: 18px 20px;
    }

    /* Les rows restent flex en desktop */
    .qp-row {
        flex-wrap: nowrap;
    }

    .qp-select {
        flex: 1;
        min-width: 140px;
    }

    .qp-range {
        width: 180px;
    }

    .qp-input {
        width: 100px;
    }

    /* Boutons A-B sur une ligne */
    .qp-ab-controls {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

/* Tablettes */
@media (min-width: 769px) and (max-width: 1024px) {
    .qp-tab-content.active {
        display: block;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .qp-mini {
        flex-wrap: wrap;
        gap: 8px;
    }

    .qp-mini-info {
        order: 1;
        width: 100%;
    }

    .qp-mini-controls {
        order: 2;
    }

    .qp-options-btn {
        order: 3;
        margin-left: 0;
    }

    .qp-mini-select {
        display: none;
    }

    .qp-tabs {
        overflow-x: auto;
    }

    .qp-tab {
        min-width: 80px;
        padding: 10px 6px;
        font-size: 11px;
    }

    .qp-tab-icon {
        font-size: 14px;
    }

    .qp-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .qp-range {
        width: 100%;
    }
}

/* ========================================
   DARK MODE (pour compatibilite)
   ======================================== */
.dark .qp-mini,
.dark .qp-panel {
    background: linear-gradient(135deg, #0a0a0a 0%, #151515 100%);
}

/* ========================================
   CADRE PROGRESSION (Juz/Hizb/Navigation)
   ======================================== */
.qp-progress-box {
    background: linear-gradient(135deg, var(--qp-black) 0%, var(--qp-black-light) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 16px;
    margin-bottom: 0;
}

.qp-progress-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.qp-progress-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
}

.qp-progress-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qp-progress-nav-arrow {
    color: var(--qp-gold);
    font-size: 20px;
    text-decoration: none;
    transition: all 0.2s;
    padding: 4px 8px;
}

.qp-progress-nav-arrow:hover {
    color: var(--qp-gold-light);
    transform: scale(1.1);
}

.qp-progress-nav-arrow.disabled {
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.qp-progress-title {
    color: var(--qp-gold);
    font-family: 'Amiri', serif;
    font-size: 22px;
    font-weight: 600;
}

.qp-progress-surah {
    color: var(--qp-gold);
    font-family: 'Amiri', serif;
    font-size: 22px;
    font-weight: 600;
    /* Toujours RTL : contient le nom de la sourate en arabe,
       quelle que soit la langue courante du visiteur. */
    direction: rtl;
    text-align: right;
}

/* Barres de progression */
.qp-progress-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.qp-progress-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qp-progress-item span:first-child {
    color: var(--qp-gold);
    font-family: 'Amiri', serif;
    font-weight: 600;
}

.qp-progress-item span:last-child {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.qp-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.qp-progress-info span:first-child {
    color: var(--qp-gold);
    font-family: 'Amiri', serif;
    font-size: 22px;
    font-weight: 600;
}

.qp-progress-info span:last-child {
    color: rgba(255, 255, 255, 0.6);
}

.qp-progress-track {
    height: 8px;
    background: rgba(232, 201, 104, 0.18);
    overflow: hidden;
}

.qp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--qp-gold) 0%, var(--qp-gold-light) 100%);
    transition: width 0.3s ease;
}

/* Variante Hizb - legere difference */
.qp-progress-fill.hizb {
    background: linear-gradient(90deg, #D4A520 0%, var(--qp-gold) 100%);
}

/* Dark mode */
.dark .qp-progress-box {
    background: linear-gradient(135deg, #0a0a0a 0%, #151515 100%);
}

/* ========================================
   PAGE CORAN (conteneur des versets)
   ======================================== */
.quran-page {
    background: var(--qp-white);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-top: none;
    border-radius: 0 !important;
    margin-bottom: 0;
}

.dark .quran-page {
    background: #0f172a;
    border-color: rgba(212, 175, 55, 0.15);
}

/* Verset individuel */
.quran-page .aya {
    padding: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    transition: background-color 0.2s;
}

.quran-page .aya:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Verset en surbrillance (en cours de lecture) */
.quran-page .aya.highlight {
    background: rgba(212, 175, 55, 0.08);
    margin: 0;
    padding: 15px;
}

.dark .quran-page .aya.highlight {
    background: rgba(212, 175, 55, 0.12);
}

/* Numero du verset */
.quran-page .aya-num {
    color: var(--qp-gold);
    font-weight: 500;
    font-size: 0.7em;
    vertical-align: middle;
}

/* ========================================
   FLOATING PLAYER (bas de page)
   ======================================== */
.qp-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.qp-floating-bar {
    background: linear-gradient(135deg, var(--qp-black) 0%, var(--qp-black-light) 100%);
    border: 2px solid var(--qp-gold);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.qp-floating-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
}

.qp-floating-surah {
    color: var(--qp-gold);
    font-size: 12px;
    font-weight: 600;
}

.qp-floating-ayah {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
}

.qp-floating-controls {
    display: flex;
    gap: 4px;
}

.qp-floating-btn {
    background: transparent;
    border: 1px solid rgba(212, 175, 55,0.4);
    color: var(--qp-gold);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.qp-floating-btn:hover {
    background: var(--qp-gold);
    color: var(--qp-black);
}

.qp-floating-btn.playing {
    background: var(--qp-gold);
    color: var(--qp-black);
}

/* Bouton remonter */
.qp-scroll-top {
    background: var(--qp-gold);
    color: var(--qp-black);
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(212, 175, 55,0.4);
    transition: all 0.2s;
}

.qp-scroll-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55,0.5);
}

/* Masquer sur mobile si trop petit */
@media (max-width: 480px) {
    .qp-floating-info {
        display: none;
    }

    .qp-floating {
        bottom: 15px;
        right: 15px;
    }
}

/* ========================================
   MODE LECTURE IMMERSIF
   ======================================== */

/* Bouton mode lecture dans mini player */
.qp-reading-btn {
    background: transparent;
    border: 1px solid rgba(212, 175, 55,0.3);
    color: var(--qp-gold);
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qp-reading-btn:hover {
    background: rgba(212, 175, 55,0.1);
    border-color: var(--qp-gold);
}

.qp-reading-btn.active {
    background: var(--qp-gold);
    color: var(--qp-black);
}

/* Quand mode lecture actif */
body.reading-mode .site-header {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

body.reading-mode .site-footer {
    display: none !important;
}

body.reading-mode .qp-progress-box {
    display: none !important;
}

/* En mode lecture, qr-bar devient une barre minimaliste */
body.reading-mode .qr-bar {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 0;
    color: #fff;
}
body.reading-mode .qr-now { color: #e8d99a; }
body.reading-mode .qr-btn { background: rgba(45,45,45,0.8); color: #fff; border-color: rgba(212,175,55,0.3); }

/* En mode lecture, qr-panel se place en haut */
body.reading-mode .qr-panel {
    top: 0 !important;
}

/* Ajuster le padding-top du contenu en mode lecture */
body.reading-mode .max-w-3xl {
    padding-top: 60px !important;
}

/* En mode lecture : masquer la sidebar et centrer le contenu */
body.reading-mode #droite {
    display: none !important;
}

body.reading-mode #contenu {
    width: 100% !important;
    max-width: 760px;
    margin: 0 auto;
    float: none !important;
    padding-top: 60px;
}

/* Plus de barre fixed : règle body.reading-mode .fixed.z-50 supprimée (legacy qp-*) */

/* Bouton exit mode lecture flottant */
.qp-exit-reading {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 9999;
    background: var(--qp-gold);
    color: var(--qp-black);
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

body.reading-mode .qp-exit-reading {
    display: flex;
}

.qp-exit-reading:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* ============================================================
   Typographie arabe Amiri : UNIQUEMENT sur pages RTL (arabe).
   Sur pages FR/EN, l'UI du player garde Inter (clarté labels/boutons).
   Règle AGENTS.md : "Amiri uniquement sur texte arabe, jamais sur UI/boutons/labels FR/EN"
   ============================================================ */
[dir="rtl"] .qr-bar,
[dir="rtl"] .qr-bar *,
[dir="rtl"] .qp-progress-box,
[dir="rtl"] .qp-progress-box * { font-family: 'Amiri', serif !important; }
[dir="rtl"] .qr-bar .qp-tab,
[dir="rtl"] .qp-progress-box .qp-tab,
[dir="rtl"] .qr-bar .qp-tab span,
[dir="rtl"] .qp-progress-box .qp-tab span,
[dir="rtl"] .qr-bar .qp-group-title,
[dir="rtl"] .qp-progress-box .qp-group-title,
[dir="rtl"] .qr-bar .qp-mini-surah,
[dir="rtl"] .qp-progress-box .qp-mini-surah,
[dir="rtl"] .qr-bar .qp-mini-ayah,
[dir="rtl"] .qp-progress-box .qp-mini-ayah,
[dir="rtl"] .qr-bar .qp-mini-select,
[dir="rtl"] .qp-progress-box .qp-mini-select,
[dir="rtl"] .qr-bar .qp-mini-select option,
[dir="rtl"] .qp-progress-box .qp-mini-select option,
[dir="rtl"] .qr-bar .qp-select,
[dir="rtl"] .qp-progress-box .qp-select,
[dir="rtl"] .qr-bar .qp-select option,
[dir="rtl"] .qp-progress-box .qp-select option,
[dir="rtl"] .qr-bar .qp-reading-btn,
[dir="rtl"] .qp-progress-box .qp-reading-btn,
[dir="rtl"] .qr-bar .qp-options-btn,
[dir="rtl"] .qp-progress-box .qp-options-btn,
[dir="rtl"] .qr-bar button,
[dir="rtl"] .qp-progress-box button,
[dir="rtl"] .qr-bar label,
[dir="rtl"] .qp-progress-box label,
[dir="rtl"] .qr-bar a,
[dir="rtl"] .qp-progress-box a,
[dir="rtl"] .qr-bar .qp-progress-title,
[dir="rtl"] .qp-progress-box .qp-progress-title,
[dir="rtl"] .qr-bar .qp-progress-surah,
[dir="rtl"] .qp-progress-box .qp-progress-surah,
[dir="rtl"] .qr-bar .qp-progress-info,
[dir="rtl"] .qp-progress-box .qp-progress-info,
[dir="rtl"] .qr-bar .qp-progress-label,
[dir="rtl"] .qp-progress-box .qp-progress-label { font-size: 22px !important; }
/* icônes / emoji / flèches : on garde une taille raisonnable */
[dir="rtl"] .qr-bar .qp-tab-icon,
[dir="rtl"] .qp-progress-box .qp-tab-icon,
[dir="rtl"] .qr-bar .arrow,
[dir="rtl"] .qp-progress-box .arrow,
[dir="rtl"] .qr-bar .qp-mini-btn,
[dir="rtl"] .qp-progress-box .qp-mini-btn,
[dir="rtl"] .qr-bar .qp-mini-controls button,
[dir="rtl"] .qp-progress-box .qp-mini-controls button,
[dir="rtl"] .qr-bar .qp-progress-nav-arrow,
[dir="rtl"] .qp-progress-box .qp-progress-nav-arrow { font-size: 18px !important; }

.qr-audio-status { min-width: 4.5rem; color: #1a1a1a; font-size: .82rem; }
.qr-bar[aria-busy="true"] .qr-play2 { cursor: progress; opacity: .75; }
@media (max-width: 640px) { .qr-audio-status { width: 100%; text-align: center; } }
