/**
 * Advanced Comment Section Styles - Redesign
 */

/* ============================================
   COMMENT SECTION CONTAINER
   ============================================ */
.comments-section {
    margin: 60px 0;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

[data-theme="dark"] .comments-section {
    background: #1e1e1e;
    border-color: #333333;
}

/* ============================================
   COMMENTS HEADER
   ============================================ */
.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.comments-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .comments-title {
    color: #ffffff;
}

.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: #FF5722;
    /* Orange */
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
}

/* Sort Dropdown */
.comments-sort-wrapper {
    position: relative;
}

.comments-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666666;
    cursor: pointer;
}

.comments-sort-btn:hover {
    color: #1a1a1a;
}

[data-theme="dark"] .comments-sort-btn {
    color: #b0b0b0;
}

[data-theme="dark"] .comments-sort-btn:hover {
    color: #ffffff;
}

.dropdown-arrow {
    font-size: 10px;
}

.comments-sort-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 6px 0;
    z-index: 100;
    display: none;
    /* Controlled by JS */
}

[data-theme="dark"] .comments-sort-dropdown {
    background: #2a2a2a;
    border-color: #404040;
}

.sort-option {
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
}

.sort-option:hover {
    background: #f5f5f5;
}

[data-theme="dark"] .sort-option {
    color: #e0e0e0;
}

[data-theme="dark"] .sort-option:hover {
    background: #333333;
}

/* ============================================
   ADVANCED COMMENT FORM
   ============================================ */
.advanced-comment-form {
    margin-bottom: 40px;
    background: #f5f5f5;
    /* Light grey background */
    border-radius: 12px;
    padding: 20px;
    position: relative;
}

.inline-reply-form {
    margin-top: 20px;
}

[data-theme="dark"] .advanced-comment-form {
    background: #2a2a2a;
}

.comment-user-info {
    display: none;
    /* Hide user info to match reference design simplicity */
}

/* Rich Text Editor */
.comment-editor-wrapper {
    margin-bottom: 0;
}

.comment-editor {
    min-height: 60px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    outline: none;
    margin-bottom: 20px;
}

[data-theme="dark"] .comment-editor {
    color: #e0e0e0;
}

.comment-editor:empty:before {
    content: attr(data-placeholder);
    color: #666666;
    pointer-events: none;
}

/* Formatting Toolbar */
.comment-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 15px;
    margin-bottom: 20px;
}

[data-theme="dark"] .comment-toolbar {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.toolbar-formatting {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    font-size: 16px;
    color: #666666;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
}

.toolbar-btn:hover {
    color: #1a1a1a;
}

.toolbar-btn.active {
    color: #FF5722;
}

[data-theme="dark"] .toolbar-btn {
    color: #999999;
}

[data-theme="dark"] .toolbar-btn:hover {
    color: #ffffff;
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background: #cccccc;
    margin: 0 4px;
}

/* Submit Button */
.comment-submit-btn {
    padding: 8px 24px;
    background: #E64A19;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.comment-submit-btn:hover {
    background: #D84315;
}

/* Emoji Picker & Mentions */
.emoji-picker-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    z-index: 100;
    background: #ffffff;
    border-radius: 8px;
    padding: 10px;
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
}

