/* ============================================================
   CMCI OBILI — Publications Detail
   style_publications_detail.css
   Couleur primaire teal : #2a9d8f
   "Toute la gloire à Dieu" 🙏
   ============================================================ */

/* ── Variables locales (héritées du thème global) ── */
:root {
    --pub-primary:       var(--primary, #2a9d8f);
    --pub-primary-dark:  var(--primary-dark, #21867a);
    --pub-primary-light: var(--primary-light, #e0f5f3);
    --pub-text:          var(--text, #1e293b);
    --pub-text-muted:    var(--text-muted, #64748b);
    --pub-border:        var(--border, #e2e8f0);
    --pub-bg:            var(--bg, #f8fafc);
    --pub-white:         var(--white, #ffffff);
    --pub-danger:        var(--danger, #ef4444);
    --pub-warning:       var(--warning, #f59e0b);
    --pub-radius-sm:     var(--radius-sm, 6px);
    --pub-radius-md:     var(--radius-md, 10px);
    --pub-radius-lg:     var(--radius-lg, 16px);
    --pub-shadow:        var(--shadow, 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(var(--primary-rgb, 42,157,143),.06));
}

/* ── Layout global de la section ── */
.pub-detail-section {
    padding: 2.5rem 0 4rem;
    background: var(--pub-bg);
    min-height: 80vh;
}

.pub-detail-section .container {
    background: var(--pub-white);
    border-radius: var(--pub-radius-lg);
    box-shadow: var(--pub-shadow);
    padding: 2.5rem 2rem;
}

/* ── Lien retour ── */
.pub-link {
    color: var(--pub-primary);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .2s;
}
.pub-link:hover {
    color: var(--pub-primary-dark);
    gap: 10px;
}

/* ── Header de la publication ── */
.pub-detail-header {
    border-bottom: 1px solid var(--pub-border);
    padding-bottom: 1.25rem;
}

.pub-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--pub-primary-light);
    color: var(--pub-primary-dark);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: 6px;
}

.pub-detail-header .section-title {
    color: var(--pub-text);
    font-weight: 700;
    line-height: 1.25;
    margin: .75rem 0 .5rem;
}

.pub-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: .82rem;
    color: var(--pub-text-muted);
}
.pub-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.pub-meta i {
    color: var(--pub-primary);
    font-size: .85rem;
}

/* ============================================================
   CAROUSEL DE MÉDIAS
   ============================================================ */
.pub-media-carousel {
    position: relative;
    border-radius: var(--pub-radius-md);
    overflow: hidden;
    background: #0f172a;
    margin-bottom: 1.75rem;
}

/* Zone d'affichage principale */
.pub-media-main {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    min-height: 220px;
}

.pub-media-main img,
.pub-media-main video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}
.pub-media-main img.active,
.pub-media-main video.active {
    display: block;
}

/* Visionneuse PDF */
.pub-media-pdf {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #94a3b8;
    font-size: .9rem;
}
.pub-media-pdf.active { display: flex; }
.pub-media-pdf i { font-size: 3rem; color: #ef4444; }
.pub-media-pdf a {
    padding: 8px 20px;
    background: var(--pub-primary);
    color: #fff;
    border-radius: var(--pub-radius-sm);
    text-decoration: none;
    font-size: .85rem;
    transition: background .2s;
}
.pub-media-pdf a:hover { background: var(--pub-primary-dark); }

/* Audio player */
.pub-media-audio {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #94a3b8;
}
.pub-media-audio.active { display: flex; }
.pub-media-audio i { font-size: 3rem; color: var(--pub-primary); }
.pub-media-audio audio { width: 90%; max-width: 400px; }

/* Compteur */
.pub-media-counter {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .75rem;
    padding: 3px 9px;
    border-radius: 20px;
    pointer-events: none;
}

/* Flèches de navigation */
.pub-media-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.45);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
    z-index: 2;
}
.pub-media-nav:hover { background: rgba(var(--primary-rgb, 42,157,143),.8); }
.pub-media-nav.prev { left: 10px; }
.pub-media-nav.next { right: 10px; }

/* Miniatures */
.pub-media-thumbs {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: #1e293b;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pub-primary) transparent;
}
.pub-media-thumbs::-webkit-scrollbar { height: 4px; }
.pub-media-thumbs::-webkit-scrollbar-thumb { background: var(--pub-primary); border-radius: 2px; }

.pub-thumb {
    width: 56px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .2s, opacity .2s;
    opacity: .6;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: .7rem;
    text-align: center;
    gap: 2px;
    flex-direction: column;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
.pub-thumb:hover { opacity: .85; }
.pub-thumb.active { border-color: var(--pub-primary); opacity: 1; }

/* Une seule image — pas de carrousel */
.pub-media-single img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: var(--pub-radius-md);
    margin-bottom: 1.75rem;
}

/* ============================================================
   BLOC ÉVÉNEMENT
   ============================================================ */
.pub-event-card {
    background: var(--pub-primary-light);
    border-left: 4px solid var(--pub-primary);
    border-radius: var(--pub-radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}
.pub-event-card .event-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--pub-text);
    font-size: .9rem;
}
.pub-event-card .event-row i { color: var(--pub-primary); width: 16px; }
.pub-event-card .event-row:last-child { margin-bottom: 0; }

/* Boutons inscription */
.btn-inscrit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    padding: 9px 22px;
    border: none;
    border-radius: var(--pub-radius-sm);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-decoration: none;
}
.btn-inscrit:active { transform: scale(.97); }
.btn-inscrit.primary  { background: var(--pub-primary); color: #fff; }
.btn-inscrit.primary:hover  { background: var(--pub-primary-dark); }
.btn-inscrit.danger   { background: #ef4444; color: #fff; }
.btn-inscrit.danger:hover   { background: #dc2626; }

/* ============================================================
   CONTENU TEXTUEL
   ============================================================ */
.pub-detail-content {
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--pub-text);
    white-space: pre-line;
    margin-bottom: 1.75rem;
}

/* Bloc message / évangélisation */
.pub-meta-card {
    background: var(--pub-bg);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-md);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    color: var(--pub-text);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pub-meta-card i { color: var(--pub-primary); margin-right: 6px; }

/* ============================================================
   BARRE D'ACTIONS
   ============================================================ */
.pub-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--pub-border);
    border-bottom: 1px solid var(--pub-border);
    margin-bottom: 1.75rem;
}

.pub-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--pub-radius-sm);
    border: 1px solid var(--pub-border);
    background: var(--pub-white);
    color: var(--pub-text-muted);
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
}
.pub-action-btn:hover {
    background: var(--pub-primary-light);
    border-color: var(--pub-primary);
    color: var(--pub-primary-dark);
}
.pub-action-btn.liked i { color: var(--pub-danger); }

/* ============================================================
   SECTION COMMENTAIRES
   ============================================================ */
.pub-comments-section { margin-top: 2rem; }

.pub-comments-section .section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--pub-text);
    margin-bottom: 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--pub-primary-light);
}

