/* ═══════════════════════════════════════
   Channels — полный дизайн
═══════════════════════════════════════ */

/* ── Иконка канала в списке ─────────── */
.ch-badge-icon {
  position: absolute; bottom: 0; right: 0;
  width: 20px; height: 20px;
  background: linear-gradient(135deg, #58a6ff, #1f6feb);
  border-radius: 50%;
  border: 2.5px solid var(--bg0);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(88,166,255,.4);
}
.ch-subs-count { font-size: 11px; color: var(--t2); flex-shrink: 0; margin-left: auto; }
.ch-owner-tag {
  font-size: 10px; font-weight: 700; color: var(--acc);
  background: var(--acc-dim); border-radius: 4px;
  padding: 1px 6px; margin-left: 6px; white-space: nowrap;
}

/* ── Аватар-заглушка ────────────────── */
.ch-av-placeholder {
  background: linear-gradient(135deg, #58a6ff, #1f6feb) !important;
  color: #fff !important; font-weight: 800 !important;
  font-size: 20px !important;
}

/* ── Z-index экранов ────────────────── */
#s-channel      { z-index: 5; }
#s-channel-info { z-index: 6; }
#s-channel-subs { z-index: 7; }
#s-channel-invite { z-index: 8; }

/* ── Хедер канала ───────────────────── */
.channel-header-info {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1; cursor: pointer;
}
.channel-header-info .hdr-title { font-size: 15px; font-weight: 800; }
.channel-header-info .hdr-sub   { font-size: 11px; margin-top: 1px; }
.ch-subscribe-wrap { flex-shrink: 0; }

/* ── Лента постов ───────────────────── */
#channel-posts {
  padding: 12px 12px 40px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 680px; margin: 0 auto;
}

/* ══════════════════════════════════════
   КАРТОЧКА ПОСТА — единственное определение
══════════════════════════════════════ */
.channel-post {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: box-shadow .2s;
  cursor: default;
}
.channel-post:hover { box-shadow: 0 4px 20px rgba(0,0,0,.17); }
.pinned-post { border-color: rgba(88,166,255,.3); }

/* ── Закреплённый баннер ── */
.post-pinned-banner {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  font-size: 11.5px; font-weight: 600; color: var(--acc);
  background: var(--acc-dim);
  border-bottom: 1px solid var(--acc-border);
}

/* ── Медиа поста ── */
.post-media {
  width: 100%; background: var(--bg2); overflow: hidden;
}
.post-media img {
  width: 100%; max-height: 460px;
  object-fit: cover; display: block;
}
.channel-post > .post-media:first-child img {
  border-radius: 17px 17px 0 0;
}

/* ── Текст поста ── */
.post-text {
  padding: 14px 16px 8px;
  font-size: 15px; line-height: 1.65;
  color: var(--t1); word-break: break-word;
}
.channel-post > .post-text:first-child { padding-top: 16px; }
.channel-post > .post-media + .post-text { padding-top: 12px; }

/* Свёрнутый длинный пост */
.post-text-collapsed {
  max-height: 130px; overflow: hidden;
  position: relative; padding-bottom: 0;
}
.post-text-fade {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--bg1));
  pointer-events: none;
}
.post-read-more-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 4px 16px 10px;
  background: var(--acc-dim); border: 1px solid var(--acc-border);
  border-radius: 20px; color: var(--acc);
  font-size: 13px; font-weight: 600; padding: 5px 14px;
  cursor: pointer; transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.post-read-more-btn:active { background: var(--acc); color: #fff; transform: scale(.97); }

/* Подпись канала */
.post-signature {
  padding: 4px 16px 10px;
  font-size: 12px; color: var(--t3); font-style: italic;
}

/* ── Footer поста — ЕДИНСТВЕННОЕ определение ── */
.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg1);
}
.post-meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--t2); font-size: 12px; flex: 1; min-width: 0;
}
.post-views {
  display: flex; align-items: center; gap: 3px;
  color: var(--t2); font-size: 12px; flex-shrink: 0;
}
.post-views svg { width: 13px; height: 13px; vertical-align: middle; }
.post-time { color: var(--t3); font-size: 11px; }
.post-actions {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}

