/* ============================================
   بخش کامنت‌ها - کاملاً ریسپانسیو
   ============================================ */

:root {
    --comment-primary: #5B46F7;
    --comment-primary-light: #8B7BF9;
    --comment-primary-dark: #3B2BB5;
    --comment-bg: #ffffff;
    --comment-border: rgba(91, 70, 247, 0.1);
    --comment-text: #1a1a2e;
    --comment-text-light: #64748b;
}

.comments-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--comment-border);
    position: relative;
}

/* هدر کامنت‌ها */
.comments-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.comments-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--comment-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comments-title i {
    color: var(--comment-primary);
    font-size: 1.2rem;
}

.comments-count {
    background: rgba(91, 70, 247, 0.1);
    color: var(--comment-primary);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ============================================
   فرم ارسال کامنت
   ============================================ */
.comment-form-box {
    background: var(--comment-bg);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 48px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--comment-border);
    transition: all 0.3s ease;
}

.comment-form-box:focus-within {
    box-shadow: 0 15px 40px rgba(91, 70, 247, 0.08);
    border-color: var(--comment-primary-light);
}

/* فیلدهای مهمان */
.guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.comment-form-box.active .guest-fields {
    max-height: 120px;
    opacity: 1;
    margin-bottom: 20px;
}

.c-input {
    width: 100%;
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px 16px;
    font-family: 'vazir', sans-serif;
    font-size: 0.85rem;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

.c-input:focus {
    border-color: var(--comment-primary);
    background: white;
}

/* بنر پاسخ دادن */
.replying-to-banner {
    background: rgba(91, 70, 247, 0.06);
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    color: var(--comment-primary);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.replying-to-banner span {
    flex: 1;
    word-break: break-word;
}

.cancel-reply-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    transition: 0.2s;
}

.cancel-reply-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* تکست‌ایریا */
.c-textarea {
    width: 100%;
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    border-radius: 18px;
    padding: 14px 18px;
    font-family: 'vazir', sans-serif;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

.c-textarea:focus {
    border-color: var(--comment-primary);
    background: white;
}

/* تولبار فرم */
.form-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

/* دکمه‌های ریاکشن سریع */
.reaction-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reaction-btn {
    width: 38px;
    height: 38px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--comment-text-light);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-btn:hover {
    transform: scale(1.15) translateY(-3px);
    background: white;
    border-color: var(--comment-primary);
    color: var(--comment-primary);
    box-shadow: 0 6px 12px rgba(91, 70, 247, 0.15);
}

/* دکمه ارسال */
.send-btn {
    background: linear-gradient(135deg, var(--comment-primary), var(--comment-primary-dark));
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    pointer-events: none;
}

.send-btn i {
    font-size: 0.8rem;
}

.send-btn.ready {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 6px 20px rgba(91, 70, 247, 0.35);
}

.send-btn.ready:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(91, 70, 247, 0.45);
}

/* ============================================
   لیست کامنت‌ها
   ============================================ */
.comments-list {
    margin-top: 16px;
}

/* کامنت اصلی */
.comment-item {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
    animation: commentFadeIn 0.4s ease;
}

@keyframes commentFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* آواتار */
.comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--comment-primary), var(--comment-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(91, 70, 247, 0.2);
}

/* بدنه کامنت */
.comment-body {
    flex: 1;
    min-width: 0;
}

/* حباب کامنت */
.comment-bubble {
    background: #f8fafc;
    border-radius: 20px 20px 20px 8px;
    padding: 14px 18px;
    transition: 0.2s;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.comment-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--comment-text);
}

.comment-time {
    font-size: 0.7rem;
    color: var(--comment-text-light);
}

.comment-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #334155;
    margin: 0;
    word-break: break-word;
}

/* اکشن‌های کامنت */
.comment-actions {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    margin-right: 8px;
}

.comment-action-btn {
    background: none;
    border: none;
    font-size: 0.7rem;
    color: var(--comment-text-light);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 20px;
}

.comment-action-btn i {
    font-size: 0.7rem;
}

.comment-action-btn:hover {
    color: var(--comment-primary);
    background: rgba(91, 70, 247, 0.05);
}

/* ============================================
   ریپلی‌ها (با محدودیت عمق)
   ============================================ */
.replies-container {
    margin-top: 12px;
    margin-right: 48px;
    padding-right: 16px;
    border-right: 2px solid #e2e8f0;
    position: relative;
}

.replies-container[data-depth="0"] {
    border-right-color: var(--comment-primary-light);
}

.replies-container[data-depth="1"] {
    border-right-color: #cbd5e1;
}

.replies-container[data-depth="2"] {
    border-right-color: #e2e8f0;
}

