/* css/discussion.css */

/* ── Shell ──────────────────────────────────────────────────── */
.disc-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ── Sticky nav ─────────────────────────────────────────────── */
.disc-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: .6rem 1rem;
  flex-shrink: 0;
}

.disc-nav-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.disc-nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.disc-brand {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.2rem;
  letter-spacing: 1px;
  color: var(--orange);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search */
.disc-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.disc-search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 32px 5px 14px;
  font-size: .82rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.disc-search-input:focus { border-color: var(--orange); }
.disc-search-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: .85rem;
  pointer-events: none;
  opacity: .5;
}

/* Autoplay toggle */
.disc-autoplay-toggle {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
}
.disc-autoplay-toggle input { display: none; }
.disc-toggle-pill {
  width: 32px; height: 17px; background: var(--border2);
  border-radius: 9px; position: relative; transition: background .2s; flex-shrink: 0;
}
.disc-toggle-pill::after {
  content:''; position: absolute; top:2px; left:2px;
  width:13px; height:13px; border-radius:50%; background:#fff; transition: transform .2s;
}
.disc-autoplay-toggle input:checked + .disc-toggle-pill { background: var(--orange); }
.disc-autoplay-toggle input:checked + .disc-toggle-pill::after { transform: translateX(15px); }
.disc-toggle-label { font-size: .72rem; color: var(--text2); }

/* ── Layout ─────────────────────────────────────────────────── */
.disc-layout {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem;
  flex: 1;
  min-height: 0;
  align-items: flex-start;
}

.disc-feed-col {
  width: 100%;
  max-width: 680px;
  min-width: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.disc-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 58px;       /* below nav */
}

.disc-sidebar-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  margin-bottom: 1rem;
}

.disc-sidebar-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text3);
  margin-bottom: .65rem;
}

.disc-trending-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.disc-tag-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: .74rem;
  color: var(--text2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color .12s, color .12s;
}
.disc-tag-chip:hover { border-color: var(--orange); color: var(--orange); }
.disc-tag-count {
  background: var(--bg4);
  border-radius: 8px;
  padding: 1px 5px;
  font-size: .65rem;
  color: var(--text3);
}
.disc-tag-loading { opacity: .4; }

/* ── Tag filter pill ─────────────────────────────────────────── */
.disc-tag-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--orange-dim);
  border: 1px solid var(--orange-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .78rem;
  color: var(--text2);
  margin-bottom: .75rem;
}
.disc-tag-pill button {
  background: none; border: none;
  color: var(--text3); cursor: pointer; font-size: 1rem;
  line-height: 1; padding: 0 2px;
}
.disc-tag-pill button:hover { color: var(--orange); }

/* ── Feed ───────────────────────────────────────────────────── */
.disc-feed { display: flex; flex-direction: column; gap: .75rem; }
.disc-empty { text-align: center; color: var(--text3); padding: 3rem 0; font-size: .9rem; }

/* ── Post card ──────────────────────────────────────────────── */
.disc-post {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
}
.disc-post-inner { display: flex; flex-direction: column; }

/* ── Media ───────────────────────────────────────────────────── */
.disc-media-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  overflow: hidden;
}
.disc-media-wrap.portrait { aspect-ratio: 9/16; max-height: 80vh; }
.disc-video {
  width: 100%; height: 100%;
  object-fit: contain; display: block; cursor: pointer;
}
.disc-image {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.disc-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: rgba(255,255,255,.85);
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
  pointer-events: none;
  transition: opacity .15s;
}
.disc-video-meta {
  position: absolute; bottom: 10px; left: 10px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.5); border-radius: 16px;
  padding: 3px 10px 3px 4px; font-size: .75rem; color: #fff;
  pointer-events: none;
}
.disc-vid-title {
  color: rgba(255,255,255,.7); font-size: .68rem;
  max-width: 110px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* ── Twitch chat overlay ─────────────────────────────────────── */
.disc-chat-overlay {
  position: absolute; bottom: 44px; left: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 5px;
  pointer-events: none;
}
.disc-chat-msg {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  border-radius: 4px; padding: 3px 8px;
  font-size: .76rem; color: #fff;
  width: fit-content; max-width: 80%;
  opacity: 0; transform: translateY(5px);
  transition: opacity .3s, transform .3s;
}
.disc-chat-msg.show { opacity: 1; transform: translateY(0); }
.disc-chat-name { font-weight: 700; color: var(--orange2); white-space: nowrap; }

/* ── Post body ──────────────────────────────────────────────── */
.disc-post-body { padding: .8rem; }

.disc-post-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: .55rem;
}
.disc-author  { font-size: .85rem; font-weight: 600; color: var(--text); }
.disc-ago     { font-size: .7rem; color: var(--text3); }
.disc-del-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text3); cursor: pointer; font-size: .85rem;
  padding: 2px 5px; border-radius: 4px;
}
.disc-del-btn:hover { color: var(--red); background: rgba(224,48,48,.08); }

.disc-caption { font-size: .88rem; line-height: 1.5; color: var(--text); margin-bottom: .35rem; }
.disc-tags    { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: .5rem; }
.disc-hashtag {
  font-size: .76rem; color: var(--orange);
  cursor: pointer; background: var(--orange-dim);
  border-radius: 10px; padding: 2px 7px;
  transition: background .12s;
}
.disc-hashtag:hover { background: rgba(240,108,0,.25); }