/* Кнопки в footer */
.post-comm-btn {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: none; color: var(--t2);
  font-size: 13px; font-weight: 600;
  padding: 5px 10px; border-radius: 20px;
  cursor: pointer; transition: background .15s, color .15s;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
.post-comm-btn:active { background: var(--acc-dim); color: var(--acc); }
.post-fwd-btn, .post-menu-btn {
  background: transparent; border: none; color: var(--t2);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.post-fwd-btn:active, .post-menu-btn:active {
  background: var(--acc-dim); color: var(--acc);
}

/* ── Реакции ── */
.post-reactions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 2px 14px 12px;
}
.msg-reac {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px;
  font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.msg-reac.my {
  background: var(--acc-dim) !important;
  border-color: var(--acc) !important;
  color: var(--acc);
}
.msg-reac:active { transform: scale(.95); }
.post-react-add {
  font-size: 13px; color: var(--t2);
  background: var(--bg3) !important;
  border: 1px dashed var(--border3) !important;
  opacity: .8;
}
.post-react-add:hover { opacity: 1; }

/* ── Автор поста ── */
.post-author-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 8px;
}
.post-author-name { font-size: 14px; font-weight: 700; color: var(--t1); flex: 1; }
.post-author-time { font-size: 11px; color: var(--t3); }

/* ── Файл ── */
.msg-file {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border-radius: 12px;
  padding: 11px 14px; margin: 10px 14px 0;
  border: 1px solid var(--border);
}
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-size: 13px; font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-size { font-size: 11px; color: var(--t2); margin-top: 2px; }
.msg-file-dl {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--acc-dim); color: var(--acc);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-decoration: none; transition: background .15s;
}
.msg-file-dl:active { background: var(--acc); color: #fff; }

/* ══════════════════════════════════════
   СОЗДАНИЕ ПОСТА / ИНФО КАНАЛА
══════════════════════════════════════ */
#sh-channel-create .sheet-body,
#sh-channel-post .sheet-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 16px 8px;
}
#sh-channel-post .input-label { font-size: 13px; font-weight: 700; color: var(--t2); margin-bottom: 4px; }
#sh-channel-post .input {
  width: 100%; min-height: 100px; resize: vertical;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 14px; color: var(--t1);
  font-size: 15px; font-family: var(--font);
  padding: 12px 14px;
}
#sh-channel-post .input:focus { border-color: var(--acc); }

.ch-post-media-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Хедер инфо-экрана */
.ch-info-header {
  display: flex; flex-direction: column;
  align-items: center; padding: 24px 16px 16px;
  gap: 10px;
}
.ch-info-stats {
  display: flex; gap: 32px; padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 16px;
}
.ch-info-stat { text-align: center; }
.ch-info-stat-val { font-size: 22px; font-weight: 800; color: var(--t1); }
.ch-info-stat-label { font-size: 11px; color: var(--t3); margin-top: 2px; }

/* Подписчики */
.sub-kick-btn {
  background: transparent; border: none; color: var(--t3);
  width: 30px; height: 30px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.sub-kick-btn:active { background: rgba(255,80,80,.15); color: #ff5050; }

/* ══════════════════════════════════════
   МОДАЛКА «ПОЛНЫЙ ПОСТ»
══════════════════════════════════════ */
.post-full-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  justify-content: flex-end; pointer-events: none;
}
.post-full-modal.post-full-modal--visible { pointer-events: all; }

.post-full-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0); transition: background .35s; cursor: pointer;
}
.post-full-modal--visible .post-full-backdrop { background: rgba(0,0,0,.55); }

.post-full-sheet {
  position: relative;
  background: var(--bg1); border-radius: 24px 24px 0 0;
  max-height: 88vh; display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -4px 40px rgba(0,0,0,.28);
}
.post-full-modal--visible .post-full-sheet { transform: translateY(0); }

