/* stats-overlay.info — Tool/Dashboard Styles.
   Mobile-first. WCAG 2.2 AA: Focus visible, Tap-Targets >= 24px,
   Zoom erlaubt, kein color-only-meaning, sufficient contrast.
   Widgets sind separat (1080p stream-fix). */

:root {
  --brand-purple: #5e2a79;
  --brand-purple-bright: #8a4dad;
  --brand-gold: #f2b705;
  --bg: #0e0a14;
  --bg-elev: #1c1129;
  --bg-elev-2: #221534;
  --bg-deeper: #14091e;
  --border: #2a1f3a;
  --border-strong: #44345e;
  --text: #f0eaf5;
  --text-muted: #c4bad6;
  --text-dim: #8b7da3;
  --success: #6ce682;
  --danger: #ff7a7a;
  --warning: #ffd33d;
  --focus: #5cc8ff;
  --nav-height: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  line-height: 1.5;
  font-size: clamp(15px, 1rem + 0.2vw, 17px);
}

.skip-link {
  position: absolute; left: 8px; top: -40px;
  background: var(--brand-gold); color: #000;
  padding: 8px 14px; border-radius: 4px;
  font-weight: 700; z-index: 100;
  transition: top 0.15s;
}
.skip-link:focus { top: 8px; outline: 2px solid var(--focus); outline-offset: 2px; }

*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

a {
  color: var(--brand-gold);
  text-decoration: underline;
  text-decoration-color: rgba(242, 183, 5, 0.35);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: var(--brand-gold); }

img { max-width: 100%; height: auto; }

/* ====== Top-Nav ====================================================== */
.topnav {
  background: var(--bg-deeper);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  padding-top: env(safe-area-inset-top);
}
.topnav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  min-height: var(--nav-height);
  position: relative;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--brand-gold);
  font-weight: 700; font-size: 1.05em;
  text-decoration: none;
  padding: 8px 4px;
  min-height: 44px;
}
.brand-text { white-space: nowrap; }
.brand-dot {
  width: 16px; height: 16px;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-purple));
  border-radius: 4px;
  flex-shrink: 0;
}
.nav-toggle {
  margin-left: auto;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: 8px;
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; padding: 0;
}
.nav-toggle:hover { background: var(--bg-elev); }
.nav-toggle-bar {
  display: block; width: 22px; height: 2px;
  background: currentColor; border-radius: 1px;
}
.primary-nav {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-deeper);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.primary-nav.is-open { display: block; }
.primary-nav ul {
  list-style: none; margin: 0; padding: 8px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.primary-nav a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 6px;
  min-height: 44px;
}
.primary-nav a:hover { background: var(--bg-elev); color: var(--text); }
.primary-nav a[aria-current="page"] {
  background: var(--brand-purple);
  color: #fff; font-weight: 700;
}
.primary-nav .admin-li a { color: var(--brand-gold); }
.primary-nav .logout-li a { color: var(--text-dim); }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .primary-nav {
    display: block; position: static;
    background: transparent; box-shadow: none; border: 0;
    margin-left: auto;
  }
  .primary-nav ul {
    flex-direction: row; padding: 0; gap: 2px;
    align-items: center;
  }
  .primary-nav a { padding: 8px 12px; min-height: 36px; }
  .primary-nav .admin-li { margin-left: 12px; padding-left: 12px;
                            border-left: 1px solid var(--border); }
}

/* ====== Layout / Main ================================================ */
.layout { display: block; }
.main {
  max-width: 1400px; margin: 0 auto;
  padding: 20px 16px 64px;
}
.topbar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px; margin-bottom: 20px;
}
.greeting { font-size: 1.4em; color: var(--brand-gold); font-weight: 700; }

/* Admin-Impersonation-Banner */
.impersonation-banner {
  background: rgba(94, 42, 121, 0.6);
  border-bottom: 2px solid var(--brand-gold);
  color: #fff;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  justify-content: center;
}
.impersonation-banner b { color: var(--brand-gold); }
.impersonation-banner a {
  color: var(--brand-gold);
  text-decoration: underline;
  margin-left: 10px;
}

/* Material Symbols (Google) — Default-Tuning */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: -4px;
  user-select: none;
}
.material-symbols-outlined.icon-sm { font-size: 18px; vertical-align: -3px; }
.material-symbols-outlined.icon-md { font-size: 22px; vertical-align: -5px; }
.material-symbols-outlined.icon-lg { font-size: 32px; vertical-align: -7px; }
.material-symbols-outlined.icon-success { color: var(--success); }
.material-symbols-outlined.icon-warning { color: var(--warning); }
.material-symbols-outlined.icon-danger { color: var(--danger); }
.material-symbols-outlined.icon-gold { color: var(--brand-gold); }

