/* ============================================================
   forum.css — стили форума по шаблону LFS101
   ============================================================ */

/* --- Иконки в навигации и заголовках --- */
.nav-item {
    display: flex; align-items: center; gap: 10px;
}
.nav-item .nav-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; color: var(--text-mute);
    transition: color .2s;
}
.nav-item:hover .nav-ico,
.nav-item.active .nav-ico { color: var(--accent); }

.chapter-head h1 {
    display: flex; align-items: center; gap: 12px;
}
.chapter-head h1 .card-ico {
    width: 40px; height: 40px; flex: 0 0 40px;
}
.chapter-head h1 .card-ico svg { width: 22px; height: 22px; }

/* --- Карточки (как в шаблоне) --- */
.card {
    display: block; border: 1px solid var(--border);
    border-radius: var(--r); background: var(--panel-soft);
    padding: 20px 22px; color: var(--text);
    transition: border-color .2s, background-color .2s;
    text-decoration: none;
}
.card:hover {
    border-color: var(--accent-30); background: var(--accent-10);
    text-decoration: none;
}
.card-inner {
    display: flex; align-items: flex-start; gap: 16px;
}
.card-ico {
    width: 44px; height: 44px; flex: 0 0 44px;
    display: grid; place-items: center;
    border-radius: var(--r-sm); background: var(--accent-10);
    border: 1px solid var(--accent-30); color: var(--accent);
    transition: background-color .2s;
}
.card-ico svg { width: 22px; height: 22px; }
.card:hover .card-ico { background: var(--accent-20); }
.card-body { flex: 1 1 auto; min-width: 0; display: block; }
.card h3 { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.card:hover h3 { color: var(--accent); }
.card p { margin: 0; font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.card-chevron {
    width: 20px; height: 20px; flex: 0 0 20px;
    color: var(--text-mute); margin-top: 12px;
    transition: color .2s;
}
.card:hover .card-chevron { color: var(--accent); }
.card-foot {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-mute);
}

/* --- Разделы форума --- */
.forum-sections {
    display: grid; gap: 16px;
}
.forum-section { display: block; text-decoration: none; }
.forum-section:hover { text-decoration: none; }
.forum-section .card-inner .card-body h3 { margin-top: 2px; }
.forum-section .card-foot {
    border-top: none; padding-top: 0; margin-top: 8px;
}
.forum-section .card-last {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim);
    display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.forum-section-link {
    color: var(--accent);
    font-weight: 500;
}
.forum-section:hover .forum-section-link {
    color: var(--accent-hover); text-decoration: underline;
}

/* --- Темы --- */
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    border-radius: var(--r-sm);
    background: var(--panel-soft);
    border: 1px solid var(--border);
    color: var(--text); text-decoration: none;
    transition: border-color .2s, background-color .2s;
}
.topic-row:hover {
    border-color: var(--accent-30); background: var(--accent-10);
    text-decoration: none;
}
.topic-main { flex: 1 1 auto; min-width: 0; }
.topic-title {
    font-weight: 600; font-size: 15px; color: var(--text);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.topic-flag {
    font-size: 11px; padding: 2px 8px; border-radius: 999px;
    background: var(--accent-10); border: 1px solid var(--accent-30);
    color: var(--accent); font-weight: 500;
}
.topic-lock {
    background: rgba(120,53,15,.2); border-color: #92400e; color: #fcd34d;
}
html[data-theme='light'] .topic-lock {
    background: #fffbeb; border-color: #fde68a; color: #b45309;
}
.topic-meta { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.topic-stats { font-size: 12px; color: var(--text-dim); text-align: right; min-width: 80px; line-height: 1.5; }
.topic-last  { font-size: 12px; color: var(--text-dim); text-align: right; min-width: 140px; line-height: 1.5; }

/* --- Аватары --- */
.avatar {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 50%; background: var(--panel-deep);
    display: grid; place-items: center;
    font-size: 16px; font-weight: 700; text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--border-strong);
}
.avatar-lg { width: 56px; height: 56px; flex: 0 0 56px; font-size: 22px; }
.avatar[data-group="admins"]     { color: #ff6467; border-color: rgba(255,100,103,.35); }
.avatar[data-group="moderators"] { color: #fcd34d; border-color: rgba(252,211,77,.35); }
.avatar[data-group="vip"]        { color: #c084fc; border-color: rgba(192,132,252,.35); }
.avatar[data-group="users"]      { color: #3394E6; border-color: rgba(51,148,230,.35); }
html[data-theme='light'] .avatar[data-group="admins"]     { color: #c10007; }
html[data-theme='light'] .avatar[data-group="moderators"] { color: #b45309; }
html[data-theme='light'] .avatar[data-group="vip"]        { color: #7e22ce; }
html[data-theme='light'] .avatar[data-group="users"]      { color: #2A7BC7; }

/* --- Сообщения --- */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post {
    display: grid; grid-template-columns: 140px 1fr; gap: 20px;
    background: var(--panel-soft); border: 1px solid var(--border);
    border-radius: var(--r); padding: 20px;
    transition: border-color .2s;
}
.post:hover { border-color: var(--border-strong); }
.post-author {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding-right: 20px; border-right: 1px solid var(--border);
    text-align: center; align-self: start;
}
.post-body { min-width: 0; }
.post-head {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 12px; margin-bottom: 10px;
    padding-bottom: 8px; border-bottom: 1px dashed var(--border);
}
.post-num { text-decoration: none; }
.post-text { font-size: 15px; line-height: 1.65; color: var(--text); word-wrap: break-word; }

/* --- Пагинатор --- */
.pager-nav {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-top: 24px; padding-top: 16px;
    border-top: 1px solid var(--border);
}
.pager-info { font-size: 13px; color: var(--text-mute); }

/* --- Callout-блоки (врезки) --- */
.callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--r-sm); border: 1px solid;
    font-size: 14px; line-height: 1.6;
}
.callout > svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; }
.callout b { display: block; margin-bottom: 4px; font-weight: 600; }

.callout.tip     { background: var(--tip-bg, rgba(30,58,138,.20)); border-color: var(--tip-border, #1e40af); color: var(--tip-text, #bfdbfe); }
.callout.tip svg { color: var(--tip-title, #93c5fd); }
.callout.info    { background: var(--accent-10); border-color: var(--accent-30); color: var(--text-dim); }
.callout.info svg{ color: var(--accent); }
.callout.warning { background: rgba(120,53,15,.20); border-color: #92400e; color: #fde68a; }
.callout.warning svg { color: #fcd34d; }
.callout.danger  { background: rgba(255,100,103,.10); border-color: #ff6467; color: #ff6467; }
.callout.danger svg { color: #ff6467; }
html[data-theme='light'] .callout.tip     { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
html[data-theme='light'] .callout.tip svg { color: #1d4ed8; }
html[data-theme='light'] .callout.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
html[data-theme='light'] .callout.warning svg { color: #b45309; }
html[data-theme='light'] .callout.danger  { background: rgba(193,0,7,.07); border-color: rgba(193,0,7,.3); color: #c10007; }

/* --- Блоки кода (заготовка для этапа 5) --- */
.code {
    margin: 16px 0; border: 1px solid var(--border);
    border-radius: var(--r-sm); background: var(--code-bg, #030712);
    overflow: hidden;
}
.code-head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--code-head, #101828);
    border-bottom: 1px solid var(--border);
}
.code-head .label {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12px; color: var(--text-mute);
}
.code-head .copy-btn {
    margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--panel-deep);
    color: var(--text-dim);
    font: inherit; font-size: 12px; cursor: pointer;
}
.code-head .copy-btn:hover { color: var(--text); border-color: var(--accent-30); }
.code-head .copy-btn svg { width: 14px; height: 14px; }
.code pre {
    margin: 0; padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 13.5px; line-height: 1.6;
    color: var(--code-text, #d1d5dc);
    tab-size: 2;
}
html[data-theme='light'] .code { background: #f3f4f6; }
html[data-theme='light'] .code-head { background: #e5e7eb; }
html[data-theme='light'] .code pre { color: #1e2939; }

/* --- Markdown-контент в постах (заготовка для этапа 5) --- */
.md p { margin: 0 0 12px; color: var(--text); line-height: 1.7; }
.md > *:last-child { margin-bottom: 0; }
.md h2, .md h3, .md h4 {
    margin: 20px 0 10px; line-height: 1.3; color: var(--text);
}
.md h2 { font-size: 20px; }
.md h3 { font-size: 17px; }
.md h4 { font-size: 15px; }
.md strong { color: var(--text); font-weight: 600; }
.md em { color: var(--text-dim); }
.md a { color: var(--accent); }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; color: var(--text-dim); }
.md li { margin-bottom: 4px; }
.md code {
    padding: 2px 6px; border-radius: 5px;
    background: var(--panel-deep); border: 1px solid var(--border);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: .9em; color: var(--cmd, #05df72);
}
.md pre code {
    background: transparent; border: none; padding: 0;
    color: inherit; font-size: 1em;
}
.md blockquote {
    margin: 0 0 12px; padding: 6px 14px;
    border-left: 3px solid var(--accent);
    color: var(--text-dim); font-style: italic;
}
.md hr {
    border: none; border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* --- Адаптивность --- */
@media (max-width: 640px) {
    .post { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
    .post-author {
        flex-direction: row; border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0; padding-bottom: 10px;
        text-align: left;
    }
    .avatar-lg { width: 40px; height: 40px; flex: 0 0 40px; font-size: 17px; }
    .topic-stats { display: none; }
    .topic-last { min-width: 90px; }
    .chapter-head h1 { font-size: 22px; }
    .chapter-head h1 .card-ico { width: 32px; height: 32px; flex: 0 0 32px; }
    .chapter-head h1 .card-ico svg { width: 18px; height: 18px; }
}

/* Основная часть карточки форума — ссылка на раздел (класс не должен ломать
   flex у .card-inner, поэтому display здесь не задаём). */
.card-link { color: inherit; text-decoration: none; }
.card-link:hover { text-decoration: none; }

/* Строка «Последнее» теперь ссылка на конкретное сообщение темы. */
.forum-section a.card-last { text-decoration: none; }
.forum-section a.card-last:hover { text-decoration: none; color: var(--text); }
.forum-section a.card-last:hover .forum-section-link {
    color: var(--accent-hover); text-decoration: underline;
}

/* Плеер Suno: ширина в разметке фиксированная (760), поэтому на узких
   экранах ограничиваем её шириной контейнера. */
iframe[src*="suno.com"] {
    display: block; max-width: 100%; border: 0;
    border-radius: var(--r-sm); background: var(--panel-deep);
}

/* Вставки embed-кода внутри тегов [musescore] и [vkvideo]:
   ширина в разметке сервиса фиксированная, ограничиваем по контейнеру. */
.embed-block { margin: 16px 0; }
.embed-block iframe {
    display: block; max-width: 100%; border: 0;
    border-radius: var(--r-sm); background: var(--panel-deep);
}
.embed-block > span { display: block; margin-top: 8px; font-size: 13px; color: var(--text-dim); }

/* Плеер потоков ([hls=Название]адрес.m3u8[/hls]) */
.hls-player { margin: 16px 0; }
.hls-stage {
    position: relative; display: block; line-height: 0;
    border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden;
}
.hls-player video {
    display: block; width: 100%; max-width: 100%; height: auto; background: #000;
}
/* Заголовок плеера: лежит поверх видео и скрывается, пока идёт воспроизведение. */
.hls-title {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 10px 14px; font-size: 14px; line-height: 1.35; color: #fff;
    background: linear-gradient(180deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    transition: opacity .3s ease; pointer-events: none;
}
.hls-title-hidden { opacity: 0; }
.hls-pip {
    margin-top: 10px; padding: 6px 12px; border-radius: var(--r-sm);
    border: 1px solid var(--border-strong); background: var(--panel-deep);
    color: var(--text-dim); font: inherit; font-size: 13px; cursor: pointer;
}
.hls-pip:hover { color: var(--text); border-color: var(--accent-30); background: var(--accent-10); }
.hls-error {
    margin-top: 10px; padding: 12px 14px; font-size: 13px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--panel-deep); color: var(--text-dim);
}
