/* ==========================================================================
   Comments Area - Flat Layout
   ========================================================================== */
#comments {
    margin-top: var(--rw-space-5, 1.5rem);
    padding-top: var(--rw-space-4, 1rem);
    border-top: none;
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: var(--rw-space-4, 1rem);
}

/* Comment List */
.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list li {
    margin-bottom: var(--rw-space-4, 1rem);
}

.comment-list .comment-body {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: none;
}

.comment-list .comment-body:hover {
    border: none;
    box-shadow: none;
}

/* Header: Avatar + Name on same line */
.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.comment-avatar {
    flex-shrink: 0;
    line-height: 0;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--rw-bg-alt, #f3f4f6);
}

.comment-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.comment-author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--rw-text-heading, #111827);
    line-height: 1.2;
}

.comment-author-name a {
    color: var(--rw-text-heading, #111827);
    text-decoration: none;
    transition: color 0.15s ease;
}

.comment-author-name a:hover {
    color: var(--rw-color-primary, #0d7c3e);
}

/* Author Badge */
.comment-author-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--rw-color-primary, #0d7c3e);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    line-height: 1.4;
}

/* Comment Text - Below header */
.comment-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--rw-text-body, #4b5563);
    margin-bottom: 12px;
    padding-left: 50px;
}

.comment-text p {
    margin: 0 0 8px;
}

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

/* Footer: Date + Reply + Edit in one line */
.comment-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--rw-text-muted, #6b7280);
    padding-top: 0;
    padding-left: 50px;
    border-top: none;
}