.user-chip {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 100px;
}
.user-chip img,
.user-chip__avatar-fallback {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-chip__avatar-fallback {
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-gold));
}
.user-chip .greeting { font-size: 1.1em; line-height: 1; }

/* ====== Cards ======================================================== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}
.card h2, .card h3 {
  margin: 0 0 12px; color: var(--brand-gold); font-size: 1.1em;
}
.card p { margin: 0 0 12px; color: var(--text-muted); }
.card p:last-child { margin-bottom: 0; }
.card code {
  background: var(--bg-deeper); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 3px;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.92em;
}

/* ====== Forms ======================================================== */
/* Auch Inputs ohne type-Attribut (Default = text) treffen */
input:not([type]),
input[type="text"], input[type="number"], input[type="search"],
input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="url"], input[type="tel"],
textarea, select {
  background: var(--bg-deeper);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: var(--focus);
}
label { color: var(--text-muted); font-size: 0.9em; display: block; margin-bottom: 6px; }

/* Form-Layout: Felder mit Abstand, Action-Reihe abgesetzt */
.form-row { margin-bottom: 16px; max-width: 520px; }
.form-row:last-of-type { margin-bottom: 20px; }
.form-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.card h3 { margin-top: 24px; }
.card h3:first-child { margin-top: 0; }

.url-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-bottom: 16px;
  padding: 6px;
  background: var(--bg-deeper);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.url-tab {
  background: transparent; border: 0;
  color: var(--text-muted);
  padding: 8px 12px; border-radius: 6px;
  font: inherit; font-weight: 600;
  cursor: pointer; min-height: 36px;
  display: inline-flex; align-items: center; gap: 6px;
}
.url-tab:hover { background: var(--bg-elev); color: var(--text); }
.url-tab.active {
  background: var(--brand-purple); color: #fff;
}
.url-tab-count {
  background: rgba(255,255,255,0.12);
  padding: 1px 7px; border-radius: 10px;
  font-size: 0.75em; font-weight: 700;
}
.url-tab.active .url-tab-count { background: rgba(255,255,255,0.25); }

.badge-admin {
  display: inline-block;
  background: var(--brand-gold); color: #1a0d2a;
  padding: 2px 8px; border-radius: 3px;
  font-size: 0.75em; letter-spacing: 0.05em;
  text-transform: uppercase; font-weight: 700;
  margin-right: 6px;
}

button, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-purple);
  color: #fff;
  border: 1px solid var(--brand-purple-bright);
  border-radius: 6px;
  padding: 10px 16px;
  font: inherit; font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-purple-bright); }
