/* ===== CONTENEUR ARTICLE ===== */
.article-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* En RTL, flex-start = DROITE ✅ */
    font-family: 'ae_AlBattar', serif; 

}

/* 2️⃣ Sur le lien lui-même */
.back-link {
    display: inline-flex; /* Respecte text-align du parent */
    align-items: center;
    gap: 6px;
    margin-bottom: 16px; /* ⛔ SUPPRIMEZ margin-left/right: auto */
    padding: 8px 16px;
    background: rgba(0,123,255,0.1);
    color: #007bff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: #007bff;
    color: #fff;
    transform: translateX(-3px); /* Glisse vers la droite en RTL */
}

/* ===== EN-TÊTE ARTICLE : Layout Empilé ===== */
/* 1. Le conteneur principal doit sortir du flux normal */
/* ===== EN-TÊTE ARTICLE : Image pleine largeur du conteneur ===== */

.article-header {
    display: flex;
    flex-direction: column;    /* ✅ Empile : Image en haut, texte en bas */
    align-items: stretch;      /* ✅ Étire les enfants sur toute la largeur du header */
    gap: 16px;                 /* ✅ Espacement entre image et contenu */
    background: #fff;
    border-radius: 12px;
    width: 100%;               /* ✅ Prend la largeur du conteneur parent */
    box-sizing: border-box;    /* ✅ Inclut padding dans le calcul de largeur */
}

/* Image : 100% de la largeur du header */
.article-header .thumbnail {
    width: 100% !important;    /* ✅ Remplit exactement le conteneur .article-header */
    height: auto;              /* ✅ Conserve les proportions */
    max-height: 400px;         /* ✅ Optionnel : limite la hauteur si l'image est très grande */
    object-fit: cover;         /* ✅ Recadre proprement sans déformer */
    border-radius: 8px;
    display: block;            /* ✅ Élimine l'espace blanc sous l'image */
    margin: 0;
}

/* Contenu texte : hérite de l'alignement RTL */
.article-header .header-content {
    width: 100%;
    text-align: right;
    direction: rtl;
}

.article-header h1 {
    font-size: 1.5rem;
    margin: 0 0 10px 0;
    line-height: 1.3;
    font-weight: 700;
    text-align: right; /* ✅ Force l'alignement du titre */
}

.article-meta {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    direction: rtl; /* ✅ Les badges s'alignent correctement */
    font-family: 'Amiri', serif;
}

.article-meta .badge {
    padding: 3px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-weight: 500;
    font-size: 1.2rem;
    direction: rtl;
    font-family: 'Amiri_b', serif;

}

.article-header hr {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}


.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #dc3545;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.pdf-link:hover {
    background: #bb2d3b;
    color: #fff;
}

/* ===== CORPS ARTICLE ===== */
.article-body {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
    text-align: justify;
    font-family : 'Droid Arabic Naskh', 'Amiri_b', Arial, Sans-Serif;
	background-color:#EDF7F2;
	display:block;
	text-align:justify; 
	padding:10px;
	border-radius: 10px;
	box-shadow:0 0 10px #336699;
}

.article-body p {
    margin: 0 0 16px 0;
}

.article-body h1 {
    font-size: 18px;
    color: #3adb50;
}
.article-body h2 {
    font-size: 20px;

    text-align: center;
}
.article-body h3 {
    color: #2c3e50;
    margin: 24px 0 12px 0;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.article-body .video {
    margin: 24px 0;
}

.article-body .video iframe {
    width: 100%;
    height: 250px;
    border-radius: 8px;
}

.read-count {
    color: #777;
    font-size: 1.4rem;
    margin-top: 24px;
    /* padding-top: 16px; */
    border-top: 1px solid #eee;
}
 /* 🌍 Support RTL (si votre site est en arabe) */
        [dir="rtl"] .article-wrapper {
            direction: rtl;
        }

/* ===== SECTION VIDÉO YOUTUBE ===== */
.article-video-section {
    /* ✅ Prend toute la largeur disponible du conteneur */
    width: 100%;
    max-width: 100%;
    background: #f8f9fa;
    margin: 24px 0;
    padding: 0;              /* ← Supprime le padding interne */
    border-radius: 0;
    text-align: right;
    direction: rtl;
    box-sizing: border-box;  /* ← Important pour inclure bordures/padding dans la largeur */
}

/* ===== SECTION VIDÉOS MULTIPLES ===== */
.article-videos-section {
    margin: 24px 0;
    padding: 0 16px;           /* Aligné avec .article-body */
    direction: rtl;
    text-align: right;
    width: 100%;
    box-sizing: border-box;
}

/* Conteneur d'une vidéo individuelle */
.video-item {
    margin-bottom: 20px;       /* Espacement entre les vidéos */
    width: 100%;
}

.video-item:last-child {
    margin-bottom: 0;          /* Pas de marge après la dernière vidéo */
}

/* Titre de l'épisode */
.video-episode-title {
    display: inline-block;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,123,255,0.3);
}

