/*
 * YAZME 2026 | МОДУЛЬ ИНТЕРАКЦИЙ (PREMIUM FLAT DESIGN)
 * Файл: assets/css/interactions.css
 * Описание: Стили для модальных окон, древовидных комментариев и микроанимаций.
 * АДАПТАЦИЯ: Поддерживает смену тем (Dark, Light, OLED) через GlobalThemeEngine
 * Версия 12.3: УЛЬТИМАТИВНЫЙ Z-INDEX (Изоляция поверх всех слоев и фреймов)
 */

:root {
    /* Тянем цвета из глобальной темы профиля/паблика. Если их нет, берем темный дефолт */
    --interaction-bg: var(--p-surface-solid, var(--modal-bg, #151515));
    --interaction-border: var(--p-border, rgba(128, 128, 128, 0.15));
    --interaction-accent: var(--p-accent, #ff2b54);
    --interaction-text: var(--p-text, var(--text-primary, #ffffff));
    --interaction-text-muted: var(--p-text-muted, rgba(128, 128, 128, 0.5));
    
    /* Плоские, чистые фоны для инпутов и наведений */
    --interaction-input-bg: color-mix(in srgb, var(--interaction-text) 6%, transparent);
    --interaction-hover-bg: color-mix(in srgb, var(--interaction-text) 4%, transparent);
}

/* =========================================
   МОДАЛЬНОЕ ОКНО (ГЛОБАЛЬНОЕ)
   ========================================= */
.interaction-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Максимально возможный Z-index, чтобы всегда быть поверх видео и фреймов */
    z-index: 2147483647; 
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.interaction-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.interaction-modal {
    background: var(--interaction-bg);
    width: 100%;
    max-width: 600px;
    height: 80vh;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1), background 0.3s ease;
    display: flex;
    flex-direction: column;
    /* Страховочный Z-index для самого контента */
    z-index: 2147483647;
}

.interaction-modal-overlay.active .interaction-modal {
    transform: translateY(0);
}

.interaction-modal-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--interaction-border);
}

.interaction-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--interaction-text);
}

.interaction-modal-close {
    background: transparent;
    border: none;
    color: var(--interaction-text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
}

.interaction-modal-close:hover {
    background: var(--interaction-hover-bg);
    color: var(--interaction-text);
}

/* =========================================
   ДРЕВОВИДНЫЕ КОММЕНТАРИИ (FLAT DESIGN)
   ========================================= */
.comments-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.comments-list-container::-webkit-scrollbar {
    display: none;
}

.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 10px;
    position: relative;
}

.comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--interaction-hover-bg);
}

.comment-body {
    flex: 1;
    /* УБРАНЫ РАМКИ И ФОНЫ - ПОЛНЫЙ МИНИМАЛИЗМ */
    background: transparent;
    border: none;
    padding: 0;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.comment-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--interaction-text);
    text-decoration: none;
}

.comment-time {
    font-size: 12px;
    color: var(--interaction-text-muted);
    font-weight: 400;
}

.comment-text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--interaction-text);
    word-break: break-word;
    font-weight: 400;
}

/* Действия (Компактные) */
.comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.comment-action-btn {
    background: transparent;
    border: none;
    color: var(--interaction-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: 0.2s;
}

.comment-action-btn:hover {
    color: var(--interaction-text);
}

.comment-action-btn.liked {
    color: var(--interaction-accent);
}

/* Вложенные ответы (Древовидность без рамок) */
.comment-replies {
    margin-top: 12px;
    padding-left: 44px; /* Выравниваем по левому краю текста родителя (34px аватар + 10px gap) */
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-item.reply .comment-avatar {
    width: 24px;
    height: 24px;
}

/* =========================================
   ПОЛЕ ВВОДА КОММЕНТАРИЯ (CAPSULE STYLE)
   ========================================= */
.comment-input-area {
    padding: 10px 20px 15px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.replying-to-badge {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    padding: 0 10px;
    font-size: 12px;
    color: var(--interaction-text-muted);
}
.replying-to-badge.active {
    display: flex;
}

.reply-cancel {
    cursor: pointer;
    color: var(--interaction-text);
    font-size: 14px;
    padding: 4px;
}

.comment-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--interaction-input-bg);
    border: 1px solid var(--interaction-border);
    border-radius: 22px;
    padding: 4px 4px 4px 16px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.comment-input-wrapper:focus-within {
    border-color: var(--interaction-text-muted);
}

.comment-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--interaction-text);
    font-size: 14px;
    outline: none;
    padding: 10px 0;
    font-family: 'Inter', sans-serif;
    min-height: 20px;
}

.comment-input-wrapper input::placeholder {
    color: var(--interaction-text-muted);
    font-weight: 400;
}

.btn-send-comment {
    background: var(--interaction-accent, #4b628a);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s transform;
    flex-shrink: 0;
    margin-bottom: 1px;
}

.btn-send-comment:active {
    transform: scale(0.9);
}

.btn-send-comment i {
    font-size: 13px;
    margin-left: -2px;
}

/* =========================================
   ПУСТОЕ СОСТОЯНИЕ (МИНИМАЛИЗМ)
   ========================================= */
.comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--interaction-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.comments-empty i {
    font-size: 32px;
    opacity: 0.3;
    margin-bottom: 4px;
}

.comments-empty p {
    font-size: 14px;
    margin: 0;
}