/* =========================================
   PEANIR INSTAGRAM-STYLE COMMENTS MODAL
========================================= */

/* --- 1. لایه اصلی مودال --- */
.pean-comments-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.pean-comments-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pean-comments-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* --- 2. باکس محتوای مودال (دسکتاپ) --- */
.pean-comments-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 80vh;
    max-height: 700px;
    background: #ffffff;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.pean-comments-modal.hidden .pean-comments-content {
    transform: scale(0.95);
}

/* --- 3. هدر مودال --- */
.pean-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f4f4f5;
    background: #ffffff;
    z-index: 10;
}

.pean-comments-title {
    font-size: 16px;
    font-weight: 800;
    color: #111;
    margin: 0;
}

.pean-comments-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #111;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 4. بدنه (لیست کامنت‌ها) --- */
.pean-comments-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

.pean-comments-body::-webkit-scrollbar { width: 4px; }
.pean-comments-body::-webkit-scrollbar-thumb { background: #e4e4e7; border-radius: 4px; }

.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list li.comment { margin-bottom: 24px; }

.comment-meta { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.comment-meta img.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.comment-info { display: flex; flex-direction: column; }
.comment-author { font-size: 13px; font-weight: 700; color: #111; }
.comment-author a { color: inherit; text-decoration: none; }
.comment-time { font-size: 11px; color: #a1a1aa; font-weight: 500; margin-top: 2px; }

.comment-text { font-size: 14px; color: #3f3f46; line-height: 1.5; padding-right: 48px; }
.comment-text p { margin: 0; }

.reply { padding-right: 48px; margin-top: 8px; }
.reply-btn { font-size: 12px; font-weight: 700; color: #71717a; cursor: pointer; transition: color 0.2s; }
.reply-btn:hover { color: #111; }

.comment-list .children { margin: 16px 48px 0 0; border-right: 2px solid #f4f4f5; padding-right: 16px; list-style: none; }

.no-comments-message { text-align: center; color: #71717a; font-size: 14px; margin-top: 40px; }

/* --- 5. فوتر مودال (فرم ارسال) --- */
.pean-comments-footer {
    padding: 16px 20px;
    border-top: 1px solid #f4f4f5;
    background: #ffffff;
    z-index: 10;
}

#pean-ajax-comment-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.current-user-avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

#pean-comment-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    color: #111;
    max-height: 100px;
    padding: 8px 0;
}

#pean-comment-input::placeholder { color: #a1a1aa; }

#pean-submit-comment {
    background: transparent;
    color: #3b82f6; /* رنگ آبی اینستاگرام برای دکمه ارسال */
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 0;
    transition: opacity 0.2s;
}

#pean-submit-comment:disabled { opacity: 0.4; cursor: default; }

/* --- 6. حالت موبایل (Bottom Sheet) --- */
@media (max-width: 768px) {
    .pean-comments-modal { align-items: flex-end; }
    
    .pean-comments-content {
        max-width: 100%;
        height: 75vh; /* ارتفاع در موبایل */
        border-radius: 24px 24px 0 0;
        transform: translateY(0);
    }

    .pean-comments-modal.hidden .pean-comments-content {
        transform: translateY(100%); /* انیمیشن کشویی از پایین */
    }

    .pean-comments-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}