/* ===== WRAPPER VIDÉO - Centrage parfait 16:9 ===== */
.video-wrapper {
    position: relative;
    width: 75%;              /* Largeur réduite comme demandé */
    max-width: 75%;
    margin: 0 auto;          /* Centre horizontalement */
    
    /* Technique 16:9 robuste */
    padding-bottom: 56.25%;  /* 9/16 = 0.5625 = ratio 16:9 */
    height: 0;
    overflow: hidden;        /* Coupe tout débordement */
    
    border-radius: 8px;
    background: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    
    /* ✅ Force le contexte de positionnement pour l'iframe */
    contain: layout style;
}

.video-wrapper iframe {
    /* ✅ Positionnement absolu parfait : remplit tout le wrapper */
    position: absolute;
    inset: 0;                /* Équivalent à top:0; right:0; bottom:0; left:0 */
    
    width: 100%;
    height: 100%;
    
    /* ✅ Élimine tout espacement parasite */
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    
    /* ✅ Évite les artefacts de rendu */
    object-fit: contain;
}
.video-wrapper:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: box-shadow 0.3s ease;
}
/* ===== MOBILE : max-width: 767px ===== */
@media (max-width: 767px) {
    .article-wrapper {
        padding: 12px;
    }
    .article-header {
        padding: 16px 12px;
        border-radius: 8px;
    }
    .article-header .thumbnail {
        max-height: 250px;   /* Image moins haute sur mobile */
        border-radius: 4px;
    }    
    .article-header .header-content {
        flex: 1;
        min-width: 0;
        text-align: right;
        direction: rtl;
    }
    
    .article-header h1 {
        font-size: 1rem;
        margin: 0 0 4px 0;
        line-height: 1.25;
        word-wrap: break-word;
        text-align: right;
    }
    
    .article-meta {
        font-size: 0.72rem;
        gap: 4px;
        justify-content: flex-start; /* ✅ En RTL, flex-start = droite */
        direction: rtl;
    }
    
    .article-meta .badge {
        padding: 1px 5px;
        font-size: 0.7rem;
    }
    
    .pdf-link {
        padding: 4px 8px;
        font-size: 0.72rem;
        border-radius: 4px;
    }
    
    .article-body {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .article-body .video iframe {
        height: 200px;
    }
    .back-link {
        /* display: flex;
        flex-direction: column;
        align-items: flex-start; /* En RTL, flex-start = DROITE ✅ */ 
        display:none;
    }
    .article-videos-section {
        padding: 0 12px;
        margin: 16px 0;
    }
    
    .video-episode-title {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .video-wrapper {
        width: 90%;            /* ← Plus large sur mobile pour l'ergonomie */
        max-width: 90%;
        border-radius: 6px;
    }
    
    .video-item {
        margin-bottom: 16px;
    }
}
/* ===== SECTION COMMENTAIRES ===== */
.comment-section {
   /*  margin: 32px 0;
    padding: 20px 16px; */
    
    border-radius: 10px;
    direction: rtl;
    text-align: right;
}

.comment-title {
    /* ✅ Même largeur que .comment-section et .article-wrapper */
    width: auto;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
    
    /* ✅ Même padding que le conteneur parent */
    padding: 0 16px;        /* Desktop : aligné avec .article-wrapper */
    margin: 0 0 16px 0;     /* Espacement sous le titre */
    
    /* Style du texte */
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    direction: rtl;
    
    /* Séparateur décoratif */
    padding-bottom: 12px;
    border-bottom: 2px solid #007bff;
    position: relative;
    background: linear-gradient(135deg, rgba(0,123,255,0.1), rgba(0,123,255,0.05));
    border-radius: 8px 8px 0 0;
    padding: 12px 16px;
}

/* Formulaire */
.comment-form {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #444;
    font-size: 0.9rem;
}

.form-group .required {
    color: #dc3545;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Amiri', serif;
    direction: rtl;
    text-align: right;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.country-input {
    background: #f1f3f5;
    color: #666;
    cursor: not-allowed;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

#char-count {
    text-align: left;
    direction: ltr;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

/* Alertes */
.alert-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    border-right: 4px solid #c62828;
}

/* ===== SECTION COMMENTAIRES - Alignée avec l'article ===== */
.comments-list {
    max-width: 900px;          /* Même largeur que .article-wrapper */
    margin: 32px auto 0 auto;  /* Centré + espacement haut */
    padding: 20px 16px;        /* Même padding que le contenu article */
    background: #fff;          /* Fond blanc pour contraste avec le formulaire */
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    direction: rtl;
    text-align: right;
}

.comments-list h4 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #007bff;
    text-align: right;
}

/* Style de chaque commentaire */
.comment-item {
    background: #f8f9fa;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-right: 4px solid #007bff; /* Indicateur visuel RTL */
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.comment-item:last-child {
    margin-bottom: 0;
}

.comment-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.comment-author {
    font-weight: 700;
    color: #2c3e50;
}

.comment-date {
    color: #888;
    font-size: 0.85rem;
}

.comment-country {
    color: #007bff;
    font-weight: 500;
    font-size: 0.85rem;
}

.comment-text {
    margin: 0;
    line-height: 1.7;
    color: #444;
    font-size: 1rem;
    white-space: pre-wrap; /* Conserve les sauts de ligne */
    text-align: justify;
}

/* Réponse admin */
.admin-reply {
    margin-top: 12px;
    padding: 12px 14px;
    background: #e8f4fd;
    border-radius: 6px;
    border-right: 4px solid #2196f3;
    font-size: 0.95rem;
}

.admin-reply strong {
    color: #1565c0;
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.admin-reply p {
    margin: 0;
    line-height: 1.6;
    color: #333;
}

/* Aucun commentaire */
.no-comments {
    text-align: center;
    color: #888;
    padding: 24px;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Champ honeypot caché */
.honeypot {
    display: none !important;
    visibility: hidden;
    position: absolute;
    left: -9999px;
}
/* ===== CONTENEUR FORMULAIRE - Aligné avec l'article ===== */
.comment-wrapper {
    max-width: 900px;          /* Même largeur que .article-wrapper */
    margin: 24px auto 0 auto;  /* Centré + espacement haut */
    padding: 20px 16px;        /* Même padding que le contenu article */
    background: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.comment-wrapper .form-group {
    margin-bottom: 16px;
}

.comment-wrapper label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    text-align: right;
}

.comment-wrapper .form-control {
    width: 100%;
    padding: 10px 12px;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    direction: rtl;
    text-align: right;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-wrapper .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.15);
}

.comment-wrapper .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: #007bff;
    border: none;
    border-radius: 6px;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.comment-wrapper .btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}
/* ===== BOUTON COPIER LIEN ===== */
.article-title-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: flex-start; /* En RTL = aligné à droite */
}

/* ===== LIGNE D'ACTIONS : Copier + Partager ===== */
.article-actions-row {
    display: flex;
    align-items: center;
    justify-content: space; /* ✅ Pousse les éléments aux extrémités */
    gap: 16px;
    flex-wrap: wrap;             /* Passe à la ligne si écran trop étroit */
    direction: rtl;              /* Force l'ordre RTL */
    margin-top: 12px;
    margin-bottom: 10px;
}

/* Ajustement du bouton Copier */
.copy-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Amiri', serif;
    font-size: 0.9rem;
    color: #495057;
    transition: all 0.2s;
    white-space: nowrap;
}
.copy-link-btn:hover { background: #e9ecef; border-color: #007bff; color: #007bff; }

/* Réinitialisation de la barre de partage pour qu'elle s'intègre dans la ligne */
.article-actions-row .article-share-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    border: none;
    border-bottom: none;
}

.article-actions-row .share-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
    white-space: nowrap;
}