button[disabled], .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-gold { background: var(--brand-gold); color: #1a0d2a; border-color: #c69704; }
.btn-gold:hover { background: #ffd02e; }
.btn-danger { background: #5c2020; border-color: #8a3030; color: #ffd5d5; }

.btn-twitch {
  display: inline-flex; align-items: center; gap: 12px;
  background: #9146ff; color: #fff;
  padding: 14px 28px; border-radius: 8px;
  border: 0;
  font-size: 1.05em; font-weight: 700;
  text-decoration: none;
  min-height: 48px;
}
.btn-twitch:hover { background: #a25eff; }

/* ====== Tables ======================================================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
th, td { padding: 10px 12px; text-align: left;
         border-bottom: 1px solid var(--border); }
th { color: var(--brand-gold); font-weight: 700; font-size: 0.85em;
     text-transform: uppercase; letter-spacing: 0.05em; }

/* ====== Landing ====================================================== */
.landing { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.landing-hero { text-align: center; padding: 32px 0 24px; }
.landing-logo {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--brand-purple), var(--brand-gold));
  border-radius: 18px;
  margin: 0 auto 20px;
}
.landing-hero h1 {
  font-size: clamp(1.8em, 2em + 1vw, 2.6em);
  margin: 0 0 12px;
  color: var(--brand-gold);
  line-height: 1.15;
}
.landing-hero .tagline {
  color: var(--text); font-size: 1.05em;
  max-width: 720px; margin: 0 auto 24px;
}
.landing-hero .hint {
  color: var(--text-dim); font-size: 0.88em;
  max-width: 620px; margin: 14px auto 0;
}
.landing-section { margin-top: 48px; }
.landing-section h2 {
  color: var(--brand-gold);
  font-size: clamp(1.2em, 1.1em + 0.4vw, 1.5em);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.feature {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.feature h3 {
  color: var(--brand-gold);
  margin: 0 0 10px;
  font-size: 1em;
}
.feature ul, .feature p { margin: 0; line-height: 1.5; font-size: 0.93em; }
.feature ul { padding-left: 18px; color: var(--text); }
.feature li { margin-bottom: 4px; }
.feature p { color: var(--text-muted); }
.how-list { line-height: 1.7; padding-left: 22px; color: var(--text); }

/* ====== Pending / Status ============================================ */
.pending-box {
  max-width: 560px; margin: 80px auto;
  padding: 32px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px;
  text-align: center;
}

/* ====== Motion Reduction ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important;
                            transition-duration: 0.01ms !important; }
}

/* ─── /app/urls — Master-Detail Layout ─────────────────────────────── */

.url-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

/* MASTER ─────────────────────────────────────────────── */
.url-master {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.url-master__filter {
  width: 100%;
  background: var(--bg-deeper);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  min-height: 40px;
  margin-bottom: 10px;
}
.url-master__filter:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}
.url-cat {
  margin-bottom: 6px;
}
.url-cat__title {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 8px 4px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.url-cat__title::-webkit-details-marker { display: none; }
.url-cat__count {
  background: var(--bg-deeper);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.85em;
  font-weight: 700;
}
.url-cat[open] .url-cat__title { color: var(--brand-gold); }

.url-master__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}
.url-master__item:hover {
  background: var(--bg-elev);
  color: var(--text);
}
.url-master__item:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: -2px;
}
.url-master__item[aria-current="page"] {
  background: var(--bg-elev);
  color: var(--brand-gold);
  border-left-color: var(--brand-gold);
  font-weight: 700;
}
.url-master__empty {
  color: var(--text-dim);
  font-style: italic;
  padding: 20px 12px;
  text-align: center;
}

/* DETAIL ─────────────────────────────────────────────── */
.url-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  min-height: 400px;
}
.url-detail__header {
  margin-bottom: 18px;
}
.url-detail__cat {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.url-detail__cat-sep { opacity: 0.4; margin: 0 6px; }
.url-detail__path {
  color: var(--text-very-dim);
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
.url-detail__title {
  color: var(--brand-gold);
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0 4px;
}
.url-detail__desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

/* URL CARD (primary action) ─────────────────────────── */
.url-card-primary {
  background: var(--bg-deeper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 18px 0 24px;
  position: sticky;
  top: 86px;
  z-index: 5;
}
.url-card-primary__url {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  word-break: break-all;
  margin-bottom: 12px;
  user-select: all;
}
.url-card-primary__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-copy-primary {
  background: var(--brand-gold);
  color: #1a0d2a;
  border: 1px solid var(--brand-gold);
  border-radius: 6px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-copy-primary:hover { filter: brightness(1.1); }
.btn-copy-primary:focus-visible {
  outline: 2px solid #1a0d2a;
  outline-offset: 2px;
}
.btn-preview-secondary {
  background: transparent;
  color: var(--brand-purple-bright, #b78cd8);
  border: 1px solid var(--brand-purple-bright, #b78cd8);
  border-radius: 6px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-preview-secondary:hover {
  background: var(--brand-purple);
  color: #fff;
}
.btn-preview-secondary:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}
.url-copy-status {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* CONFIGURE-Sektion ─────────────────────────────────── */
.url-configure__heading {
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin: 8px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.url-switches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 22px;
}
.sw-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.sw-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sw-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.sw-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 100px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  min-height: 32px;
}
.sw-btn:hover { color: var(--text); }
.sw-btn:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}
.sw-btn.active {
  background: var(--brand-purple);
  color: #fff;
  border-color: var(--brand-purple);
}
.sw-input {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  width: 100px;
  min-height: 36px;
  font-variant-numeric: tabular-nums;
}
.sw-input:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}
.info-i {
  display: inline-block;
  margin-left: 4px;
  color: var(--brand-gold);
  cursor: help;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  position: relative;
}
.info-i:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deeper);
  color: var(--text);
  border: 1px solid var(--brand-gold);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  width: 280px;
  text-align: left;
  z-index: 100;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.info-i:hover::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--brand-gold);
  z-index: 100;
}

/* Detail-Empty-State ─────────────────────────────────── */
.url-detail__empty {
  color: var(--text-dim);
  font-style: italic;
  padding: 60px 0;
  text-align: center;
}

/* Back-Button (Mobile) ───────────────────────────────── */
.url-back-btn {
  display: none;
  background: transparent;
  border: 0;
  color: var(--brand-gold);
  font: inherit;
  font-weight: 600;
  padding: 8px 0;
  margin-bottom: 12px;
  cursor: pointer;
  min-height: 44px;
}
.url-back-btn:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 2px;
}

/* Tablet & Mobile (< 1024px): Stack-Pattern ──────────── */
@media (max-width: 1023px) {
  .url-layout {
    grid-template-columns: 1fr;
  }
  .url-master {
    position: static;
    max-height: none;
  }
  .url-master.is-hidden,
  .url-detail.is-hidden {
    display: none;
  }
  .url-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .url-card-primary {
    position: sticky;
    top: 70px;
  }
}

/* Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .url-master__item,
  .sw-btn,
  .btn-copy-primary,
  .btn-preview-secondary {
    transition: none;
  }
}
