/* ============================================================
   VidHost Admin — Mobile-First CSS
   Font: system-ui (tidak pakai Google Fonts)
   ============================================================ */
:root {
  --bg:       #0a0a0f;
  --surface:  #111118;
  --surface2: #18181f;
  --surface3: #1e1e28;
  --accent:   #6c63ff;
  --green:    #4ade80;
  --red:      #f87171;
  --yellow:   #facc15;
  --text:     #e8e8f0;
  --muted:    #6b6b80;
  --border:   #222230;
  --sidebar:  220px;
  --topbar:   56px;
}

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

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── MOBILE TOP NAVBAR ── */
.mob-nav {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}
.mob-nav .site-name {
  font-weight: 700; font-size: 1rem; flex: 1;
}
.mob-nav .hamburger {
  width: 38px; height: 38px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); border-radius: 8px;
}
.mob-nav .hamburger svg { width: 22px; height: 22px; fill: var(--text); }

/* ── OVERLAY ── */
#nav-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 98;
  backdrop-filter: blur(2px);
}
#nav-overlay.show { display: block; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: fixed; left: 0; top: 0;
  display: flex; flex-direction: column;
  z-index: 99;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-name {
  font-weight: 800; font-size: 1.2rem; color: var(--text);
  display: block; letter-spacing: -.3px;
}
.sidebar-logo small {
  font-size: .7rem; color: var(--muted); margin-top: 1px; display: block;
}
.sidebar-nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-section {
  font-size: .65rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted);
  padding: 10px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: .87rem; color: var(--muted);
  transition: all .15s; margin-bottom: 1px;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,.15); color: var(--accent); }
.nav-item i { font-style: normal; font-size: .95rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; padding: 1px 6px;
  border-radius: 20px; font-size: .66rem; font-weight: 700;
  background: var(--accent); color: #fff;
}
.badge-red { background: var(--red); }
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}
.admin-info {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; background: var(--surface2); border-radius: 8px;
}
.avatar {
  width: 32px; height: 32px;
  background: rgba(108,99,255,.2);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: .9rem; flex-shrink: 0;
}
.admin-name { font-size: .82rem; font-weight: 600; }
.admin-role { font-size: .68rem; color: var(--muted); }

/* ── MAIN AREA ── */
.admin-main {
  margin-left: var(--sidebar);
  flex: 1; min-height: 100vh;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,.95);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-weight: 700; font-size: 1.05rem; }
.topbar-actions { display: flex; gap: 8px; }
.admin-content { padding: 20px 22px; }

/* ── BUTTONS ── */
.btn-sm {
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: .82rem; cursor: pointer;
  transition: all .15s; display: inline-flex; align-items: center; gap: 5px;
}
.btn-sm:hover { border-color: rgba(255,255,255,.3); }
.btn-sm.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm.primary:hover { background: #5a52e0; }
.btn-sm.danger  { border-color: var(--red); color: var(--red); }
.btn-sm.danger:hover { background: var(--red); color: #fff; }

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 15px;
}
.stat-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 10px;
}
.stat-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.si-purple { background: rgba(108,99,255,.15); }
.si-green  { background: rgba(74,222,128,.15); }
.si-pink   { background: rgba(255,101,132,.15); }
.si-yellow { background: rgba(250,204,21,.15); }
.stat-change { font-size: .7rem; color: var(--green); }
.stat-num   { font-weight: 800; font-size: 1.7rem; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: 3px; }

/* ── CARD ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; margin-bottom: 18px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.card-title { font-weight: 700; font-size: .95rem; }
.card-body  { padding: 16px; }

/* ── VIDEO LIST (mobile-first, like screenshot 2) ── */
.vid-list { }

.vid-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  position: relative;
}
.vid-list-item:last-child { border-bottom: none; }
.vid-list-item:hover { background: var(--surface2); }

/* Thumbnail */
.vli-thumb {
  width: 80px; height: 52px;
  border-radius: 7px; overflow: hidden;
  background: var(--surface3);
  flex-shrink: 0; position: relative;
}
.vli-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.vli-thumb .vli-icon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.vli-thumb .vli-src-dot {
  position: absolute; bottom: 3px; right: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem;
}

