/* ============================================================
   SmartNewsAI — Comments Modal (TikTok/Instagram style, 2026-10-05)
   Desktop: панель справа. Mobile: bottom-sheet снизу.
   ============================================================ */

.sn-comments-overlay {
    position: fixed;
    inset: 0;
    z-index: 99990;
    background: rgba(3, 5, 12, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}
.sn-comments-overlay.sn-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sn-comments-panel {
    width: 440px;
    max-width: 100vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 28, 0.97);
    border-left: 1px solid rgba(0, 229, 255, 0.12);
    box-shadow: -24px 0 80px rgba(0, 0, 0, 0.6);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.32,.72,.35,1);
    color: #e6edf3;
    font-family: inherit;
}
.sn-comments-overlay.sn-open .sn-comments-panel { transform: translateX(0); }

/* Шапка */
.sn-comments-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.sn-comments-head__title {
    font-size: 16px;
    font-weight: 700;
    color: #F1F5F9;
}
.sn-comments-head__count {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}
.sn-comments-close {
    margin-left: auto;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s;
    display: flex; align-items: center; justify-content: center;
}
.sn-comments-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Список */
.sn-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,.25) transparent;
}
.sn-comments-list::-webkit-scrollbar { width: 6px; }
.sn-comments-list::-webkit-scrollbar-thumb { background: rgba(0,229,255,.2); border-radius: 3px; }

.sn-comments-empty {
    text-align: center;
    padding: 48px 20px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}
.sn-comments-empty__icon { font-size: 40px; display: block; margin-bottom: 12px; }

/* Скелетон загрузки */
.sn-comments-skeleton {
    display: flex; gap: 12px; margin-bottom: 18px;
}
.sn-comments-skeleton__ava {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 75%);
    background-size: 200% 100%;
    animation: sn-shimmer 1.3s infinite;
    flex-shrink: 0;
}
.sn-comments-skeleton__lines { flex: 1; }
.sn-comments-skeleton__line {
    height: 10px; border-radius: 5px; margin-bottom: 8px;
    background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 75%);
    background-size: 200% 100%;
    animation: sn-shimmer 1.3s infinite;
}
@keyframes sn-shimmer { to { background-position: -200% 0; } }