/* ── Poll ────────────────────────────────────────────────────── */
.disc-poll      { margin: .5rem 0; }
.disc-poll-q    { font-size: .88rem; font-weight: 600; margin-bottom: .5rem; }
.disc-poll-opt  {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--r2);
  padding: 8px 10px; margin-bottom: .35rem;
  cursor: pointer; position: relative; overflow: hidden;
  transition: border-color .15s;
  text-align: left;
}
.disc-poll-opt:hover  { border-color: var(--orange); }
.disc-poll-opt.voted  { border-color: var(--orange); background: var(--orange-dim); }
.disc-poll-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(240,108,0,.15); transition: width .4s ease;
}
.disc-poll-text { font-size: .84rem; color: var(--text); position: relative; flex: 1; }
.disc-poll-pct  { font-size: .75rem; color: var(--text3); position: relative; }
.disc-poll-total { font-size: .72rem; color: var(--text3); margin-top: .25rem; }

/* ── Actions bar ────────────────────────────────────────────── */
.disc-actions {
  display: flex; align-items: center; gap: 6px; margin-top: .5rem;
}
.disc-action {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 5px 12px;
  font-size: .8rem; color: var(--text2); cursor: pointer;
  transition: border-color .12s, color .12s;
}
.disc-action:hover  { border-color: var(--border2); color: var(--text); }
.disc-action.liked  { color: #e03030; border-color: rgba(224,48,48,.3); }

/* ── Avatars ─────────────────────────────────────────────────── */
.disc-av {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', cursive; font-size: .82rem;
  flex-shrink: 0;
}
.disc-av-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', cursive; font-size: .65rem;
  flex-shrink: 0;
}
.disc-av-xs {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg4); color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', cursive; font-size: .65rem;
  flex-shrink: 0;
}

/* ── Comments ────────────────────────────────────────────────── */
.disc-comments-wrap { border-top: 1px solid var(--border); margin-top: .55rem; padding-top: .6rem; }
.disc-comment-compose { display: flex; gap: 6px; margin-bottom: .6rem; }
.disc-comment-inp {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 5px 10px;
  font-size: .8rem; color: var(--text); outline: none;
}
.disc-comment-inp:focus { border-color: var(--orange); }

.disc-comment-list { display: flex; flex-direction: column; gap: 7px; }
.disc-comment {
  display: flex; align-items: flex-start; gap: 7px; font-size: .8rem;
}
.disc-comment-body { flex: 1; line-height: 1.5; }
.disc-comment-name { font-weight: 600; color: var(--text); margin-right: 5px; }
.disc-comment-txt  { color: var(--text2); }
.disc-comment-ago  { display: block; font-size: .67rem; color: var(--text3); margin-top: 1px; }
.disc-comment-del  {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: .95rem; padding: 0 3px;
  flex-shrink: 0;
}
.disc-comment-del:hover { color: var(--red); }
.disc-more-comments {
  background: none; border: none; color: var(--text3);
  font-size: .76rem; cursor: pointer; text-decoration: underline;
  padding: 3px 0;
}
.disc-more-comments:hover { color: var(--text2); }

/* ── Compose ─────────────────────────────────────────────────── */
.disc-compose-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: .75rem; overflow: hidden;
}
.disc-compose { padding: 1rem; }
.disc-compose-types { display: flex; gap: 5px; margin-bottom: .75rem; flex-wrap: wrap; }
.disc-type-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 5px 12px;
  font-size: .78rem; color: var(--text2); cursor: pointer;
  transition: border-color .12s, color .12s;
}
.disc-type-btn:hover  { border-color: var(--border2); color: var(--text); }
.disc-type-btn.active { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }

.disc-compose-text { width: 100%; resize: none; margin-bottom: .5rem; }
.disc-poll-opt-inp { display: block; width: 100%; }
.disc-compose-footer {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: .75rem;
  border-top: 1px solid var(--border); padding-top: .65rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .disc-sidebar { display: none; }
  .disc-layout  { padding: .5rem; }
  .disc-brand   { display: none; }
  .disc-search-wrap { max-width: 200px; }
}

/* ── Compose preview ─────────────────────────────────────────── */
.disc-preview-wrap {
  margin-top: .6rem;
  border-radius: var(--r2);
  overflow: hidden;
  background: #000;
  position: relative;
}
.disc-preview-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
  border-radius: var(--r2);
}
.disc-preview-vid-thumb {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
  border-radius: var(--r2);
  background: #000;
}
.disc-preview-label {
  font-size: .72rem;
  color: var(--text3);
  margin-top: .3rem;
}
.disc-preview-remove {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,.65);
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  color: #fff; cursor: pointer;
  font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.disc-preview-remove:hover { background: var(--red); }

/* Video thumbnail capture canvas (hidden) */
#discThumbCanvas { display: none; }

/* Image file input styled button */
.disc-file-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 6px 12px;
  font-size: .8rem; color: var(--text2); cursor: pointer;
  transition: border-color .12s;
}
.disc-file-btn:hover { border-color: var(--orange); color: var(--orange); }
.disc-file-input { display: none; }
