/* Comments section — courses & blogs */

body.active-dark-mode {
    --cm-bg: rgba(255, 255, 255, 0.03);
    --cm-border: rgba(255, 255, 255, 0.1);
    --cm-title: #fff;
    --cm-muted: rgba(255, 255, 255, 0.55);
    --cm-text: rgba(255, 255, 255, 0.82);
    --cm-input-bg: rgba(255, 255, 255, 0.04);
    --cm-input-border: rgba(255, 255, 255, 0.12);
    --cm-input-text: #fff;
    --cm-avatar-bg: rgba(5, 157, 255, 0.18);
    --cm-avatar-color: #7dd3fc;
    --cm-item-bg: rgba(255, 255, 255, 0.025);
    --cm-login-bg: rgba(5, 157, 255, 0.08);
}

body.active-light-mode {
    --cm-bg: #ffffff;
    --cm-border: #e5e7eb;
    --cm-title: #111827;
    --cm-muted: #6b7280;
    --cm-text: #374151;
    --cm-input-bg: #f9fafb;
    --cm-input-border: #d1d5db;
    --cm-input-text: #111827;
    --cm-avatar-bg: rgba(5, 157, 255, 0.12);
    --cm-avatar-color: #0284c7;
    --cm-item-bg: #f8fafc;
    --cm-login-bg: rgba(5, 157, 255, 0.06);
}

.comments-section {
    margin-top: 48px;
    padding: 28px 24px;
    border-radius: 20px;
    border: 1px solid var(--cm-border);
    background: var(--cm-bg);
}

.comments-section__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.comments-section__eyebrow {
    display: block;
    margin-bottom: 6px;
    color: #059dff;
    font-size: 13px;
    font-weight: 600;
}

.comments-section__title {
    margin: 0;
    color: var(--cm-title);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 700;
}

.comments-section__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--cm-border);
    color: var(--cm-muted);
    font-size: 13px;
    font-weight: 600;
}

.comments-form {
    margin-bottom: 28px;
}

.comments-form__label {
    display: block;
    margin-bottom: 8px;
    color: var(--cm-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.comments-form__textarea {
    width: 100%;
    min-height: 120px;
    margin: 0 0 12px;
    padding: 14px 16px;
    border: 1px solid var(--cm-input-border);
    border-radius: 14px;
    background: var(--cm-input-bg);
    color: var(--cm-input-text);
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comments-form__textarea:focus {
    border-color: #059dff;
    box-shadow: 0 0 0 4px rgba(5, 157, 255, 0.16);
}

.comments-form__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.comments-form__hint {
    margin: 0;
    color: var(--cm-muted);
    font-size: 12px;
}

.comments-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(95deg, #059dff 0%, #3b82f6 50%, #6549d5 100%);
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(5, 157, 255, 0.25);
}

.comments-form__submit:hover {
    transform: translateY(-1px);
    color: #fff !important;
}

.comments-form__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.comments-login {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid rgba(5, 157, 255, 0.22);
    background: var(--cm-login-bg);
    flex-wrap: wrap;
}

.comments-login__text {
    margin: 0;
    color: var(--cm-text);
    font-size: 14px;
    line-height: 1.7;
}

.comments-login__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.comments-login__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.comments-login__btn--primary {
    background: #059dff;
    color: #fff !important;
}

.comments-login__btn--ghost {
    border: 1px solid var(--cm-border);
    color: var(--cm-text) !important;
    background: transparent;
}

.comments-list {
    display: grid;
    gap: 14px;
}

.comment-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--cm-border);
    background: var(--cm-item-bg);
}

.comment-item__avatar,
.comment-item__avatar-fallback {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
}

.comment-item__avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cm-avatar-bg);
    color: var(--cm-avatar-color);
    font-size: 16px;
    font-weight: 700;
}

.comment-item__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.comment-item__name {
    margin: 0;
    color: var(--cm-title);
    font-size: 14px;
    font-weight: 700;
}

.comment-item__date {
    color: var(--cm-muted);
    font-size: 12px;
}

.comment-item__body {
    margin: 0;
    color: var(--cm-text);
    font-size: 14px;
    line-height: 1.85;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-item__reply {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(5, 157, 255, 0.22);
    background: rgba(5, 157, 255, 0.08);
}

body.active-light-mode .comment-item__reply {
    background: rgba(5, 157, 255, 0.06);
}

.comment-item__reply-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
    color: #059dff;
    font-size: 12px;
}

.comment-item__reply-head strong {
    font-weight: 700;
}

.comment-item__reply-head time {
    margin-right: auto;
    color: var(--cm-muted);
    font-size: 11px;
}

.comment-item__reply-body {
    margin: 0;
    color: var(--cm-text);
    font-size: 13.5px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.comments-empty {
    padding: 28px 18px;
    border-radius: 14px;
    border: 1px dashed var(--cm-border);
    text-align: center;
    color: var(--cm-muted);
    font-size: 14px;
}

@media (max-width: 575px) {
    .comments-section {
        margin-top: 32px;
        padding: 20px 14px;
        border-radius: 16px;
    }

    .comment-item {
        grid-template-columns: 40px 1fr;
        gap: 10px;
        padding: 14px 12px;
    }

    .comment-item__avatar,
    .comment-item__avatar-fallback {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 14px;
    }
}