/* ریپل ایتم */
.reply-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: replyFadeIn 0.3s ease;
}

@keyframes replyFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--comment-primary-light), var(--comment-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.reply-body {
    flex: 1;
    min-width: 0;
}

.reply-bubble {
    background: transparent;
    padding: 0;
}

.reply-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.reply-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--comment-text);
}

.reply-name i {
    font-size: 0.65rem;
    margin-left: 4px;
    color: var(--comment-primary);
}

.reply-time {
    font-size: 0.65rem;
    color: var(--comment-text-light);
}

.reply-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #475569;
    margin: 0;
    word-break: break-word;
}

.reply-actions {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.reply-action-btn {
    background: none;
    border: none;
    font-size: 0.65rem;
    color: var(--comment-text-light);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 16px;
}

.reply-action-btn i {
    font-size: 0.6rem;
}

.reply-action-btn:hover {
    color: var(--comment-primary);
}

/* ============================================
   حالت خالی
   ============================================ */
.empty-comments {
    text-align: center;
    padding: 60px 32px;
    background: #f8fafc;
    border-radius: 28px;
    border: 1px dashed var(--comment-border);
}

.empty-comments i {
    font-size: 3rem;
    color: var(--comment-text-light);
    opacity: 0.4;
    margin-bottom: 16px;
}

.empty-comments p {
    font-size: 0.9rem;
    color: var(--comment-text-light);
    margin: 0;
}

/* ============================================
   پاپ‌آپ موفقیت
   ============================================ */
.success-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #065f46;
    padding: 12px 24px;
    border-radius: 60px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-size: 0.85rem;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.success-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.success-toast i {
    font-size: 1rem;
    color: #10b981;
}

/* ============================================
   ریسپانسیو کامل (موبایل)
   ============================================ */
@media (max-width: 768px) {
    .comments-section {
        margin-top: 32px;
        padding-top: 24px;
        padding-right:12px;
    }
    
    .comments-title {
        font-size: 1.1rem;
    }
    
    .comment-form-box {
        
        margin-bottom: 32px;
        border-radius: 20px;
        min-width: 300px;
    }
    
    .guest-fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .comment-form-box.active .guest-fields {
        max-height: 180px;
    }
    
    .c-input, .c-textarea {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
    
    .form-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reaction-bar {
        justify-content: center;
        order: 2;
    }
    
    .send-btn {
        justify-content: center;
        order: 1;
        margin-bottom: 12px;
    }
    
    /* کامنت در موبایل */
    .comment-item {
        gap: 10px;
    }
    
    .comment-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    
    .comment-bubble {
        padding: 10px 14px;
        border-radius: 16px 16px 16px 6px;
    }
    
    .comment-name {
        font-size: 0.85rem;
    }
    
    .comment-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .comment-actions {
        gap: 12px;
        margin-right: 4px;
    }
    
    .comment-action-btn span {
        display: none;
    }
    
    .comment-action-btn i {
        font-size: 0.85rem;
    }
    
    /* ریپلی در موبایل */
    .replies-container {
        margin-right: 20px;
        padding-right: 10px;
        border-right-width: 1.5px;
    }
    
    .replies-container[data-depth="0"] {
        margin-right: 16px;
        padding-right: 8px;
    }
    
    .replies-container[data-depth="1"] {
        margin-right: 12px;
        padding-right: 6px;
    }
    
    .reply-item {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .reply-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .reply-name {
        font-size: 0.8rem;
    }
    
    .reply-text {
        font-size: 0.8rem;
    }
    
    .reply-actions span {
        display: none;
    }
    
    .reply-action-btn i {
        font-size: 0.8rem;
    }
    
    /* بنر پاسخ */
    .replying-to-banner {
        font-size: 0.75rem;
        padding: 8px 12px;
    }
    
    .cancel-reply-btn {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
    
    /* پاپ‌آپ */
    .success-toast {
        white-space: normal;
        text-align: center;
        max-width: 90%;
        padding: 10px 20px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .comments-section {
        margin-top: 24px;
        padding-top: 16px;
    }
    
    .comment-form-box {
        padding: 14px;
        margin-bottom: 24px;
    }
    
    .replies-container {
        margin-right: 12px;
        padding-right: 6px;
    }
    
    .replies-container[data-depth="0"] {
        margin-right: 8px;
        padding-right: 4px;
    }
    
    .comment-text {
        font-size: 0.8rem;
    }
    
    .reply-text {
        font-size: 0.75rem;
    }
    
    .empty-comments {
        padding: 40px 20px;
    }
    
    .empty-comments i {
        font-size: 2.5rem;
    }
    
    .empty-comments p {
        font-size: 0.8rem;
    }
}