/* ===== WRAPPER PRINCIPAL ===== */
/* ===== FORÇAGE RTL GLOBAL ===== */
.khotab-wrapper,
.khotab-wrapper *,
.khotab-item,
.khotab-item *,
.audio-wrapper,
.video-wrapper {
    direction: rtl !important;
    text-align: right !important;
}

.khotab-wrapper {
    padding: 24px 16px;
    max-width: 900px;
    margin: 0 auto;
    direction: rtl;
}

.khotab-header {
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 24px;
}

/* ===== TITRES : Plus grands sur desktop ===== */
.khotab-header h1 {
    font-family: 'Amiri', serif;
    font-size: 2rem; /* ✅ Desktop : plus grand */
    color: #007bff;
    margin-bottom: 8px;
}
.khotab-player .card-title {
    font-size: 1.3rem; /* ✅ Titre de la khotba : plus lisible */
    font-weight: 700;
    font-family: 'Amiri', serif;
}

/* ===== AUDIO : Ajustements RTL ===== */
.audio-wrapper {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.audio-wrapper audio {
    width: 100%;
    max-width: 640px; /* ✅ Même largeur max que la vidéo */
    height: 50px;
    border-radius: 8px;
    margin: 0 auto;
    display: block;
}

/* ===== VIDÉO YOUTUBE RESPONSIVE (NE DÉBORDE JAMAIS) ===== */
.video-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Méthode moderne : aspect-ratio (navigateurs récents) */
@supports (aspect-ratio: 16/9) {
    .ratio-16x9 {
        aspect-ratio: 16/9;
        width: 100%;
    }
    .ratio-16x9 iframe {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        border: 0;
    }
}

/* Fallback universel : padding-bottom */
@supports not (aspect-ratio: 16/9) {
    .ratio-16x9 {
        position: relative;
        width: 100%;
        padding-bottom: 56.25%; /* 16:9 = 9/16 = 56.25% */
        height: 0;
        overflow: hidden;
    }
    .ratio-16x9 iframe {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        border: 0;
    }
}

/* ===== LISTE DES KHOTAB ===== */
.khotab-list .list-group {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.khotab-item {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 16px !important;
    transition: all 0.2s ease;
    background: #fff;
	display: flex;
    align-items: center;
    gap: 12px;
}

.khotab-item:last-child {
    border-bottom: none !important;
}

.khotab-item:hover {
    background: #f8fafc !important;
    transform: translateX(4px); /* ✅ RTL : glisse vers la droite au survol */
    box-shadow: -2px 0 8px rgba(0, 123, 255, 0.1);
}

.khotab-item.active {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: #fff !important;
    border: none !important;
}
/* Badge "استمع" positionné à gauche en RTL */
.khotab-item .badge {
    margin-right: auto; /* ✅ Pousse le badge vers la gauche (fin RTL) */
    flex-shrink: 0;
	font-size: 1.3rem;
}

.khotab-item.active .text-muted,
.khotab-item.active .badge {
    color: rgba(255,255,255,0.9) !important;
    background: rgba(255,255,255,0.2) !important;
}

.khotab-item h5 {
    font-family: 'Amiri', serif;
    font-size: 1.65rem; /* ✅ Desktop : titres de liste agrandis */
    font-weight: 600;
    line-height: 1.4;
}
.khotab-list .list-group {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}
/* ===== 📱 MOBILE OPTIMISATIONS ===== */
@media (max-width: 768px) {
    .khotab-wrapper {
        padding: 16px 12px;
    }
    .khotab-player .card-title {
        font-size: 1.15rem;
    }

    .khotab-header h1 {
        font-size: 1.6rem;
    }
    
    .khotab-item {
        padding: 12px !important;
    }
    
    .khotab-item h5 {
        font-size: 1.05rem;
    }
    
    /* Vidéo : marge réduite sur mobile */
	.video-wrapper {
		display: flex;
		justify-content: center;
		width: 100%;
		padding: 8px 0;
	}
    
    /* Audio : hauteur adaptée */
    .audio-wrapper audio {
        height: 45px;
    }
	.ratio-16x9 {
        max-width: 100%; /* Pleine largeur sur mobile, mais hauteur proportionnelle */
    }
}

/* ===== ACCESSIBILITÉ ===== */
.khotab-item:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: -3px;
    z-index: 1;
}

/* Animation d'apparition */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.khotab-item {
    animation: fadeInUp 0.3s ease both;
}
/* Méthode moderne : aspect-ratio */
@supports (aspect-ratio: 16/9) {
    .ratio-16x9 {
        aspect-ratio: 16/9;
        position: relative;
    }
    .ratio-16x9 iframe {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        border: 0;
        border-radius: 8px;
    }
}

/* Fallback universel */
@supports not (aspect-ratio: 16/9) {
    .ratio-16x9 {
        position: relative;
        padding-bottom: 56.25%; /* 16:9 */
        height: 0;
        overflow: hidden;
    }
    .ratio-16x9 iframe {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        border: 0;
        border-radius: 8px;
    }
}
.khotab-item:nth-child(2) { animation-delay: 0.05s; }
.khotab-item:nth-child(3) { animation-delay: 0.1s; }
.khotab-item:nth-child(4) { animation-delay: 0.15s; }
.khotab-item:nth-child(n+5) { animation-delay: 0.2s; }