/* ============================================
   Vidloye Admin — shared theme
   ============================================ */

:root {
  --bg: #0b0b0d;
  --bg-alt: #111114;
  --surface: #17171b;
  --surface-2: #1e1e23;
  --border: #2a2a30;
  --text: #e8e8ea;
  --text-muted: #8b8b93;
  --accent: #6366f1;
  --accent-hover: #4f52d6;
  --accent-soft: rgba(99, 102, 241, .12);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: .925rem;
}

a { color: inherit; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand .logo-dot {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand h5 { margin: 0; font-weight: 700; font-size: 1rem; }
.sidebar-brand small { color: var(--text-muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }

.sidebar-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }

.sidebar-nav .nav-link {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-nav .nav-link:hover { background: var(--surface-2); color: var(--text); }

.sidebar-nav .nav-link.active {
  background: var(--accent-soft);
  color: #c7c9ff;
}

.sidebar-nav .nav-link.active i { color: var(--accent); }

.sidebar-foot {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-foot .nav-link { color: #f0a3a3; }
.sidebar-foot .nav-link:hover { background: rgba(239, 68, 68, .12); color: var(--danger); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1030;
}

/* ---------- Main content ---------- */
.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1010;
  background: rgba(11,11,13,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar .menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
}

.topbar h1 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.topbar .topbar-sub { color: var(--text-muted); font-size: .8rem; }

.page-body { padding: 22px; max-width: 1200px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title-row h5 { margin: 0; font-size: .98rem; font-weight: 700; }
.card-title-row .hint { color: var(--text-muted); font-size: .78rem; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card .icon-box {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-card .icon-box.blue { background: rgba(99,102,241,.15); color: #818cf8; }
.stat-card .icon-box.green { background: rgba(34,197,94,.15); color: #4ade80; }
.stat-card .icon-box.amber { background: rgba(245,158,11,.15); color: #fbbf24; }

.stat-card .stat-label { color: var(--text-muted); font-size: .78rem; margin-bottom: 2px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }

/* ---------- Forms ---------- */
.form-label { color: var(--text); font-size: .84rem; font-weight: 600; margin-bottom: 6px; }

.form-control, .form-select, textarea.form-control {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  font-size: .9rem;
}

.form-control:focus, .form-select:focus {
  background: var(--bg-alt);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control::placeholder { color: #5c5c66; }
.form-text { color: var(--text-muted); font-size: .78rem; }

.input-group-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.form-check-input {
  background-color: var(--bg-alt);
  border-color: var(--border);
  width: 2.4em; height: 1.3em;
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Buttons ---------- */
.btn { border-radius: 9px; font-size: .875rem; font-weight: 600; padding: 9px 16px; }

.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; }

.btn-success { background: var(--success); border-color: var(--success); color: #05230f; }
.btn-success:hover { filter: brightness(1.08); }

.btn-outline-danger { border-color: rgba(239,68,68,.4); color: #f28b8b; }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }

.btn-outline-secondary { border-color: var(--border); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }

.table { color: var(--text); margin-bottom: 0; }
.table > :not(caption) > * > * { background: transparent; border-color: var(--border); vertical-align: middle; padding: 12px 10px; }
.table thead th {
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: #c7c9ff;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: .78rem;
  text-decoration: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  border: 1px solid rgba(99,102,241,.25);
}
.link-chip:hover { background: rgba(99,102,241,.22); color: #fff; }

.copy-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .82rem;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

.badge-soft { background: var(--surface-2); color: var(--text-muted); font-weight: 600; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: .72rem; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state i { font-size: 2.2rem; opacity: .35; display: block; margin-bottom: 10px; }
.empty-state p { margin: 0; font-size: .88rem; }

/* ---------- Alerts / Toasts ---------- */
.alert {
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: toast-in .25s ease;
}
.toast-item.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast-item.hide { animation: toast-out .2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Search ---------- */
.search-box { position: relative; max-width: 320px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; }
.search-box input { padding-left: 34px; }

/* ---------- Modal (custom confirm) ---------- */
.confirm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.confirm-overlay.show { display: flex; }
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.confirm-box .icon-box {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(239,68,68,.12);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 1.3rem;
}
.confirm-box h5 { font-size: 1rem; margin-bottom: 6px; }
.confirm-box p { color: var(--text-muted); font-size: .85rem; margin-bottom: 18px; }
.confirm-box .btn-row { display: flex; gap: 10px; }
.confirm-box .btn-row .btn { flex: 1; }

/* ---------- Tabs (videos page: single/bulk) ---------- */
.seg-tabs {
  display: inline-flex;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 16px;
}
.seg-tabs button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: .84rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 7px;
}
.seg-tabs button.active { background: var(--accent); color: #fff; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Misc ---------- */
.spinner-border-sm { width: .9rem; height: .9rem; border-width: .15em; }

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: 20px 0 40px rgba(0,0,0,.4);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .topbar .menu-toggle { display: inline-flex; }
  .page-body { padding: 16px; }
}
