/* =========================================================
   comments.css — بخش نظرات مقالات بلاگ
   شهبازیون | SuFramework v3.0
   ========================================================= */

/* ─────────────────────────────────────────────────────────
   ۱. Comments Section Wrapper
   ───────────────────────────────────────────────────────── */
.comments-section {
    padding: 4rem 0;
    background: var(--c-bg);
    border-top: 1px solid var(--c-border);
}

body.dark-mode .comments-section {
    background: #0a1020;
}

.comments-head {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--c-border);
}

.comments-head h2 {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--c-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.01em;
}

.comments-count {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text-muted);
}

/* ─────────────────────────────────────────────────────────
   ۲. Comment Form
   ───────────────────────────────────────────────────────── */
.comment-form {
    background: var(--c-bg-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    transition: var(--transition);
}

body.dark-mode .comment-form {
    background: #0f172a;
}

.comment-form:focus-within {
    border-color: var(--c-primary-light);
    background: var(--c-bg);
    box-shadow: 0 4px 16px rgba(109, 40, 217, 0.06);
}

/* Reply hint */
.comment-form-reply-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.95rem;
    background: rgba(109, 40, 217, 0.06);
    border: 1px solid rgba(109, 40, 217, 0.15);
    border-radius: var(--radius);
    margin-bottom: 0.9rem;
    font-size: 0.85rem;
    color: var(--c-primary-dark);
    line-height: 1.6;
}

body.dark-mode .comment-form-reply-hint {
    background: rgba(109, 40, 217, 0.12);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.3);
}

.comment-form-reply-hint strong {
    color: var(--c-primary-dark);
    font-weight: 800;
}

body.dark-mode .comment-form-reply-hint strong {
    color: #c4b5fd;
}

.reply-cancel {
    background: transparent;
    border: none;
    color: var(--c-danger);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: var(--transition-fast);
    font-family: inherit;
    flex-shrink: 0;
}

.reply-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Textarea */
.comment-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem 1.15rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.75;
    resize: vertical;
    transition: var(--transition);
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.08);
}

.comment-form textarea::placeholder {
    color: var(--c-text-muted);
}

/* Form footer */
.comment-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.9rem;
    flex-wrap: wrap;
}

.comment-char-count {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    direction: rtl;
    unicode-bidi: embed;
}

.comment-form-message {
    margin-top: 0.9rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    line-height: 1.7;
    font-weight: 600;
}

.comment-form-message.is-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.comment-form-message.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.comment-form-message.is-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

body.dark-mode .comment-form-message.is-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

body.dark-mode .comment-form-message.is-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ─────────────────────────────────────────────────────────
   ۳. Login Prompt (کاربر وارد نشده)
   ───────────────────────────────────────────────────────── */
.comment-login-prompt {
    padding: 1.75rem 1.5rem;
    text-align: center;
    background: var(--c-bg-alt);
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-lg);
    margin-bottom: 2.5rem;
}

body.dark-mode .comment-login-prompt {
    background: #0f172a;
}

.comment-login-prompt p {
    font-size: 0.95rem;
    color: var(--c-text-soft);
    margin: 0 0 1rem;
    line-height: 1.75;
}

/* ─────────────────────────────────────────────────────────
   ۴. Comments List
   ───────────────────────────────────────────────────────── */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.comments-empty {
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: var(--c-text-muted);
    background: var(--c-bg-alt);
    border-radius: var(--radius);
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.75;
}

body.dark-mode .comments-empty {
    background: #0f172a;
}

/* ─────────────────────────────────────────────────────────
   ۵. Comment Item
   ───────────────────────────────────────────────────────── */
.comment-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    background: var(--c-bg-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: var(--transition);
}

body.dark-mode .comment-item {
    background: #0f172a;
}

.comment-item:hover {
    border-color: var(--c-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

/* Admin comment */
.comment-item.is-admin {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.04), rgba(139, 92, 246, 0.02));
    border-color: rgba(109, 40, 217, 0.25);
    position: relative;
}

body.dark-mode .comment-item.is-admin {
    background: rgba(109, 40, 217, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
}

.comment-item.is-admin::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--c-primary), var(--c-accent));
    border-radius: var(--radius) 0 0 var(--radius);
}

/* ─────────────────────────────────────────────────────────
   ۶. Avatar
   ───────────────────────────────────────────────────────── */
.comment-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    flex-shrink: 0;
    user-select: none;
    overflow: hidden;
}

.comment-item.is-admin .comment-avatar {
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─────────────────────────────────────────────────────────
   ۷. Comment Body
   ───────────────────────────────────────────────────────── */
.comment-body {
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
}

.comment-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.01em;
}

.comment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.55rem;
    background: var(--c-accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: var(--radius-full);
    letter-spacing: 0.01em;
}

.comment-time {
    font-size: 0.76rem;
    color: var(--c-text-muted);
    font-weight: 500;
}

.comment-text {
    font-size: 0.92rem;
    color: var(--c-text-soft);
    line-height: 1.85;
    margin-bottom: 0.75rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.comment-text a {
    color: var(--c-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ─────────────────────────────────────────────────────────
   ۸. Comment Actions
   ───────────────────────────────────────────────────────── */
.comment-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.comment-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.comment-action:hover {
    background: var(--c-bg-soft);
    color: var(--c-primary);
    border-color: var(--c-border);
}

.comment-delete:hover {
    color: var(--c-danger);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ─────────────────────────────────────────────────────────
   ۹. Nested Comments (پاسخ)
   ───────────────────────────────────────────────────────── */
.comment-children {
    grid-column: 1 / -1;
    margin-top: 1rem;
    padding-right: 1.25rem;
    border-right: 2px solid var(--c-border);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.comment-children .comment-item {
    background: var(--c-bg);
    padding: 1rem 1.15rem;
    grid-template-columns: 40px 1fr;
    gap: 0.85rem;
}

body.dark-mode .comment-children .comment-item {
    background: #0a1020;
}

.comment-children .comment-avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.comment-children .comment-name {
    font-size: 0.88rem;
}

.comment-children .comment-text {
    font-size: 0.88rem;
}

/* ─────────────────────────────────────────────────────────
   ۱۰. Responsive
   ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .comments-section {
        padding: 2.5rem 0;
    }

    .comments-head h2 {
        font-size: 1.15rem;
    }

    .comment-form {
        padding: 1.15rem;
        border-radius: var(--radius);
    }

    .comment-form textarea {
        min-height: 100px;
        font-size: 0.92rem;
    }

    .comment-form-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .comment-char-count {
        text-align: center;
    }

    .comment-form-footer .btn {
        width: 100%;
    }

    .comment-item {
        grid-template-columns: 40px 1fr;
        gap: 0.85rem;
        padding: 1rem 1.1rem;
    }

    .comment-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }

    .comment-name {
        font-size: 0.88rem;
    }

    .comment-text {
        font-size: 0.88rem;
    }

    .comment-children {
        padding-right: 0.85rem;
        margin-top: 0.85rem;
    }

    .comment-children .comment-item {
        padding: 0.85rem 0.95rem;
        grid-template-columns: 34px 1fr;
    }

    .comment-children .comment-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .comment-item:hover {
        box-shadow: none;
    }
}