/* Info */
.vli-info { flex: 1; min-width: 0; }
.vli-title {
  font-size: .88rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px; color: var(--text);
}
.vli-meta {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; font-size: .72rem; color: var(--muted);
}
.vli-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 20px;
  font-size: .68rem; font-weight: 600;
}
.lb-videy  { background: rgba(99,179,237,.12); color: #63b3ed; }
.lb-local  { background: rgba(255,101,132,.12); color: #ff9eb0; }
.lb-remote { background: rgba(108,99,255,.12);  color: #a89fff; }
.lb-yt     { background: rgba(255,80,80,.12);   color: #ff8080; }
.lb-active { background: rgba(74,222,128,.12);  color: var(--green); }
.lb-del    { background: rgba(107,107,128,.12); color: var(--muted); }

/* Actions (right side) */
.vli-actions {
  display: flex; flex-direction: column; gap: 5px;
  align-items: flex-end; flex-shrink: 0;
}
.vli-views {
  font-size: .78rem; font-weight: 600; color: var(--text);
  text-align: right;
}
.vli-time {
  font-size: .68rem; color: var(--muted); text-align: right;
}
.vli-btn-row {
  display: flex; gap: 4px;
}
.vli-btn {
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--border); background: none;
  color: var(--muted); font-size: .72rem;
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.vli-btn:hover        { color: var(--text); border-color: rgba(255,255,255,.3); }
.vli-btn.copy:hover   { color: #a89fff; border-color: rgba(108,99,255,.4); }
.vli-btn.watch:hover  { color: var(--green); border-color: rgba(74,222,128,.4); }
.vli-btn.del:hover    { color: var(--red); border-color: rgba(248,113,113,.4); }

/* Copy link bar under item */
.vli-link-bar {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border-radius: 6px;
  padding: 4px 8px; margin: 0 16px 10px;
  font-size: .68rem; color: var(--muted);
}
.vli-link-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vli-link-bar button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0; flex-shrink: 0; font-size: .7rem;
  transition: color .15s;
}
.vli-link-bar button:hover { color: #a89fff; }

/* ── TABLE (desktop fallback) ── */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 16px;
  font-size: .72rem; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted);
  border-bottom: 1px solid var(--border); font-weight: 500;
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--surface2); }
tbody td {
  padding: 11px 16px; font-size: .84rem;
  border-bottom: 1px solid rgba(34,34,48,.5); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: .71rem; font-weight: 600;
}
.badge-active     { background: rgba(74,222,128,.12);  color: var(--green); }
.badge-processing { background: rgba(250,204,21,.12);  color: var(--yellow); }
.badge-error      { background: rgba(248,113,113,.12); color: var(--red); }
.badge-deleted    { background: rgba(107,107,128,.12); color: var(--muted); }
.badge-remote     { background: rgba(108,99,255,.12);  color: #a89fff; }
.badge-local      { background: rgba(255,101,132,.12); color: #ff9eb0; }
.badge-public     { background: rgba(74,222,128,.08);  color: var(--green); }
.badge-unlisted   { background: rgba(250,204,21,.08);  color: var(--yellow); }
.badge-private    { background: rgba(107,107,128,.08); color: var(--muted); }

/* ── SEARCH ── */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px;
}
.search-box input {
  background: none; border: none; color: var(--text);
  font-size: .84rem; outline: none; width: 160px; min-width: 0;
}
.search-box input::placeholder { color: var(--muted); }

/* ── FORM ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 5px; }
.form-control {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 13px; color: var(--text);
  font-size: .88rem; outline: none; transition: border-color .2s;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--muted); }
select.form-control option { background: var(--surface2); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── DROP ZONE ── */
.admin-drop {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 32px 20px; text-align: center;
  cursor: pointer; transition: all .25s; position: relative;
}
.admin-drop:hover, .admin-drop.over {
  border-color: var(--accent); background: rgba(108,99,255,.05);
}
.admin-drop input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.admin-drop .dicon { font-size: 1.8rem; margin-bottom: 7px; }
.admin-drop p    { font-size: .83rem; color: var(--muted); }
.admin-drop span { font-size: .76rem; color: var(--accent); }

/* ── CHART ── */
.chart-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; margin-bottom: 18px;
}
.chart-bars {
  display: flex; align-items: flex-end; gap: 5px;
  height: 90px; margin-top: 12px;
}
.bar-col  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bar-fill { width: 100%; border-radius: 3px 3px 0 0; background: rgba(108,99,255,.5); min-height: 3px; }
.bar-lbl  { font-size: .62rem; color: var(--muted); }

/* ── SETTINGS ── */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.ti-name { font-size: .87rem; font-weight: 500; }
.ti-desc { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.toggle {
  width: 40px; height: 22px; background: var(--surface3);
  border-radius: 11px; position: relative;
  cursor: pointer; border: none; transition: background .25s; flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; top: 3px; left: 3px; transition: left .25s;
}
.toggle.on::after { left: 21px; }

/* ── FILTER TABS ── */
.filter-tab {
  padding: 5px 11px; border-radius: 7px; font-size: .75rem;
  font-weight: 500; text-decoration: none;
  color: var(--muted); border: 1px solid transparent; transition: all .15s;
}
.filter-tab:hover { background: rgba(255,255,255,.05); color: var(--text); }
.filter-tab.on    { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 28px;
  width: 100%; max-width: 380px; text-align: center;
}
.login-logo  { font-weight: 800; font-size: 1.8rem; color: var(--text); margin-bottom: 4px; }
.login-sub   { color: var(--muted); font-size: .84rem; margin-bottom: 26px; }
.login-field {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 12px 14px; color: var(--text);
  font-size: .9rem; outline: none; margin-bottom: 11px;
  transition: border-color .2s;
}
.login-field:focus { border-color: var(--accent); }
.login-btn {
  width: 100%; padding: 12px;
  background: var(--accent); border: none; border-radius: 9px;
  color: #fff; font-size: .95rem; font-weight: 700; cursor: pointer;
  transition: background .2s;
}
.login-btn:hover { background: #5a52e0; }
.login-err { margin-top: 12px; color: var(--red); font-size: .82rem; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 20px; right: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; font-size: .84rem;
  transform: translateY(70px); opacity: 0; transition: all .3s; z-index: 999;
  max-width: calc(100vw - 32px);
}
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(74,222,128,.4); color: var(--green); }
.toast.error   { border-color: rgba(248,113,113,.4); color: var(--red); }

/* ── COPY TOAST ── */
.copy-toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--surface); border: 1px solid rgba(74,222,128,.4);
  border-radius: 10px; padding: 9px 20px;
  color: var(--green); font-size: .83rem; font-weight: 600;
  white-space: nowrap; z-index: 9999;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s; opacity: 0; pointer-events: none;
}
.copy-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── MODAL ── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 500; align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
  width: 100%; max-width: 420px;
  animation: popIn .22s ease;
}
@keyframes popIn {
  from { opacity:0; transform:scale(.94) translateY(10px); }
  to   { opacity:1; transform:scale(1)   translateY(0); }
}
.modal-title { font-weight: 700; font-size: 1rem; margin-bottom: 3px; }
.modal-sub   { color: var(--muted); font-size: .8rem; margin-bottom: 18px; }