/* Комментарий */
.sn-comment { display: flex; gap: 12px; margin-bottom: 20px; animation: sn-fadein .25s ease; }
@keyframes sn-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sn-comment__ava {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #04121a;
    flex-shrink: 0; text-transform: uppercase;
}
.sn-comment__body { flex: 1; min-width: 0; }
.sn-comment__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sn-comment__name { font-size: 13px; font-weight: 700; color: #00E5FF; }
.sn-comment__date { font-size: 11px; color: #64748b; }
.sn-comment__edited { font-size: 11px; color: #475569; font-style: italic; }
.sn-comment__text {
    font-size: 14px; line-height: 1.55; color: #dbe4f0;
    margin-top: 3px; word-wrap: break-word; white-space: pre-wrap;
}
.sn-comment__actions {
    display: flex; align-items: center; gap: 14px;
    margin-top: 7px; font-size: 12px;
}
.sn-comment__act {
    background: none; border: none; padding: 0;
    color: #64748b; cursor: pointer; font-size: 12px;
    display: inline-flex; align-items: center; gap: 5px;
    transition: color .15s; font-family: inherit;
}
.sn-comment__act:hover { color: #cbd5e1; }
.sn-comment__act.sn-active-like { color: #00E5FF; }
.sn-comment__act.sn-active-dislike { color: #f87171; }
.sn-comment__act--more { margin-left: auto; font-size: 16px; letter-spacing: 1px; }

/* Дропдаун ⋯ */
.sn-comment-menu {
    position: absolute;
    background: rgba(21, 32, 58, 0.98);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    z-index: 99999;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.sn-comment-menu button {
    display: block; width: 100%; text-align: left;
    background: none; border: none; color: #dbe4f0;
    padding: 9px 12px; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-family: inherit;
}
.sn-comment-menu button:hover { background: rgba(255,255,255,0.07); }
.sn-comment-menu button.sn-danger { color: #f87171; }

/* Ответы */
.sn-comment__replies { margin-top: 12px; padding-left: 14px; border-left: 2px solid rgba(0,229,255,0.12); }
.sn-comment__replies .sn-comment { margin-bottom: 14px; }
.sn-comment__replies .sn-comment:last-child { margin-bottom: 0; }
.sn-comment__reply-link {
    background: none; border: none; color: #00E5FF;
    font-size: 12px; cursor: pointer; padding: 0; margin-top: 8px;
    font-family: inherit; opacity: .8;
}
.sn-comment__reply-link:hover { opacity: 1; text-decoration: underline; }

/* Инлайн-редактор / ответ */
.sn-comment-inline {
    margin-top: 8px;
    display: flex; flex-direction: column; gap: 8px;
}
.sn-comment-inline textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: #e6edf3;
    padding: 10px 12px;
    font-size: 13px; font-family: inherit;
    resize: vertical; min-height: 60px;
    outline: none;
}
.sn-comment-inline textarea:focus { border-color: rgba(0,229,255,0.5); }
.sn-comment-inline__row { display: flex; gap: 8px; justify-content: flex-end; }
.sn-comment-inline__btn {
    border: none; border-radius: 10px; padding: 8px 16px;
    font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
    background: rgba(255,255,255,0.08); color: #cbd5e1;
}
.sn-comment-inline__btn--primary { background: linear-gradient(135deg, #00E5FF, #2563eb); color: #04121a; }

/* Композер */
.sn-comments-composer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: rgba(8, 12, 24, 0.98);
}
.sn-comments-composer__row { display: flex; gap: 10px; align-items: flex-end; }
.sn-comments-composer textarea {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    color: #e6edf3;
    padding: 11px 16px;
    font-size: 14px; font-family: inherit;
    resize: none; min-height: 42px; max-height: 140px;
    outline: none; line-height: 1.4;
}
.sn-comments-composer textarea:focus { border-color: rgba(0,229,255,0.5); }
.sn-comments-composer textarea::placeholder { color: #475569; }

.sn-comments-composer__send {
    width: 42px; height: 42px; border-radius: 50%;
    border: none; cursor: pointer; flex-shrink: 0;
    background: linear-gradient(135deg, #00E5FF, #2563eb);
    color: #04121a; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, opacity .15s;
}
.sn-comments-composer__send:hover { transform: scale(1.06); }
.sn-comments-composer__send:disabled { opacity: .4; cursor: default; transform: none; }

.sn-comments-composer__meta {
    display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap;
}
.sn-comments-composer__name {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    color: #e6edf3;
    padding: 8px 12px;
    font-size: 13px; font-family: inherit;
    width: 150px; outline: none;
}
.sn-comments-composer__name:focus { border-color: rgba(0,229,255,0.5); }
.sn-comments-composer__emoji-btn {
    background: none; border: none; font-size: 20px; cursor: pointer; padding: 2px;
}
.sn-comments-composer__captcha { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; }
.sn-comments-composer__captcha input {
    width: 52px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
    color: #e6edf3; padding: 6px 8px; font-size: 12px; outline: none; text-align: center;
}
.sn-comments-composer__consent {
    display: flex; align-items: center; gap: 6px; font-size: 11px; color: #64748b;
    width: 100%;
}
.sn-comments-composer__consent a { color: #00E5FF; }

/* Эмоджи-палитра */
.sn-emoji-pop {
    position: absolute;
    bottom: 100%; left: 18px;
    margin-bottom: 8px;
    background: rgba(21, 32, 58, 0.98);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    z-index: 99999;
    box-shadow: 0 -8px 40px rgba(0,0,0,.5);
}
.sn-emoji-pop button {
    background: none; border: none; font-size: 20px;
    padding: 5px; cursor: pointer; border-radius: 8px;
}
.sn-emoji-pop button:hover { background: rgba(255,255,255,0.08); }

/* Тост */
.sn-comments-toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(21, 32, 58, 0.98);
    border: 1px solid rgba(0,229,255,0.3);
    color: #e6edf3;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 13px;
    z-index: 99999;
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
}
.sn-comments-toast.sn-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Mobile: bottom sheet ===== */
@media (max-width: 640px) {
    .sn-comments-overlay { align-items: flex-end; justify-content: center; }
    .sn-comments-panel {
        width: 100%;
        height: 82vh;
        border-left: none;
        border-top: 1px solid rgba(0,229,255,0.15);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -24px 80px rgba(0,0,0,.6);
    }
    .sn-comments-overlay.sn-open .sn-comments-panel { transform: translateY(0); }
    .sn-comments-head { padding-top: 10px; position: relative; }
    .sn-comments-head::before {
        content: '';
        position: absolute;
        top: 6px; left: 50%;
        transform: translateX(-50%);
        width: 40px; height: 4px;
        border-radius: 2px;
        background: rgba(255,255,255,0.2);
    }
}
