/* ============================================================
   HYTHENVALE – Shared Stylesheet
   ============================================================ */


:root {
  --bg:          #050509;
  --bg-elevated: #0f0f17;
  --bg-card:     #111119;
  --accent:      #9146ff;
  --accent-dark: #4c1d95;
  --accent-soft: #2d1a4f;
  --text:        #f4f4f5;
  --text-muted:  #a1a1aa;
  --border:      #27272f;
  --sidebar-w:   240px;
  --chat-w:      280px;
  --nav-h:       58px;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


html { scroll-behavior: smooth; }


body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1a0d33 0, #050509 40%, #020108 100%);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}


body.streams-page {
  overflow: hidden;
  height: 100vh;
  flex-direction: column;
}


a { color: inherit; text-decoration: none; }


/* ── NAV ──────────────────────────────────────────────────── */
header {
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: rgba(5,5,9,0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}


.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}


.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}


.logo-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 0, #ffffff 0, #9146ff 35%, #4c1d95 70%, #020617 100%);
  box-shadow: 0 0 14px rgba(145,70,255,0.7);
  flex-shrink: 0;
}
.logo-sm { width: 20px; height: 20px; }


.brand-title { font-size: 15px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.brand-sub   { font-size: 10px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; }


.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.nav-link   { color: var(--text-muted); font-weight: 500; transition: color 0.15s; }
.nav-link:hover, .nav-link.active { color: var(--text); }


.btn-ghost-sm {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 13px;
}
.btn-ghost-sm:hover { background: rgba(255,255,255,0.08); }


.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
}


.mobile-menu {
  display: flex;
  flex-direction: column;
  background: rgba(5,5,9,0.98);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  gap: 14px;
  font-size: 15px;
}
.mobile-menu a { color: var(--text-muted); }
.mobile-menu a:hover { color: var(--text); }
.mobile-menu.hidden { display: none; }


/* ── UTILS ────────────────────────────────────────────────── */
.shell     { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section-gap { padding-block: 32px; }


.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}
.dot-green  { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.8); }
.dot-purple { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(145,70,255,0.8); }


.accent { color: var(--accent); }


.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: linear-gradient(135deg, #9146ff, #c084fc);
  color: #fff; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5);
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-sm { font-size: 13px; padding: 8px 14px; }


.btn-ghost {
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.7);
  color: var(--text-muted); font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(15,23,42,0.95); }


.divider { border: none; border-top: 1px solid var(--border); margin-block: 12px; }