[data-theme="dark"] .emoji-picker-dropdown {
    background: #2a2a2a;
    border: 1px solid #333;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-btn {
    background: transparent;
    border: none;
    /* Remove borders */
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.emoji-btn:hover {
    background: #f0f0f0;
}

[data-theme="dark"] .emoji-btn:hover {
    background: #333;
}

.mention-suggestions {
    position: absolute;
    top: 80px;
    /* Approximate position below editor start */
    left: 20px;
    z-index: 100;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    width: 300px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

[data-theme="dark"] .mention-suggestions {
    background: #2a2a2a;
    border-color: #333;
}

.mention-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

[data-theme="dark"] .mention-item {
    border-bottom-color: #333;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item:hover {
    background: #f5f5f5;
}

[data-theme="dark"] .mention-item:hover {
    background: #333;
}

.mention-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.mention-info {
    display: flex;
    flex-direction: column;
}

.mention-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

[data-theme="dark"] .mention-name {
    color: #fff;
}

.mention-username {
    font-size: 12px;
    color: #999;
}

/* Comment Media Preview */
.comment-media-preview {
    display: none;
    margin-top: 15px;
    position: relative;
    max-width: 200px;
}

.preview-image {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

[data-theme="dark"] .preview-image {
    border-color: #333;
}

.remove-preview-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
    padding: 0;
}

.remove-preview-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Guest Fields */
.guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 10px;
    /* Ensure spacing from top elements if needed */
}

.guest-fields input {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
}

/* ============================================
   COMMENT LIST
   ============================================ */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-body {
    padding: 24px 0;
    position: relative;
}

/* Nested Comments - Thread Lines */
.children {
    list-style: none;
    padding-left: 0;
    margin-left: 20px;
    /* Indent for threads */
    position: relative;
}

/* Vertical Thread Line */
.children::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px;
    /* Position line to left of avatars */
    bottom: 24px;
    /* Stop before last item roughly */
    width: 2px;
    background-color: #f0f0f0;
}

[data-theme="dark"] .children::before {
    background-color: #333333;
}

/* Curve for each child item */
.children>li {
    position: relative;
}

.children>li::before {
    content: '';
    position: absolute;
    top: 30px;
    /* Align with avatar center roughly */
    left: -20px;
    /* Connect to vertical line */
    width: 15px;
    /* Length of curve */
    height: 20px;
    /* Height of curve */
    border-bottom-left-radius: 12px;
    border-left: 2px solid #f0f0f0;
    border-bottom: 2px solid #f0f0f0;
    display: none;
    /* Hiding complex curve for now, sticking to vertical line for simplicity or simple indent */
}

/* Comment Header */
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.comment-author-info {
    display: flex;
    gap: 12px;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-meta-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 0;
}

.comment-author-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

[data-theme="dark"] .comment-author-name {
    color: #ffffff;
}

.comment-time {
    font-size: 13px;
    color: #999999;
}

/* Author Badge */
.author-badge,
.verified-badge {
    color: #2196F3;
    /* Blue check */
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    font-size: 14px;
    margin-left: 4px;
}

.author-badge::after {
    content: '✓';
    font-weight: 900;
}

/* Comment Content */
.comment-content {
    margin: 8px 0 16px 52px;
    /* Indent content to align with text, not avatar */
    font-size: 15px;
    line-height: 1.5;
    color: #333333;
}

[data-theme="dark"] .comment-content {
    color: #cccccc;
}

/* Actions */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 52px;
    /* Indent actions */
}

.comment-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #666666;
    cursor: pointer;
    transition: color 0.2s;
}

.comment-action-btn:hover {
    color: #1a1a1a;
}

[data-theme="dark"] .comment-action-btn:hover {
    color: #ffffff;
}

.action-icon {
    font-size: 16px;
}

.reply-icon {
    display: none;
    /* Hide icon for reply, just text */
}

/* Options Button */
.comment-options {
    opacity: 0;
    /* Hide by default, show on hover */
    transition: opacity 0.2s;
}

.comment-body:hover .comment-options {
    opacity: 1;
}

.comment-options-btn {
    color: #999999;
    font-size: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Comment Options Menu */
.comment-options-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    min-width: 150px;
}

[data-theme="dark"] .comment-options-menu {
    background: #2a2a2a;
    border-color: #404040;
}

.comment-options-menu ul {
    list-style: none;
    padding: 6px 0;
    margin: 0;
}

.comment-options-menu li {
    margin: 0;
}

.comment-options-menu button {
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.comment-options-menu button:hover {
    background: #f5f5f5;
}

[data-theme="dark"] .comment-options-menu button {
    color: #e0e0e0;
}

[data-theme="dark"] .comment-options-menu button:hover {
    background: #333333;
}

.comment-options-menu button i {
    font-size: 13px;
    width: 16px;
    opacity: 0.7;
}

/* Load More (Show More) */
.comments-pagination {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    background: transparent;
    border: none;
    color: #E64A19;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
}

.load-more-btn:hover {
    background: #fff5f2;
    border-radius: 20px;
}

.load-more-btn::after {
    content: '↓';
    font-size: 16px;
}