/* =========================================================
   StreamKu - Modern Dark Theme, Responsive
   ========================================================= */

:root {
  --bg: #0e0f13;
  --bg-elevated: #16181f;
  --bg-card: #1b1e27;
  --border: #262a35;
  --text: #f2f3f5;
  --text-muted: #9aa0ab;
  --primary: #6c5ce7;
  --primary-hover: #7d6ff2;
  --accent: #00d9c0;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --max-width: 1400px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  scroll-behavior: smooth;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(14,15,19,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.logo {
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search-form {
  flex: 1; max-width: 480px; display: flex;
}
.search-form input {
  flex: 1; padding: 10px 14px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  outline: none; font-size: 14px;
}
.search-form button {
  padding: 0 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border: 1px solid var(--border); border-left: none;
  background: var(--bg-elevated); color: var(--text-muted); cursor: pointer;
}
.nav-links { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* ---------- Layout: sidebar + content (dashboard/admin) ---------- */
.app-layout { display: flex; min-height: calc(100vh - 65px); }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-elevated);
  border-right: 1px solid var(--border); padding: 20px 12px;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 14px; margin-bottom: 4px;
}
.sidebar a:hover, .sidebar a.active { background: var(--bg-card); color: var(--text); }
.content { flex: 1; padding: 24px; min-width: 0; }

/* ---------- Video grid ---------- */
.section-title { font-size: 20px; font-weight: 700; margin: 24px 0 16px; }
.video-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.video-card {
  background: var(--bg-card); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease;
}
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.thumb-wrap { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; text-transform: uppercase; letter-spacing: .5px;
}
.badge-duration { bottom: 8px; right: 8px; background: rgba(0,0,0,.75); color: #fff; }
.badge-private { top: 8px; left: 8px; background: var(--warning); color: #1a1a1a; }
.badge-processing { top: 8px; left: 8px; background: var(--text-muted); color: #1a1a1a; }
.video-info { padding: 12px 14px; }
.video-title {
  font-weight: 700; font-size: 15px; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-meta { font-size: 13px; color: var(--text-muted); }

/* ---------- Forms / cards ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.auth-wrap {
  max-width: 440px; margin: 60px auto; padding: 0 20px;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.form-control {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  font-size: 14px; outline: none;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.radio-group { display: flex; gap: 16px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }

/* ---------- Alerts / flash ---------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,.12); color: var(--success); border-color: rgba(34,197,94,.3); }
.alert-error { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.3); }

/* ---------- Tables (admin) ---------- */
.table-wrap { overflow-x: auto; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 12px; }
tr:last-child td { border-bottom: none; }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- Video player page ---------- */
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.player-wrap video { width: 100%; height: 100%; }
.video-page-title { font-size: 22px; font-weight: 800; margin: 18px 0 6px; }
.video-page-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 14px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.video-page-desc { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; white-space: pre-wrap; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill-public { background: rgba(34,197,94,.15); color: var(--success); }
.pill-private { background: rgba(245,158,11,.15); color: var(--warning); }
.pill-ready { background: rgba(34,197,94,.15); color: var(--success); }
.pill-queued { background: rgba(154,160,171,.15); color: var(--text-muted); }
.pill-processing { background: rgba(108,92,231,.15); color: var(--primary); }
.pill-failed { background: rgba(239,68,68,.15); color: var(--danger); }
.pill-admin { background: rgba(0,217,192,.15); color: var(--accent); }
.pill-user { background: rgba(154,160,171,.15); color: var(--text-muted); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: -260px; top: 65px; bottom: 0; z-index: 90;
    transition: left .2s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { left: 0; }
  .nav-toggle { display: block; }
}
@media (max-width: 640px) {
  .search-form { order: 3; max-width: 100%; width: 100%; }
  .navbar-inner { flex-wrap: wrap; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .auth-wrap { margin: 30px auto; }
  .content { padding: 16px; }
}