/* Formulaire commentaire */
.pub-comment-form textarea,
.pub-comment-form input[type="text"] {
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-sm);
    padding: 10px 14px;
    font-size: .9rem;
    width: 100%;
    resize: vertical;
    transition: border-color .2s;
    background: var(--pub-white);
    color: var(--pub-text);
}
.pub-comment-form textarea:focus,
.pub-comment-form input[type="text"]:focus {
    outline: none;
    border-color: var(--pub-primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 42,157,143),.1);
}

.btn-pub-submit {
    padding: 8px 20px;
    background: var(--pub-primary);
    color: #fff;
    border: none;
    border-radius: var(--pub-radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-top: .5rem;
}
.btn-pub-submit:hover { background: var(--pub-primary-dark); }

/* Carte commentaire */
.pub-comment {
    padding: 1rem 0;
    border-bottom: 1px solid var(--pub-border);
}
.pub-comment:last-child { border-bottom: none; }

.comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--pub-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    flex-shrink: 0;
}

.comment-body strong {
    font-size: .88rem;
    color: var(--pub-text);
}
.comment-body .comment-date {
    font-size: .75rem;
    color: var(--pub-text-muted);
    margin-left: 8px;
}
.comment-body p {
    margin: 4px 0 6px;
    font-size: .9rem;
    color: var(--pub-text);
    line-height: 1.6;
}

