/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --bg2:       #151820;
  --bg3:       #1c2030;
  --border:    #2a2f42;
  --accent:    #6c63ff;
  --accent2:   #a78bfa;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
  letter-spacing: -.3px;
}
.logo span { color: var(--accent); }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s, background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: #7c73ff; }
.btn-green    { background: var(--green);   color: #fff; }
.btn-green:hover { opacity: .85; }
.btn-danger   { background: var(--red);     color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-ghost    { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-full     { width: 100%; justify-content: center; }
.btn-sm       { padding: 5px 12px; font-size: 13px; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* ─── Layout ────────────────────────────────────────────── */
.page-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}
.login-wrap {
  max-width: 400px;
  margin: 80px auto;
  padding: 0 20px;
}

/* ─── Forms ─────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

input[type="text"],
input[type="password"],
input[type="url"] {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus { border-color: var(--accent); }

/* ─── File Drop ─────────────────────────────────────────── */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--accent);
  background: rgba(108,99,255,.06);
}
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.file-name { font-size: 14px; font-weight: 600; color: var(--accent2); margin-top: 6px; }
.file-hint { font-size: 12px; color: var(--text3); display: block; margin-top: 4px; }

/* ─── Progress ──────────────────────────────────────────── */
.progress-wrap {
  background: var(--bg3);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width .2s;
  width: 0%;
}
.progress-label {
  text-align: center;
  font-size: 12px;
  color: var(--text2);
  display: block;
  margin-top: 6px;
}

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

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(42,47,66,.6);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }

.td-title { font-weight: 600; max-width: 180px; }
.td-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-cell { display: flex; gap: 6px; align-items: center; }
.link-input {
  font-size: 12px;
  color: var(--accent2);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  min-width: 200px;
  max-width: 260px;
}

.td-actions { display: flex; gap: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-views { background: rgba(108,99,255,.2); color: var(--accent2); }

.empty-msg { color: var(--text3); text-align: center; padding: 32px 0; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 10px; }
.modal p  { color: var(--text2); font-size: 14px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Settings row ──────────────────────────────────────── */
.settings-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.settings-row .field { flex: 1; }

/* ─── Redirect / Ad page ────────────────────────────────── */
.ad-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1a1040 0%, var(--bg) 60%);
}
.ad-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(108,99,255,.15);
}
.ad-logo { font-size: 22px; font-weight: 700; color: var(--accent2); margin-bottom: 28px; display: block; }
.ad-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3);
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
}
.ad-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.ad-meta { color: var(--text3); font-size: 13px; margin-bottom: 28px; }

.ad-step {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.ad-step p { font-size: 14px; color: var(--text2); margin-bottom: 14px; }

/* Countdown ring */
.countdown-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 16px 0;
}
.countdown-ring {
  position: relative;
  width: 72px;
  height: 72px;
}
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring circle {
  fill: none;
  stroke-width: 5;
}
.ring-bg    { stroke: var(--border); }
.ring-fill  { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.countdown-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent2);
}
.countdown-label { font-size: 12px; color: var(--text3); }

.btn-watch {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 16px;
  padding: 14px 32px;
  border-radius: var(--radius);
  width: 100%;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(108,99,255,.4);
}
.btn-watch:hover { opacity: .9; box-shadow: 0 6px 28px rgba(108,99,255,.55); }

.hidden { display: none !important; }

/* ─── Watch / Player page ───────────────────────────────── */
.watch-page {
  min-height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
}
.watch-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.watch-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
}
.video-container {
  width: 100%;
  max-width: 1000px;
  background: #000;
}
.video-container video {
  width: 100%;
  display: block;
  max-height: 70vh;
  background: #000;
}
.video-info {
  max-width: 1000px;
  width: 100%;
  padding: 20px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.video-info h1 { font-size: 20px; margin-bottom: 6px; }
.video-info .meta { color: var(--text3); font-size: 13px; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 18px; }
  .ad-card { padding: 24px 16px; }
  .table th, .table td { padding: 9px 8px; }
  .td-actions { flex-direction: column; }
  .link-input { min-width: 120px; }
  .settings-row { flex-direction: column; }
}
