:root {
  --bg: #0a0b14;
  --bg-soft: #12141f;
  --card: #171a27;
  --card-2: #1d2130;
  --line: #262b3d;
  --text: #e8eaf2;
  --muted: #8a90a6;
  --brand: #6c5ce7;
  --brand-2: #a66bff;
  --accent: #00d6a4;
  --danger: #ff5c7c;
  --radius: 16px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 12% -5%, rgba(108, 92, 231, 0.22), transparent 60%),
    radial-gradient(700px 500px at 95% 0%, rgba(0, 214, 164, 0.12), transparent 55%);
}

/* ---------- Topbar ---------- */
.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(16px, 5vw, 56px);
  max-width: 1400px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 13px;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 8px 24px -6px rgba(108, 92, 231, 0.7);
}
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.gh {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  transition: 0.2s;
}
.gh:hover { color: var(--text); border-color: var(--brand); }

/* ---------- Container ---------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px clamp(16px, 5vw, 56px) 40px;
}

/* ---------- Login overlay ---------- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 9, 16, 0.82);
  backdrop-filter: blur(10px);
}
.login-overlay[hidden] { display: none; }  /* để thuộc tính hidden ẩn được overlay */
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-box .logo {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 15px;
  font-size: 22px; color: #fff;
}
.login-box h2 { font-size: 21px; font-weight: 800; }
.login-box p { color: var(--muted); font-size: 14px; margin: 6px 0 22px; }
.login-box input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: 0.2s;
}
.login-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
}
.login-box .btn-primary {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
  padding: 14px;
}
.login-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 13.5px;
}

/* ---------- Search ---------- */
.search {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  transition: 0.2s;
}
.input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
}
.input-wrap .ic { width: 20px; height: 20px; fill: var(--muted); flex-shrink: 0; }
.input-wrap input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 16px 0;
  font-family: inherit;
}
.input-wrap input::placeholder { color: var(--muted); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 0 28px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 10px 28px -10px rgba(108, 92, 231, 0.8);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Samples ---------- */
.samples {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.samples-label { font-size: 13px; color: var(--muted); }
.chip {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
}
.chip:hover { border-color: var(--brand); background: var(--card-2); }

/* ---------- Stage ---------- */
.stage {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  margin-top: 26px;
}
@media (max-width: 940px) {
  .stage { grid-template-columns: 1fr; }
}

.player {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}
.player video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  outline: none;
}
.placeholder {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.ph-icon { font-size: 54px; margin-bottom: 14px; opacity: 0.85; }
.placeholder h2 { color: var(--text); font-size: 20px; font-weight: 700; }
.placeholder p { margin-top: 8px; font-size: 14px; max-width: 360px; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.status-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.t-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
  flex: 1;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
}
.share-btn:hover { border-color: var(--brand); color: #fff; }
.share-btn svg { width: 14px; height: 14px; fill: currentColor; }

.archive-search { margin-top: 14px; }

/* ---------- Recent / Results ---------- */
.recent { margin-top: 34px; }
.recent-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.recent-head h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.recent-sub { font-size: 13px; color: var(--muted); }
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.rcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: 0.18s;
  display: flex;
  flex-direction: column;
}
.rcard:hover { border-color: var(--brand); transform: translateY(-2px); }
.rcard-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1d2130, #11131d);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.rcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcard-thumb .ph { font-size: 34px; opacity: 0.5; }
.rcard-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 16, 0.45);
  opacity: 0;
  transition: 0.18s;
  font-size: 34px;
  color: #fff;
}
.rcard:hover .rcard-play { opacity: 1; }
.rcard-resume {
  position: absolute;
  left: 0; bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}
.rcard-body { padding: 11px 13px 13px; }
.rcard-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.rcard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.rcard-time { font-size: 11.5px; color: var(--muted); }
.rcard-actions { display: flex; gap: 4px; }
.rcard-actions button {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
  font-size: 13px;
}
.rcard-actions button:hover { color: var(--text); border-color: var(--brand); }
.rcard-actions .del:hover { color: var(--danger); border-color: var(--danger); }

.progress {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
#progressPct { color: var(--accent); font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-2);
  border-radius: 12px;
  padding: 11px 12px;
}
.stat-ic { font-size: 16px; }
.stat b { display: block; font-size: 14px; font-weight: 700; }
.stat small { color: var(--muted); font-size: 11.5px; }

.files-card h4, .hint-card h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
}
.file-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-2);
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid transparent;
}
.file-list li:hover { border-color: var(--brand); }
.file-list li.active { border-color: var(--accent); }
.file-list li .fname {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-list li .fsize { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.file-list li .badge { font-size: 11px; color: var(--accent); flex-shrink: 0; }

.hint-card p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.hint-card b { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 90vw;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 16px 40px;
}
.footer b { color: var(--text); }