/* ── ACT BUTTONS ── */
.act-btn2 {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: none;
  color: var(--muted); font-size: .73rem;
  cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.act-btn2:hover        { color: var(--text); border-color: rgba(255,255,255,.25); }
.act-btn2.copy:hover   { color: #a89fff; border-color: rgba(108,99,255,.4); }
.act-btn2.watch:hover  { color: var(--green); border-color: rgba(74,222,128,.4); }
.act-btn2.del:hover    { color: var(--red); border-color: rgba(248,113,113,.4); }
.act-btn2.edit:hover   { color: var(--yellow); border-color: rgba(250,204,21,.4); }

/* ── PLATFORM NOTE ── */
.platform-note {
  background: rgba(108,99,255,.07); border: 1px solid rgba(108,99,255,.2);
  border-radius: 9px; padding: 11px 13px; font-size: .78rem;
  color: #a89fff; margin-top: 8px; line-height: 1.6;
}

/* ── UPLOAD TABS ── */
.upload-tabs {
  display: flex; gap: 5px; background: var(--surface2);
  padding: 4px; border-radius: 10px; margin-bottom: 20px;
}
.utab {
  flex: 1; padding: 9px 6px; border: none; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: .82rem; font-weight: 500; cursor: pointer; transition: all .2s; text-align: center;
}
.utab:hover { background: rgba(255,255,255,.05); color: var(--text); }
.utab.on    { background: var(--accent); color: #fff; }
.utab.on-videy { background: linear-gradient(135deg,#1d4ed8,#3b82f6); color: #fff; }

/* ── PROGRESS BAR ── */
.upload-prog { display: none; margin-top: 14px; }
.upload-prog.show { display: block; }
.up-labels  { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-bottom: 5px; }
.up-bar-bg  { background: var(--surface2); border-radius: 6px; height: 5px; overflow: hidden; }
.up-bar     { height: 100%; background: var(--accent); border-radius: 6px; width: 0; transition: width .3s; }

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  /* Show mobile nav */
  .mob-nav { display: flex; }

  /* Sidebar becomes drawer */
  .sidebar {
    transform: translateX(-100%);
    top: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main shifts down for mobile topbar */
  .admin-main { margin-left: 0; padding-top: var(--topbar); }

  /* Hide desktop topbar on mobile */
  .topbar { display: none; }

  /* Content padding smaller */
  .admin-content { padding: 14px 12px; }

  /* Stats 2 col */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-num   { font-size: 1.5rem; }

  /* Card header wrap */
  .card-header { flex-direction: column; align-items: flex-start; }

  /* Search full width */
  .search-box input { width: 100%; }
  .search-box { flex: 1; }

  /* Filter tabs scroll */
  .filter-tabs-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    display: flex; gap: 4px; padding-bottom: 2px;
    scrollbar-width: none;
  }
  .filter-tabs-wrap::-webkit-scrollbar { display: none; }
  .filter-tab { white-space: nowrap; flex-shrink: 0; }

  /* Video list items — bigger touch targets */
  .vid-list-item { padding: 11px 12px; }
  .vli-thumb { width: 72px; height: 46px; }

  /* Settings grid 1 col */
  .settings-grid { grid-template-columns: 1fr; }

  /* Modal full screen on mobile */
  .modal-box { padding: 20px; }
}

@media (min-width: 769px) {
  /* Desktop: always show sidebar, hide mobile nav */
  .mob-nav    { display: none !important; }
  .sidebar    { transform: none !important; }
  #nav-overlay { display: none !important; }
  .topbar     { display: flex; }
  .admin-main { padding-top: 0; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}
