/* ============================================
   COMMENTS SECTION - Compact Flat Thread Style
   ============================================ */

/* Comment Section Container */
.comments-section {
    max-width: 100%;
    margin: 1rem 0;
}

.comments-section .box_header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
}

#comments_count {
    background: #e63946;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Comments List */
#comments_list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Single Comment */
#comments_list > .comment {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    position: relative;
}

#comments_list > .comment:last-child {
    border-bottom: none;
}

/* No Comments Message */
.no-comments {
    padding: 1.5rem;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Avatar */
.comment_author_avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
}

.comment_author_avatar img {
    width: 100%;
    height: 100%;
    /* border-radius: 50%; */
    object-fit: cover;
}

.avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.avatar-placeholder.small {
    width: 35px;
    height: 35px;
    font-size: 0.75rem;
}

/* Comment Details */
.comment_details {
    flex: 1;
    min-width: 0;
}

.posted_by {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.posted_by h5 {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.posted_by .author {
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.8125rem;
}

.posted_by .author:hover {
    color: #e63946;
}

.posted_by .in_reply {
    color: #2563eb;
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 500;
    background: #eff6ff;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.posted_by .in_reply:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.posted_by .timeago {
    color: #999;
    font-size: 0.75rem;
    font-style: normal;
}

/* Comment Body */
.comment_body {
    color: #333;
    line-height: 1.2;
    font-size: 0.8125rem;
    margin: 0;
}

.comment_body p {
    margin: 0;
    line-height: 1.2;
    padding: 5px;
}

.comment_body p:last-child {
    margin-bottom: 0;
}

/* Comment Actions */
.comment_actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment_actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #888;
    font-size: 0.7rem;
    text-decoration: none;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.comment_actions a:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.comment_actions .reply-btn:hover {
    color: #2563eb;
    background: #eff6ff;
}

.comment_actions .delete-comment-btn:hover {
    color: #dc2626;
    background: #fef2f2;
}

.comment_actions svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.comment_actions a:hover svg {
    opacity: 1;
}

/* Replies Container (Flat) */
.replies-flat {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.replies-flat .comment {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem 0 0.35rem 0.75rem;
    position: relative;
    margin-left: 1rem;
    margin-top: 0;
    margin-bottom: 0;
}

/* Depth-based indentation */
.replies-flat .comment.depth-1 { margin-left: 1rem; }
.replies-flat .comment.depth-2 { margin-left: 2rem; }
.replies-flat .comment.depth-3 { margin-left: 3rem; }
.replies-flat .comment.depth-4 { margin-left: 4rem; }

.replies-flat .comment:not(:last-child) {
    border-bottom: none;
}

.replies-flat .comment_author_avatar {
    width: 35px;
    height: 35px;
}

/* Reply Connector Line - Hidden */
.reply-connector {
    display: none;
}

/* Comment Form - Main form at top */
.comment_form {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.comment_form fieldset {
    border: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
}

.comment_form fieldset:last-child {
    margin-bottom: 0;
}

.comment_form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.8125rem;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.comment_form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.comment_form textarea::placeholder {
    color: #9ca3af;
}

/* Inline Reply Form */
.inline-reply-form {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    display: none;
}

.inline-reply-form.active {
    display: block;
}

.inline-reply-form textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8125rem;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
}

.inline-reply-form textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.inline-reply-form .reply-form-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-reply-form .submit-reply-btn {
    background: #e63946;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.inline-reply-form .submit-reply-btn:hover {
    background: #c1121f;
}

.inline-reply-form .submit-reply-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.inline-reply-form .cancel-inline-reply {
    color: #666;
    font-size: 0.75rem;
    text-decoration: none;
    padding: 0.4rem 0.5rem;
}

.inline-reply-form .cancel-inline-reply:hover {
    color: #333;
}

.inline-reply-form .reply-to-label {
    font-size: 0.7rem;
    color: #1e40af;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

/* Hide main form reply indicator when using inline */
#reply_indicator {
    display: none;
}

/* Submit Button */
.comment_form input[type="submit"],
.comment_form .more.active {
    background: #e63946;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.comment_form input[type="submit"]:hover {
    background: #c1121f;
}

.comment_form input[type="submit"]:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

#cancel_comment {
    color: #666;
    font-size: 0.75rem;
    text-decoration: none;
    margin-left: 0.75rem;
}

#cancel_comment:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

/* Comment Message (Success/Error) */
.comment-message {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.comment-message.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.comment-message.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

#comment_message {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

#comment_message.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

#comment_message.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Pagination */
#comments_pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 2rem 0 0 0;
}

#comments_pagination li {
    display: flex;
}

#comments_pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    color: #666;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#comments_pagination li:not(.left):not(.right) a:hover,
#comments_pagination li.selected a {
    background: #e63946;
    border-color: #e63946;
    color: white;
}

#comments_pagination li.left a,
#comments_pagination li.right a {
    font-size: 1.25rem;
}

#comments_pagination li.left a::before {
    content: "←";
}

#comments_pagination li.right a::before {
    content: "→";
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .comment_author_avatar {
        width: 40px;
        height: 40px;
    }
    
    .avatar-placeholder {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .replies-flat {
        margin-left: 1rem;
        width: calc(100% - 1rem);
    }
    
    .replies-flat .comment {
        padding-left: 0.75rem;
    }
    
    .reply-connector {
        width: 0.5rem;
    }
    
    .comment_actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .comment_form {
        padding: 1rem;
    }
    
    #comments_pagination li a {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.5rem;
    }
}