.comment-date {
    color: var(--rw-text-muted, #6b7280);
    text-decoration: none;
    transition: color 0.15s ease;
}

.comment-date:hover {
    color: var(--rw-color-primary, #0d7c3e);
}

.comment-footer .comment-reply-link,
.comment-footer .comment-edit-link {
    color: var(--rw-color-primary, #0d7c3e);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.comment-footer .comment-reply-link:hover,
.comment-footer .comment-edit-link:hover {
    color: var(--rw-color-link-hover, #0f1e33);
    text-decoration: underline;
}

.comment-separator {
    color: #d1d5db;
    font-size: 0.7rem;
}

/* Nested comments */
.comment-list .children {
    list-style: none;
    margin: 0;
    padding-left: 30px;
    position: relative;
}

.comment-list .children::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--rw-color-primary, #0d7c3e);
    opacity: 0.2;
}

.comment-list .children .comment-body {
    border-left: none;
}

/* Awaiting moderation */
.comment-awaiting-moderation {
    font-size: 0.8rem;
    color: #d97706;
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 0 0 12px 50px;
    border-left: 3px solid #f59e0b;
}

/* Mobile */
@media (max-width: 600px) {
    .comments-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-list .comment-body {
        padding: 0;
    }

    .comment-avatar img {
        width: 36px;
        height: 36px;
    }

    .comment-text {
        padding-left: 0;
        margin-top: 12px;
    }

    .comment-footer {
        padding-left: 0;
        gap: 8px;
        font-size: 0.72rem;
    }

    .comment-list .children {
        padding-left: 16px;
    }

    .comment-list .children::before {
        left: 8px;
    }

    .comment-awaiting-moderation {
        margin-left: 0;
    }
}

/* Dark Mode */
html[data-theme="dark"] .comment-list .comment-body {
    background: transparent;
    border: none;
}

html[data-theme="dark"] .comment-list .comment-body:hover {
    border: none;
}

html[data-theme="dark"] .comment-author-name,
html[data-theme="dark"] .comment-author-name a {
    color: var(--rw-text-heading, #f8fafc);
}

html[data-theme="dark"] .comment-text {
    color: var(--rw-text-body, #cbd5e1);
}

html[data-theme="dark"] .comment-footer {
    border-top: none;
}

html[data-theme="dark"] .comment-separator {
    color: #64748b;
}

/* ==========================================================================
   Comment Form - Flat Styling
   ========================================================================== */
.comment-respond {
    margin-top: var(--rw-space-5, 1.5rem);
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.comment-respond .comment-reply-title {
    font-family: var(--rw-font-primary, 'Lexend', system-ui, sans-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rw-text-heading, #111827);
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
    position: static;
}

.comment-respond .comment-reply-title::after {
    display: none;
}

.comment-notes {
    font-size: 0.82rem;
    color: var(--rw-text-muted, #6b7280);
    margin-bottom: 20px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-left: none;
}

.comment-form-row {
    margin-bottom: 16px;
}

.comment-form-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rw-text-heading, #111827);
    margin-bottom: 6px;
}

.comment-form-row .required {
    color: #dc2626;
}

.comment-form-row input,
.comment-form-comment textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--rw-border-light, #e5e7eb);
    border-radius: 8px;
    font-size: 0.9rem;
    background: transparent;
    color: var(--rw-text-body, #4b5563);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.comment-form-row input:hover,
.comment-form-comment textarea:hover {
    border-color: #d1d5db;
}

.comment-form-row input:focus,
.comment-form-comment textarea:focus {
    outline: none;
    border-color: var(--rw-color-primary, #0d7c3e);
    box-shadow: 0 0 0 3px rgba(13, 124, 62, 0.1);
}

.comment-form-comment {
    margin-bottom: 20px;
}

.comment-form-comment label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rw-text-heading, #111827);
    margin-bottom: 6px;
}

.comment-form-comment textarea {
    resize: vertical;
    min-height: 120px;
}

/* ==========================================================================
   Comment Submit Button — Compact
   ========================================================================== */

.comment-respond .comment-submit,
.comment-respond .submit,
.comment-form .comment-submit,
.comment-form .submit,
button.comment-submit,
input.comment-submit,
button[type="submit"].comment-submit {
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 10px 24px !important;

    background: var(--rw-color-primary, #0d7c3e) !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 6px !important;

    font-family: inherit !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;

    cursor: pointer !important;
    box-sizing: border-box !important;
    position: relative;
    overflow: hidden;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease !important;
}

.comment-respond .comment-submit:hover,
.comment-respond .submit:hover,
.comment-form .comment-submit:hover,
.comment-form .submit:hover,
button.comment-submit:hover,
input.comment-submit:hover {
    background: #0a6632 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(13, 124, 62, 0.25) !important;
}

.comment-respond .comment-submit:active,
.comment-form .comment-submit:active,
button.comment-submit:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(13, 124, 62, 0.2) !important;
}

.comment-respond .comment-submit:focus-visible,
.comment-form .comment-submit:focus-visible,
button.comment-submit:focus-visible {
    outline: 3px solid var(--rw-color-primary, #0d7c3e) !important;
    outline-offset: 2px !important;
}

/* Logged in as */
.logged-in-as {
    font-size: 0.85rem;
    color: var(--rw-text-muted, #6b7280);
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.logged-in-as a {
    color: var(--rw-color-primary, #0d7c3e);
    text-decoration: none;
    font-weight: 600;
}

.logged-in-as a:hover {
    text-decoration: underline;
}

/* Must log in */
.must-log-in {
    font-size: 0.9rem;
    color: var(--rw-text-muted, #6b7280);
    text-align: center;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.must-log-in a {
    color: var(--rw-color-primary, #0d7c3e);
    text-decoration: none;
    font-weight: 600;
}

.must-log-in a:hover {
    text-decoration: underline;
}

/* Cookie Consent */
.comment-form-cookies-consent {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-form-cookies-consent input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.comment-form-cookies-consent label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--rw-text-muted, #6b7280);
}

/* Form Footer */
.form-submit {
    margin: 0;
}

/* Responsive — Compact button on mobile too */
@media (max-width: 600px) {
    .comment-respond {
        padding: 0;
    }

    .comment-respond .comment-submit,
    .comment-respond .submit,
    .comment-form .comment-submit,
    .comment-form .submit,
    button.comment-submit,
    input.comment-submit,
    button[type="submit"].comment-submit {
        width: auto !important;
        padding: 10px 20px !important;
        font-size: 0.78rem !important;
    }
}

/* ==========================================================================
   COMMENTS — Complete Dark Mode
   ========================================================================== */

html[data-theme="dark"] .comment-list .comment-body,
html[data-theme="dark"] .comment-list .comment-body:hover {
    background: transparent;
    border: none;
    box-shadow: none;
}

html[data-theme="dark"] .comment-author-name,
html[data-theme="dark"] .comment-author-name a {
    color: #f8fafc;
}

html[data-theme="dark"] .comment-author-name a:hover {
    color: #34d399;
}

html[data-theme="dark"] .comment-author-badge {
    background: #34d399;
    color: #0f172a;
}

html[data-theme="dark"] .comment-author-badge.comment-badge-editor {
    background: #60a5fa;
    color: #0f172a;
}

html[data-theme="dark"] .comment-author-badge.comment-badge-admin {
    background: #f87171;
    color: #0f172a;
}

html[data-theme="dark"] .comment-text,
html[data-theme="dark"] .comment-text p {
    color: #cbd5e1;
}

html[data-theme="dark"] .comment-text a {
    color: #34d399;
}

html[data-theme="dark"] .comment-text a:hover {
    color: #6ee7b7;
}

html[data-theme="dark"] .comment-footer {
    color: #94a3b8;
    border-top: none;
}

html[data-theme="dark"] .comment-date,
html[data-theme="dark"] .comment-footer time,
html[data-theme="dark"] .comment-footer time a {
    color: #94a3b8;
}

html[data-theme="dark"] .comment-date:hover,
html[data-theme="dark"] .comment-footer time a:hover {
    color: #34d399;
}

html[data-theme="dark"] .comment-footer .comment-reply-link,
html[data-theme="dark"] .comment-footer .comment-edit-link,
html[data-theme="dark"] .comment-reply-link {
    color: #34d399;
    text-decoration: none;
    font-weight: 600;
}

html[data-theme="dark"] .comment-footer .comment-reply-link:hover,
html[data-theme="dark"] .comment-footer .comment-edit-link:hover,
html[data-theme="dark"] .comment-reply-link:hover {
    color: #6ee7b7;
    text-decoration: underline;
}

html[data-theme="dark"] .comment-separator {
    color: #64748b;
}

html[data-theme="dark"] .comment-awaiting-moderation {
    background: #422006;
    color: #fcd34d;
    border-left-color: #f59e0b;
}

html[data-theme="dark"] .comment-list .children::before {
    background: #34d399;
    opacity: 0.3;
}

/* ==========================================================================
   COMMENT FORM — Dark Mode
   ========================================================================== */

html[data-theme="dark"] .comment-respond,
html[data-theme="dark"] .comment-respond .comment-reply-title {
    color: #f8fafc;
    background: transparent;
    border: none;
}

html[data-theme="dark"] .comment-notes,
html[data-theme="dark"] .logged-in-as,
html[data-theme="dark"] .must-log-in {
    color: #94a3b8;
    background: transparent;
}

html[data-theme="dark"] .logged-in-as a,
html[data-theme="dark"] .must-log-in a {
    color: #34d399;
}

html[data-theme="dark"] .logged-in-as a:hover,
html[data-theme="dark"] .must-log-in a:hover {
    color: #6ee7b7;
}

html[data-theme="dark"] .comment-form-row label,
html[data-theme="dark"] .comment-form-comment label {
    color: #e2e8f0;
}

html[data-theme="dark"] .comment-form-row input,
html[data-theme="dark"] .comment-form-comment textarea {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

html[data-theme="dark"] .comment-form-row input::placeholder,
html[data-theme="dark"] .comment-form-comment textarea::placeholder {
    color: #64748b;
}

html[data-theme="dark"] .comment-form-row input:focus,
html[data-theme="dark"] .comment-form-comment textarea:focus {
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

html[data-theme="dark"] .comment-form-cookies-consent label {
    color: #94a3b8;
}

/* Submit button — dark mode */
html[data-theme="dark"] .comment-respond .comment-submit,
html[data-theme="dark"] .comment-respond .submit,
html[data-theme="dark"] .comment-form .comment-submit,
html[data-theme="dark"] .comment-form .submit,
html[data-theme="dark"] button.comment-submit,
html[data-theme="dark"] input.comment-submit,
html[data-theme="dark"] button[type="submit"].comment-submit {
    background: #34d399 !important;
    color: #0f172a !important;
}

html[data-theme="dark"] .comment-respond .comment-submit:hover,
html[data-theme="dark"] .comment-respond .submit:hover,
html[data-theme="dark"] .comment-form .comment-submit:hover,
html[data-theme="dark"] .comment-form .submit:hover,
html[data-theme="dark"] button.comment-submit:hover {
    background: #6ee7b7 !important;
    color: #0f172a !important;
}

/* ==========================================================================
   Comments Sort Buttons — Flat
   ========================================================================== */
.comments-sort {
    display: flex;
    gap: 4px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    position: relative;
    border: none;
    box-shadow: none;
}

.sort-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--rw-text-muted, #6b7280);
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s ease;
    position: relative;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.sort-btn:hover:not(.active) {
    color: var(--rw-text-heading, #111827);
    background: transparent;
}

.sort-btn.active {
    background: transparent;
    color: var(--rw-text-heading, #111827);
    box-shadow: none;
    font-weight: 700;
}

.sort-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--rw-color-primary, #0d7c3e);
    border-radius: 1px;
}

.sort-btn:focus-visible {
    outline: 2px solid var(--rw-color-primary, #0d7c3e);
    outline-offset: 2px;
}

.sort-btn:active:not(.active) {
    transform: none;
}

@media (max-width: 600px) {
    .comments-sort {
        width: 100%;
        justify-content: flex-start;
    }

    .sort-btn {
        flex: 0 0 auto;
        padding: 4px 10px;
        font-size: 0.75rem;
        text-align: left;
    }
}

/* Dark Mode */
html[data-theme="dark"] .comments-sort {
    background: transparent;
    border: none;
    box-shadow: none;
}

html[data-theme="dark"] .sort-btn {
    color: #94a3b8;
}

html[data-theme="dark"] .sort-btn:hover:not(.active) {
    color: #e2e8f0;
    background: transparent;
}

html[data-theme="dark"] .sort-btn.active {
    background: transparent;
    color: #f8fafc;
    box-shadow: none;
}

html[data-theme="dark"] .sort-btn.active::after {
    background: #34d399;
}

html[data-theme="dark"] .sort-btn:focus-visible {
    outline-color: #34d399;
}