/* ==========================================================================
   Reelio — Marketing-Video SaaS · Design-Konzept
   Gemeinsames Stylesheet für Agentur- und Kunden-Portal
   ========================================================================== */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e6e8f0;
  --text: #17162b;
  --text-muted: #6b7089;
  --text-faint: #9598ad;

  --sidebar-bg: #17152b;
  --sidebar-bg-2: #1f1c38;
  --sidebar-text: #b9b7d4;
  --sidebar-text-active: #ffffff;

  --primary: #6a5cf5;
  --primary-dark: #5645e8;
  --primary-tint: #efecfe;
  --accent: #ff7a59;

  --success: #1fa971;
  --success-tint: #e5f7ee;
  --warning: #d98c1a;
  --warning-tint: #fdf1de;
  --danger: #e04f5f;
  --danger-tint: #fceaec;
  --info: #3679e0;
  --info-tint: #e9f1fd;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(23, 22, 43, 0.06);
  --shadow-md: 0 8px 24px rgba(23, 22, 43, 0.08);
  --shadow-lg: 0 20px 48px rgba(23, 22, 43, 0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  color: #fff;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #9b7bff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex: none;
}
.brand-name { font-size: 17px; font-weight: 700; }
.portal-switch {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.portal-switch a {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 6px;
  border-radius: 8px;
  color: var(--sidebar-text);
}
.portal-switch a.is-active { background: var(--primary); color: #fff; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 12px 6px;
  margin-top: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
}
.nav-item svg { flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.is-active { background: rgba(106, 92, 245, 0.22); color: #fff; }
.nav-item.is-active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg,#ff7a59,#ffb08a);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff; flex: none;
}
.sidebar-footer .who { font-size: 13px; color: #fff; font-weight: 600; }
.sidebar-footer .role { font-size: 11.5px; color: var(--text-faint); }

/* ---------- Main column ---------- */
.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 20px; }
.topbar .sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text-muted);
  min-width: 220px;
}
.content { padding: 28px 32px 56px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  padding: 9px 16px;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  white-space: nowrap;
}
.btn:hover { background: #f0f1f7; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 16px rgba(106,92,245,0.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-tint); background: var(--danger-tint); }
.btn-success-outline { color: var(--success); border-color: var(--success-tint); background: var(--success-tint); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title-row h3 { font-size: 15px; }
.card-title-row .link { font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* KPI stat card */
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650;
  padding: 4px 9px; border-radius: 999px;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-draft { background: #eef0f5; color: #6b7089; }
.badge-production { background: var(--info-tint); color: var(--info); }
.badge-review { background: var(--warning-tint); color: var(--warning); }
.badge-approved { background: var(--success-tint); color: var(--success); }
.badge-changes { background: var(--danger-tint); color: var(--danger); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); font-weight: 650; padding: 0 12px 10px; border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.thumb {
  width: 44px; height: 30px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--primary-tint), #dcd6ff);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 4px; }
.kanban-col-head h4 { font-size: 13px; }
.kanban-count { font-size: 11.5px; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 999px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.kanban-card .kc-thumb {
  width: 100%; height: 68px; border-radius: 8px; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary-tint), #dcd6ff);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.kanban-card h5 { font-size: 13px; margin-bottom: 6px; }
.kanban-card .kc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kanban-card .kc-client { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Template / video gallery cards ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tpl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.tpl-thumb {
  height: 140px; position: relative;
  background: linear-gradient(135deg, #7c6cf7, #ff9a7a);
  display: flex; align-items: center; justify-content: center;
}
.tpl-thumb.alt1 { background: linear-gradient(135deg, #3679e0, #6adfd0); }
.tpl-thumb.alt2 { background: linear-gradient(135deg, #d98c1a, #ff6a88); }
.tpl-thumb.alt3 { background: linear-gradient(135deg, #1fa971, #9be15d); }
.play-btn {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.tpl-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tpl-body h5 { font-size: 13.5px; }
.tpl-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); padding: 3px 8px; border-radius: 999px; }

/* ---------- Prompt / generate box ---------- */
.prompt-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.prompt-input {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
  font-size: 14px; color: var(--text); background: var(--surface-2); min-height: 74px;
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.chip.is-active { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); }

/* ---------- Approval / review screen ---------- */
.review-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; }
.player {
  aspect-ratio: 16/9; border-radius: var(--radius-lg); background: linear-gradient(135deg,#1f1c38,#3a3468);
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.player .play-btn { width: 62px; height: 62px; }
.scrubber { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.scrubber-track { flex: 1; height: 6px; border-radius: 999px; background: var(--border); position: relative; }
.scrubber-fill { position: absolute; inset: 0 60% 0 0; background: var(--primary); border-radius: 999px; }
.scrubber-pin { position: absolute; left: 40%; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: var(--shadow-sm); }
.time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.comment-name { font-size: 13px; font-weight: 650; }
.comment-time { font-size: 11.5px; color: var(--text-faint); }
.comment-ts { font-size: 11px; font-weight: 650; color: var(--primary); background: var(--primary-tint); padding: 1px 7px; border-radius: 999px; }
.comment-text { font-size: 13px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* ---------- Brand kit ---------- */
.swatch-row { display: flex; gap: 10px; }
.swatch { flex: 1; border-radius: var(--radius-sm); padding: 14px 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 22px; }
.swatch span { font-size: 11px; font-weight: 700; }
.font-sample { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); }

/* ---------- Simple bar / line charts (no libs) ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--primary), #b6acfd); border-radius: 6px 6px 2px 2px; position: relative; }
.bars .bar span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.bars .bar-label { text-align: center; font-size: 11px; color: var(--text-faint); margin-top: 8px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }

.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); }

/* ---------- Empty state / banner ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--primary), #8a76ff);
  color: #fff; border-radius: var(--radius-lg); padding: 22px 26px; margin-bottom: 22px;
}
.banner h2 { font-size: 18px; margin-bottom: 6px; }
.banner p { font-size: 13.5px; opacity: 0.9; }

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