.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,0.12); color: #bbf7d0; border: 1px solid rgba(34,197,94,0.35); }
.badge-purple { background: rgba(145,70,255,0.14); color: #e9d5ff; border: 1px solid rgba(145,70,255,0.35); }
.badge-yellow { background: rgba(234,179,8,0.12);  color: #fef08a; border: 1px solid rgba(234,179,8,0.35); }


/* ── HERO (index) ─────────────────────────────────────────── */
.hero { padding-block: 56px 40px; }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(0,1fr);
  gap: 40px;
  align-items: center;
}


.hero-title   { font-size: clamp(28px,4vw,42px); font-weight: 800; line-height: 1.1; margin-bottom: 14px; }
.hero-text    { font-size: 15px; line-height: 1.65; color: var(--text-muted); max-width: 520px; margin-bottom: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }


.hero-card {
  border-radius: 18px;
  border: 1px solid rgba(55,65,81,0.8);
  background: radial-gradient(circle at top, rgba(76,29,149,0.55) 0, #070710 60%);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.status-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-item  { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.status-label { font-size: 13px; font-weight: 500; }
.card-text    { font-size: 13px; color: var(--text-muted); line-height: 1.5; }


/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }
.feature-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-icon  { font-size: 24px; }
.feature-title { font-size: 15px; font-weight: 600; }
.feature-text  { font-size: 13px; color: var(--text-muted); line-height: 1.55; flex: 1; }
.feature-link  { font-size: 13px; color: var(--accent); margin-top: 4px; }
.feature-link:hover { text-decoration: underline; }


/* Section titles */
.section-eyebrow { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.section-title    { font-size: clamp(20px,2.5vw,28px); font-weight: 700; margin-bottom: 16px; }
.two-col          { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.body-text        { font-size: 14px; line-height: 1.7; color: var(--text-muted); }


/* ── PAGE HERO (mods / streams) ───────────────────────────── */
.page-hero     { padding-block: 40px 24px; }
.page-title    { font-size: clamp(24px,3.5vw,36px); font-weight: 800; margin-bottom: 10px; }
.page-subtitle { font-size: 14px; color: var(--text-muted); max-width: 600px; margin-bottom: 18px; line-height: 1.6; }


/* Filter row */
.filter-row   { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.filter-btn {
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.filter-btn:hover { background: rgba(255,255,255,0.09); color: var(--text); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }


/* ── MODS ─────────────────────────────────────────────────── */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }


.mod-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  transition: border-color 0.15s;
}
.mod-card:hover { border-color: rgba(145,70,255,0.45); }


.mod-card-inner { display: flex; gap: 14px; padding: 16px; }
.mod-icon-wrap  { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.mod-body       { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }


.mod-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.mod-name   { font-size: 14px; font-weight: 600; }
.mod-tag    { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.mod-tag-rpg      { background: rgba(145,70,255,0.15); color: #e9d5ff; border: 1px solid rgba(145,70,255,0.35); }
.mod-tag-gameplay { background: rgba(59,130,246,0.15); color: #bfdbfe; border: 1px solid rgba(59,130,246,0.35); }
.mod-tag-world    { background: rgba(34,197,94,0.12);  color: #bbf7d0; border: 1px solid rgba(34,197,94,0.35); }
.mod-tag-balance  { background: rgba(234,179,8,0.12);  color: #fef08a; border: 1px solid rgba(234,179,8,0.35); }
.mod-tag-visual   { background: rgba(236,72,153,0.12); color: #fbcfe8; border: 1px solid rgba(236,72,153,0.35); }
.mod-tag-utility  { background: rgba(107,114,128,0.2); color: #d1d5db; border: 1px solid rgba(107,114,128,0.4); }


.mod-desc    { font-size: 13px; color: var(--text-muted); line-height: 1.55; flex: 1; }
.mod-footer  { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.mod-version { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.mod-link    { font-size: 13px; color: var(--accent); }
.mod-link:hover { text-decoration: underline; }


.mod-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }
.mod-empty.hidden { display: none; }


/* Info Box */
.info-box {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(145,70,255,0.07);
  padding: 16px 18px;
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
}
.info-icon { font-size: 20px; flex-shrink: 0; }


/* ── STREAMS PAGE ─────────────────────────────────────────── */
.streams-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  /* Explizite Höhe damit Kinder-Grids korrekt berechnet werden */
  height: calc(100vh - var(--nav-h));
}


/* SIDEBAR */
#sidebar {
  width: var(--sidebar-w);
  background: #0d0d14;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}


.sidebar-top  { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-head {
  padding: 12px 14px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.refresh-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; padding: 2px 7px; cursor: pointer; font-size: 14px;
}
.refresh-btn:hover { color: var(--text); }


#stream-list { flex: 1; padding: 6px 0; overflow-y: auto; }
.sidebar-loading { padding: 14px; font-size: 13px; color: var(--text-muted); }


.stream-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 6px; margin: 2px 6px;
  cursor: pointer; transition: background 0.15s;
}
.stream-item:hover  { background: rgba(255,255,255,0.06); }
.stream-item.active { background: rgba(145,71,255,0.18); }
.stream-item input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }


.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #464649; flex-shrink: 0; }
.status-dot.live { background: #eb0400; box-shadow: 0 0 6px #eb0400; }
.stream-name    { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-viewers { font-size: 11px; color: var(--text-muted); }


#add-channel-area {
  display: flex; gap: 6px;
  border-top: 1px solid var(--border);
  padding: 10px;
}
#add-channel-area input {
  flex: 1;
  background: #1a1a24; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 6px 10px; font-size: 12px; outline: none;
}
#add-channel-area input:focus { border-color: var(--accent); }
#add-channel-area button {
  background: var(--accent); border: none; border-radius: 6px;
  color: #fff; padding: 6px 12px; font-size: 14px; font-weight: 700; cursor: pointer;
}


.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.layout-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }


#layout-buttons { display: flex; gap: 5px; }
.layout-btn {
  flex: 1; padding: 7px 4px;
  background: #1a1a24;
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.layout-btn:hover { background: #2a2a34; }
.layout-btn.active { background: var(--accent); border-color: var(--accent); }


.chat-toggle-btn {
  width: 100%; padding: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
}
.chat-toggle-btn:hover { background: rgba(255,255,255,0.09); color: var(--text); }


/* MAIN PLAYER */
#streams-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  /* Explizite Höhe – verhindert dass player-area auf 0 kollabiert */
  height: calc(100vh - var(--nav-h));
  min-width: 0;
  overflow: hidden;
}
#streams-main.with-chat {
  grid-template-columns: 1fr var(--chat-w);
}


#player-area {
  display: grid;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  /* Höhe explizit – Twitch prüft offsetHeight des Containers */
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}


#player-area.layout-1              { grid-template-columns: 1fr;     grid-template-rows: 1fr; }
#player-area.layout-2-vertical     { grid-template-columns: 1fr;     grid-template-rows: 1fr 1fr; }
#player-area.layout-2-horizontal   { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
#player-area.layout-3              { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
#player-area.layout-3 .embed-wrapper:nth-child(3) { grid-column: 1 / 3; display: flex; justify-content: center; }
#player-area.layout-3 .embed-wrapper:nth-child(3) > div { width: 50%; height: 100%; }
#player-area.layout-4              { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }


/* ── EMBED WRAPPER ────────────────────────────────────────────
   min-width/min-height entfernt – Twitch braucht sichtbare Größe,
   aber min-* können das Grid sprengen und visibility=hidden auslösen.
   Die tatsächliche Größe kommt vom Grid (1fr × 1fr).
   ──────────────────────────────────────────────────────────── */
.embed-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  /* Sicherstellen dass der Container nie auf 0 kollabiert */
  min-width: 0;
  min-height: 0;
}
.embed-wrapper > div,
.embed-wrapper iframe {
  width: 100% !important;
  height: 100% !important;
}


.mute-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px; padding: 4px 8px;
  font-size: 13px; cursor: pointer; z-index: 10;
  user-select: none;
}
.mute-badge:hover { background: rgba(145,71,255,0.5); }

.embed-label {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: #fff;
  pointer-events: none;
  z-index: 10;
}


/* CHAT */
#chat-area {
  background: #18181b;
  border-left: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#chat-area.hidden { display: none; }


.chat-wrapper { flex: 1; min-height: 0; }
.chat-wrapper iframe { width: 100%; height: 100%; border: none; }


/* ── FOOTER ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: rgba(5,5,9,0.98);
  font-size: 12px; color: var(--text-muted);
}
.footer-inner {
  padding-block: 14px;
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; align-items: center;
}
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); }


/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card  { order: -1; }
  .two-col    { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: block; }
  .shell     { padding-inline: 14px; }
  .feature-grid { grid-template-columns: 1fr; }
}
