/* --- Structure & Layout --- */
.thread-page .forum-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.thread-page .forum-main-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    align-items: start;
}

/* --- Fil d'ariane --- */
.breadcrumb {
    margin-bottom: 25px;
}
.breadcrumb a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.3s;
}
.breadcrumb a:hover {
    color: var(--primary-color, #00d4ff);
}

/* --- Carte principale --- */
.main-thread {
    padding: 30px;
    margin-bottom: 40px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.main-thread .q-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.main-thread .avatar-md {
    width: 55px;
    height: 55px;
    border-radius: 14px; 
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin-right: 15px;
}

.main-thread h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color, #00d4ff);
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
    margin: 15px 0;
}

.thread-text {
    line-height: 1.8;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
}

/* --- Images --- */
.main-thread .img-fluid,
.reply-body .img-fluid {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s;
}
.main-thread .img-fluid:hover,
.reply-body .img-fluid:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* --- Section des réponses --- */
.replies-section h3 {
    font-size: 1.4rem;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}
.replies-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

.reply-item {
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.reply-header img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.reply-body {
    padding-left: 50px;
    line-height: 1.7;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
}

/* --- Formulaire réponse avec upload image --- */
.reply-form-card {
    margin-top: 40px;
    padding: 30px;
    border-radius: 20px;
}

.reply-form-card textarea {
    width: 100%;
    min-height: 150px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    padding: 18px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: 0.3s;
}
.reply-form-card textarea:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
    outline: none;
}

/* Upload d’image */
.reply-form-card .upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: 0.3s;
}
.reply-form-card .upload-label:hover {
    background: var(--primary-color);
    color: #000;
}

.reply-form-card #preview-img {
    max-width: 150px;
    margin-top: 10px;
    border-radius: 12px;
    display: none;
}

/* --- Sidebar --- */
.forum-sidebar {
    position: sticky;
    top: 20px;
}

.sidebar-widget {
    padding: 25px;
    border-radius: 20px;
}

.sidebar-widget h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.btn-link {
    display: block;
    margin-top: 20px;
    padding: 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}
.btn-link:hover {
    background: var(--primary-color);
    color: #000;
}

/* --- Activité récente / Sidebar Links --- */
.sidebar-widget .recent-activity {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-widget .recent-activity a {
    display: block;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: 0.2s;
}

.sidebar-widget .recent-activity a:hover {
    background: var(--primary-color);
    color: #000;
    text-decoration: none;
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .thread-page .forum-main-layout { grid-template-columns: 1fr; }
    .forum-sidebar { position: static; order: -1; }
    .main-thread h2 { font-size: 1.5rem; }
}


/* ==========================================================================
   RÉPONSES IMBRIQUÉES
   ========================================================================== */

/* Conteneur des sous-réponses */
.replies-container {
    display: none;
    margin-left: 20px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid rgba(0, 212, 255, 0.2);
}

/* Sous-réponse */
.sub-reply {
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Badge OP */
.op-badge {
    background: var(--primary-color, #00d4ff);
    color: #000;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Actions sous une réponse (Répondre / Voir réponses) */
.reply-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.reply-actions .action-link {
    background: none;
    border: none;
    color: var(--primary-color, #00d4ff);
    cursor: pointer;
    font-size: 0.85em;
    padding: 0;
    transition: opacity 0.2s;
}

.reply-actions .action-link:hover {
    opacity: 0.7;
}

.reply-actions .toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 0.85em;
    padding: 0;
    transition: color 0.2s;
}

.reply-actions .toggle-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Formulaire dynamique injecté par showForm() */
.dynamic-form-container {
    margin-top: 12px;
}

.dynamic-form-container .reply-form-dynamic {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
}

.dynamic-form-container textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    padding: 10px;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.dynamic-form-container textarea:focus {
    border-color: var(--primary-color, #00d4ff);
    outline: none;
}

.dynamic-form-container .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

.dynamic-form-container .btn-send {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.4);
    color: var(--primary-color, #00d4ff);
    padding: 7px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.dynamic-form-container .btn-send:hover {
    background: var(--primary-color, #00d4ff);
    color: #000;
}

.dynamic-form-container .btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    padding: 7px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.dynamic-form-container .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Menu dots (modifier / supprimer) */
.menu-dots-container {
    position: relative;
    margin-left: auto;
}

.menu-dots-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.menu-dots-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 150px;
    border-radius: 10px;
    padding: 8px;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-content.show {
    display: block;
}

.dropdown-content button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-content button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .replies-container {
        margin-left: 10px;
        padding-left: 10px;
    }

    .reply-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
}