/* Actions commentaire */
.comment-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.comment-actions button,
.comment-actions a {
    font-size: .78rem;
    color: var(--pub-text-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
}
.comment-actions button:hover { color: var(--pub-primary); }
.comment-actions .text-danger:hover { color: #dc2626 !important; }

/* Formulaire réponse */
.reply-form {
    margin-top: .75rem;
    padding: .75rem 1rem;
    background: var(--pub-bg);
    border-radius: var(--pub-radius-sm);
    border-left: 3px solid var(--pub-primary-light);
}

/* Réponses imbriquées */
.comment-replies {
    margin-top: .75rem;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--pub-primary-light);
}
.reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #94a3b8;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.comment-replies .comment-body p { font-size: .85rem; }

/* Pseudo visiteur (like anonyme) */
#pseudoLikeBox {
    background: var(--pub-primary-light);
    border-radius: var(--pub-radius-sm);
    padding: 10px 14px;
    gap: 8px;
    margin-bottom: 1rem;
}
#pseudoLikeBox input {
    border: 1px solid var(--pub-primary);
    border-radius: var(--pub-radius-sm);
    padding: 6px 12px;
    font-size: .85rem;
    max-width: 240px;
    flex: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .pub-detail-section .container {
        padding: 1.25rem 1rem;
        border-radius: var(--pub-radius-md);
    }
    .pub-media-main { aspect-ratio: 4 / 3; }
    .pub-detail-header .section-title { font-size: 1.5rem !important; }
    .pub-meta { gap: 8px; font-size: .78rem; }
    .pub-actions-bar { gap: 6px; flex-wrap: wrap; }
    .pub-action-btn { padding: 6px 10px; font-size: .8rem; }
    .comment-replies { margin-left: .75rem; padding-left: .75rem; }
}

/* ── Voir plus / Charger plus ── */
.btn-voir-plus {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: .5rem auto 0;
    padding: 7px 20px;
    background: var(--pub-primary-light);
    color: var(--pub-primary-dark);
    border: 1px solid var(--pub-primary);
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.btn-voir-plus:hover {
    background: var(--pub-primary);
    color: #fff;
}
.btn-voir-plus i { font-size: .8rem; transition: transform .3s; }
.btn-voir-plus.ouvert i { transform: rotate(180deg); }


/* ============================================================
   BLOC DÉPARTEMENT / REJOINDRE
   ============================================================ */
.pub-dept-card {
    background: linear-gradient(135deg, var(--pub-primary-light) 0%, var(--pub-bg) 100%);
    border: 2px solid var(--pub-primary);
    border-radius: var(--pub-radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 42,157,143), .15);
}

.dept-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.dept-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--pub-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 42,157,143), .3);
}

.dept-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dept-details strong {
    font-size: 1.05rem;
    color: var(--pub-text);
    font-weight: 700;
}

.dept-details small {
    font-size: .82rem;
    color: var(--pub-text-muted);
}

/* Bouton Rejoindre */
.btn-rejoindre {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--pub-primary);
    color: #fff;
    border: none;
    border-radius: var(--pub-radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 42,157,143), .3);
}

.btn-rejoindre:hover {
    background: var(--pub-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 42,157,143), .4);
    color: #fff;
}

.btn-rejoindre:active {
    transform: translateY(0);
}

/* Badges de statut */
.dept-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--pub-radius-sm);
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}

.dept-badge.accepted {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.dept-badge.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.dept-badge.refused {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Responsive */
@media (max-width: 640px) {
    .pub-dept-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .btn-rejoindre,
    .dept-badge {
        width: 100%;
        justify-content: center;
    }
}