.copy-link-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ✅ État après copie réussie */
.copy-link-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}


/* 📱 Mobile */
@media (max-width: 767px) {
    .article-title-wrapper {
        gap: 8px;
        text-align: right;
        font-size: 0.9rem;
    }
    .copy-link-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    .article-actions-row {
        justify-content: space-between;
        flex-wrap: nowrap;          /* Interdit le passage à la ligne */
        gap: 8px;
    }


    .form-row {
        grid-template-columns: 1fr;
    }
    
    .comment-section {
        padding: 16px 12px;
        margin: 24px 0;
    }
    
    .comment-form {
        padding: 14px;
    }
    
    .btn-submit {
        padding: 10px;
        font-size: 0.95rem;
    }
    
     .comments-list {
        max-width: 100%;
        margin: 24px 0 0 0;
        padding: 16px 12px;
        border-radius: 8px;
    }
    
    .comment-item {
        padding: 12px 14px;
    }
    
    .comment-header {
        gap: 6px 12px;
        font-size: 0.85rem;
    }
    
    .admin-reply {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    .comment-wrapper {
        max-width: 100%;
        margin: 16px 0 0 0;
        padding: 16px 12px;
        border-radius: 8px;
    }
}

/* Champ email invalide */
input:invalid:not(:placeholder-shown) {
    border-color: #dc3545 !important;
}