.post-full-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 4px; margin: 10px auto 0; flex-shrink: 0;
}
.post-full-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.post-full-meta { display: flex; flex-direction: column; gap: 2px; }
.post-full-channel { font-size: 14px; font-weight: 700; color: var(--t1); }
.post-full-time { font-size: 11px; color: var(--t3); }
.post-full-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg3); border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--t2); cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.post-full-close:active { background: var(--acc-dim); color: var(--acc); }

.post-full-body {
  overflow-y: auto; padding: 14px 16px 32px; flex: 1;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.post-full-img { border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.post-full-img img { width: 100%; max-height: 380px; object-fit: cover; display: block; }
.post-full-text {
  font-size: 15.5px; line-height: 1.7;
  color: var(--t1); word-break: break-word; white-space: pre-wrap;
}

/* ══════════════════════════════════════
   СПИСОК КАНАЛОВ
══════════════════════════════════════ */
#channels-list {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.channel-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.channel-row:active { background: var(--bg2); }
.channel-row-info { flex: 1; min-width: 0; }
.channel-row-name {
  font-size: 15px; font-weight: 700; color: var(--t1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.channel-row-desc {
  font-size: 12.5px; color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Кнопка подписки в списке */
.ch-list-sub-btn {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 700; border: none;
  cursor: pointer; transition: background .15s, transform .12s;
  -webkit-tap-highlight-color: transparent; font-family: var(--font);
}
.ch-list-sub-btn.subscribed {
  background: var(--bg3); color: var(--t2); border: 1px solid var(--border);
}
.ch-list-sub-btn.subscribe {
  background: var(--acc-dim); color: var(--acc); border: 1px solid var(--acc-border);
}
.ch-list-sub-btn:active { transform: scale(.94); }

/* Кнопка подписки в хедере канала */
#ch-sub-btn {
  padding: 9px 22px; border-radius: 20px;
  font-size: 14px; font-weight: 700; border: none;
  cursor: pointer; transition: all .15s;
  font-family: var(--font); -webkit-tap-highlight-color: transparent;
}
#ch-sub-btn.subscribed {
  background: var(--bg3); color: var(--t2); border: 1.5px solid var(--border);
}
#ch-sub-btn.subscribe {
  background: var(--acc); color: #fff; box-shadow: 0 4px 16px rgba(88,166,255,.4);
}
#ch-sub-btn:active { transform: scale(.95); }

/* Шапка вкладок */
.channels-tab-header {
  display: flex; align-items: center; padding: 8px 16px; gap: 8px;
  flex-shrink: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.channels-tab-header::-webkit-scrollbar { display: none; }

/* Поиск в каталоге */
.ch-explore-search {
  margin: 10px 14px 6px;
  display: flex; align-items: center;
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 9px 14px; gap: 8px;
  transition: border-color .15s;
}
.ch-explore-search:focus-within { border-color: var(--acc); }
.ch-explore-search input {
  flex: 1; background: none; border: none; color: var(--t1);
  font-size: 14px; font-family: var(--font); outline: none;
}
.ch-explore-search svg { color: var(--t3); flex-shrink: 0; }

/* Градиент аватара канала */
.ch-header-gradient {
  background: linear-gradient(135deg, var(--acc), #7c3aed) !important;
  color: #fff !important; font-weight: 800 !important;
}

/* Новый значок */
.ch-new-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--acc-dim); border: 1px solid var(--acc-border);
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; font-weight: 700; color: var(--acc);
}

/* ── Адаптив для ПК ─────────────────── */
@media (min-width: 600px) {
  #channel-posts { padding: 16px 16px 48px; }
  .post-full-sheet {
    max-width: 600px; margin: auto auto 0;
    border-radius: 20px 20px 0 0;
    left: 0; right: 0; position: relative; width: 100%;
  }
  .post-full-modal { align-items: center; }
}
