/* ============================================================
   OFFRE VIEW - DESIGN IMMERSIF & INTERACTIF
   ============================================================ */

.publication {
    background: var(--block-bg);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--soft-shadow);
}

/* --- HEADER DE LA PUBLICATION --- */
.date-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.date_post, .deadline {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.date_post { background: var(--main-bg); color: var(--text-muted); }

.deadline { 
    background: #fff0f0; 
    color: #d32f2f; 
    border: 1px solid #ffcdd2;
}

/* --- PROFIL DE L'AUTEUR --- */
.publication .profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--main-bg);
}

.publication .profile img {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    object-fit: cover;
    border: 2px solid var(--primary-glow);
}

.publication .profile a {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

.publication .profile .activity {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* --- TITRE ET CONTENU --- */
.publication h3 {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.3;
}

.click-count {
    font-size: 0.8rem;
    background: var(--primary-glow);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.contenu_offre {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 25px;
    white-space: pre-line;
}

/* --- BLOC DÉTAILS SPÉCIFIQUES --- */
.details {
    background: #f8faf8;
    border-radius: 16px;
    padding: 25px;
    margin: 25px 0;
    border-left: 6px solid var(--primary-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.details p {
    margin: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.details i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

/* --- MODE PUBLIC (BLUR & PROMPT) --- */
.blur-content {
    filter: blur(4px);
    user-select: none;
}

.login-prompt {
    background: linear-gradient(135deg, #eef5e9 0%, #dcf0d3 100%);
    border: 1px solid var(--primary-glow);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    margin: 30px 0;
}

.login-prompt p {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0;
}

.status-pending {
    color: #ef6c00;
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- FORMULAIRE DE CONNEXION INTÉGRÉ --- */
.connexion fieldset {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    background: #fff;
}

.connexion legend {
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

/* --- MODALES DE LA PAGE --- */
.likers-modal, .report-modal, .delete-comment-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: none; /* Flex via JS */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    background: none;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .publication {
        padding: 20px;
    }
    
    .publication h3 {
        font-size: 1.4rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .details {
        grid-template-columns: 1fr;
    }
}

/* --- 1. STABILISATION DU LAYOUT (VISITEUR VS MEMBRE) --- */
/* Si la left_section (aside) est absente, on ajuste la grille pour éviter que la pub ne domine */
.bloc_principal:not(:has(aside)) {
    display: grid;
    grid-template-columns: 1fr 300px; /* Seulement 2 colonnes */
    max-width: 1100px;
}

@media (max-width: 900px) {
    .bloc_principal:not(:has(aside)) {
        display: block; /* Empilement sur mobile */
    }
}

/* --- 2. ACTIONS & LIKES (RESTE DU STYLE) --- */
.publication .actions {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid var(--main-bg);
    margin-top: 20px;
}

.like-btn, .share-btn, .report-btn {
    background: var(--main-bg);
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.like-btn.liked {
    background: var(--primary-glow);
    color: var(--primary-color);
}

.like-btn.liked i { color: #e74c3c; }

/* --- 3. BOUTON CANDIDATER / POSTULER --- */
.btn-primary {
    background: var(--primary-color) !important;
    color: #fff !important;
    padding: 14px 28px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
    box-shadow: 0 6px 20px var(--primary-glow);
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
}

.btn-primary:hover {
    background: var(--secondary-color) !important;
    transform: translateY(-3px);
}

/* --- 4. SECTION COMMENTAIRES --- */
.comments {
    margin-top: 30px;
    padding: 25px;
    background: #fdfdfd;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.comments h4 {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

#comment-form textarea {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--main-bg);
    resize: none;
    min-height: 80px;
    outline: none;
}

#comment-form button {
    margin-top: 10px;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* --- 5. MODALES SPÉCIFIQUES --- */
.likers-modal .modal-content, 
.report-modal .modal-content, 
.delete-comment-modal .modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* --- 6. STYLE CONNEXION (POUR VISITEURS) --- */
.connexion fieldset {
    border: 2px solid var(--primary-glow) !important;
    background: #fff;
    padding: 30px !important;
}

.connexion .form-group input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 5px;
    background: var(--main-bg);
}

.bouton_connect {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
}

.inscription {
    margin-top: 20px;
    text-align: center;
    font-weight: 500;
}

.inscription a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- 7. FIX PUB DÉBORDEMENT --- */
.right_section .ad_banner img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}

/* --- 1. BOUTON LIKE & COMPTEUR --- */
.like-count {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
    color: var(--primary-color);
    font-weight: 700;
}

.like-count:hover {
    background: var(--primary-glow);
    text-decoration: underline;
}

/* --- 2. MODALE DES LIKERS (DYNAMIQUE) --- */
#likers-modal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

.liker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--main-bg);
}

.liker img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.liker a {
    text-decoration: none;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.liker .activity {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- 3. COMMENTAIRES (NOM & DELETE) --- */
.comment {
    padding: 15px 0;
    border-bottom: 1px solid var(--main-bg);
}

.comment .author {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Aligne tout à gauche */
    gap: 10px; /* Espace réduit entre le nom et la poubelle */
    margin-bottom: 5px;
}

.comment .author a {
    text-decoration: none;
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.comment .author a:hover {
    color: var(--primary-color);
}

.delete-comment-btn {
    background: transparent;
    border: none;
    color: #e57373;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    opacity: 0.6;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
}

.delete-comment-btn:hover {
    opacity: 1;
    color: #d32f2f;
    transform: scale(1.1);
}

.comment .date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* --- 4. STYLE CONNEXION & VISITEUR --- */
.connexion .reset-password {
    text-align: center;
    margin-top: 15px;
}

.connexion .reset-password a {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.connexion .reset-password a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}
/* Fix pour l'affichage du loader dans les containers de l'offre */
.loader {
    text-align: center;
    padding: 20px;
    color: var(--primary-color);
    font-weight: 500;
    font-style: italic;
}

@media (max-width: 600px) {
    /* On masque le texte à l'intérieur des boutons d'action */
    .publication .actions button span.fallback {
        display: none !important;
    }
}