/* Nested Comments Tree Style - YouTube Like */
.comment-tree-container {
    --avatar-size: 40px;
    --avatar-size-reply: 24px;
    --thread-width: 2px;
    --thread-color: #e5e5e5;
    --thread-hover-color: #aaa;
    --connector-height: 20px;
    --connector-curve: 12px;
}
.comment-item {
    display: block !important;
    border-bottom: none !important;
    position: relative;
    padding-bottom: 0px; 
    margin-bottom: 12px;
}
.comment-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    min-width: var(--avatar-size);
    aspect-ratio: 1/1;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: none !important;
}
.comment-item .comment-avatar {
    z-index: 2; 
    position: relative;
    width: var(--avatar-size);
    height: var(--avatar-size);
}
.comment-body { flex-grow: 1; }

/* Force Reset Lists */
/* Note: Changed selector to avoid overriding specific class margins */
ul.comment-tree-container, .comment-tree-container li {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Indentation Container */
.replies-list {
    margin-left: 50px !important; 
    position: relative;
    border-left: none !important;
    margin-top: 4px !important;
    list-style: none !important;
    padding: 0 !important;
}
.replies-list .comment-item {
    position: relative;
    padding-left: 12px !important; /* Spacing for curve */
    margin-bottom: 0 !important;
    padding-bottom: 8px !important;
    overflow: visible;
}
/* Ensure li inside replies also has no list style */
.replies-list li {
    list-style: none !important;
}

/* THREAD LINES */
:root {
    --thread-width: 2px;
    --curve-bg: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none"><path d="M1 0 V14 Q1 30 17 30 H40" stroke="%23c0c0c0" stroke-width="2"/></svg>');
    --curve-bg-hover: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none"><path d="M1 0 V14 Q1 30 17 30 H40" stroke="%23888888" stroke-width="2"/></svg>');
}

/* Parent Rail (Level 1 Vertical Line) */
.comment-item.has-children > .d-flex { position: relative; }
.comment-item.has-children > .d-flex::before {
    content: "";
    position: absolute;
    left: 20px; 
    top: 40px; 
    bottom: -10px; 
    width: var(--thread-width);
    background-color: #c0c0c0 !important;
    display: block;
    z-index: 1;
}

/* Nested Parent Rail Offset */
.replies-list .comment-item.has-children > .d-flex::before {
    left: 12px;
    top: 24px;
}

/* L-Curve Connector (Horizontal Curve) */
.replies-list > .comment-item::after {
    content: "";
    position: absolute;
    left: -30px !important; /* User V2: -38px */
    top: -10px;
    width: 40px; 
    height: 40px;
    background-image: var(--curve-bg);
    background-repeat: no-repeat;
    background-position: top left;
    z-index: 2;
}

/* Vertical Extension Rail (Item Level) */
.replies-list > .comment-item::before {
    content: "";
    position: absolute;
    left: -30px !important; /* User V2: -30px */
    top: -10px; 
    bottom: -10px; 
    width: var(--thread-width);
    background-color: #c0c0c0 !important;
    display: block;
    z-index: 1;
}
/* Hide rail for last child */
.replies-list > .comment-item:last-of-type::before { display: none; }

/* Level 2 offsets (Consistent with User V2) */
.replies-list .replies-list > .comment-item::after { left: -38px !important; }
.replies-list .replies-list > .comment-item::before { left: -30px !important; }

/* Group Spine (List Level) */
.replies-list::before {
    content: "";
    position: absolute;
    left: -30px !important; /* User V2: -30px */
    top: -25px; 
    height: 40px;
    width: 2px;
    background-color: #c0c0c0;
    z-index: 1;
}
.replies-list .replies-list::before { display: none; }

/* Hovers */
.comment-item:hover > .d-flex::before { background-color: var(--thread-hover-color); }
.replies-list > .comment-item:hover::before { background-color: var(--thread-hover-color); }
.replies-list > .comment-item:hover::after { background-image: var(--curve-bg-hover); }

/* Reply Avatar Size */
.replies-list .comment-item .comment-avatar {
    width: var(--avatar-size-reply);
    height: var(--avatar-size-reply);
    min-width: var(--avatar-size-reply);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}
.avatar-wrapper {
    position: relative;
    z-index: 5;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Badges & Buttons */
.badge-admin { 
    background-color: #606060; 
    color: #fff; 
    font-size: 0.7rem; 
    padding: 1px 6px; 
    border-radius: 10px; 
    margin-left: 6px;
    vertical-align: middle;
}
.action-btn-sm {
    font-size: 0.8rem;
    color: #0f0f0f;
    font-weight: 500;
    text-decoration: none;
    margin-right: 12px;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 18px;
    cursor: pointer;
    transition: background 0.2s;
}
.action-btn-sm:hover { background-color: #f2f2f2; }
.action-btn-sm.active { color: #065fd4; }
