/* VideoSite styles – mobile-first, no frameworks. Edit the colours in :root / [data-theme] below. */

:root {
  --accent: #e5322d;
  --accent-contrast: #ffffff;
  --radius: 12px;
  --maxw: 1280px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --surface-2: #25252c;
  --text: #f1f1f4;
  --muted: #a3a3ad;
  --border: #33333c;
  --link: #6db3ff;
  --ok: #3ecf8e; --warn: #f5b942; --bad: #ff6b6b;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #ececf1;
  --text: #16161a;
  --muted: #5d5d68;
  --border: #d9d9e0;
  --link: #0b5fd6;
  --ok: #12805a; --warn: #9a6200; --bad: #c62828;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.5; font-size: 16px;
}
img, video { max-width: 100%; display: block; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
.spacer { flex: 1; }
.inline { display: inline; margin: 0; }
.center { text-align: center; }
.meta { color: var(--muted); font-size: .875rem; margin: .25rem 0; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* ---- Header ---- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 8px; }
.search { display: flex; flex: 1 1 100%; order: 3; min-width: 0; }
.search input {
  flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-right: 0;
  background: var(--bg); color: var(--text); border-radius: 999px 0 0 999px; font: inherit;
}
.search button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 0 16px;
  border-radius: 0 999px 999px 0; cursor: pointer;
}
.brand { margin-right: auto; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.cat-nav { border-top: 1px solid var(--border); background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: thin; }
.chip {
  white-space: nowrap; padding: 6px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text);
  text-decoration: none; font-size: .9rem; border: 1px solid transparent;
}
.chip:hover { border-color: var(--border); }
.chip.active { background: var(--text); color: var(--bg); }

/* ---- Hero & titles ---- */
.hero { padding: 8px 0 18px; }
.hero h1 { font-size: 1.6rem; margin-bottom: .25em; }
.hero p { margin: 0; color: var(--muted); max-width: 70ch; }
.section-title { font-size: 1.15rem; margin: 6px 0 14px; }
.page-title { font-size: 1.5rem; }

/* ---- Video grid & cards ---- */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px 16px; }
.card { min-width: 0; }
.card-link { display: block; color: inherit; text-decoration: none; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-link:hover .thumb img { filter: brightness(1.08); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); color: #fff; font-size: .75rem; padding: 2px 6px; border-radius: 6px; }
.card-body { padding: 10px 2px 0; }
.card-title {
  font-size: 1rem; margin: 0 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Pagination ---- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 28px 0 0; }
.page, .page.current, .gap { min-width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; text-decoration: none; }
.page { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.page.current { background: var(--accent); color: var(--accent-contrast); border: 1px solid var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-contrast); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 40px;
}
.btn:hover { filter: brightness(1.1); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-sm { padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---- Empty / error states ---- */
.empty-state { text-align: center; padding: 56px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state h1, .empty-state h2 { margin-bottom: .3em; }
.error-code { font-size: 3.5rem; font-weight: 800; margin: 0; color: var(--muted); }

/* ---- Watch page ---- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.player-wrap video { width: 100%; height: 100%; background: #000; }
.player-error { padding: 24px; text-align: center; color: #fff; background: #222; }
.player-wrap .player-error { position: relative; }
.watch-title { font-size: 1.3rem; margin: 14px 0 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.description { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-wrap: anywhere; }
.related { display: grid; gap: 16px; }
.link-card {
  display: flex; gap: 12px; margin-top: 14px; padding: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: inherit; text-decoration: none; overflow: hidden;
}
.link-card[hidden] { display: none; }
.link-card img { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; flex: none; }
.link-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.link-text small { color: var(--muted); }

/* ---- Footer & toast ---- */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: .9rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Alerts, forms, tables, panels (admin + login) ---- */
.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 14px; border: 1px solid; }
.alert-ok { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.alert-warn { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.alert-error { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.alert[hidden] { display: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; min-width: 0; }
.panel h2 { font-size: 1.1rem; }
.form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.form input[type=text], .form input[type=url], .form input[type=password], .form input[type=search],
.form input[type=file], .form textarea, .form select, input[type=text][readonly], .filters input, .filters select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 10px; font: inherit;
}
.form textarea { resize: vertical; }
.form .btn { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input[type=text], .row input[type=url] { flex: 1; min-width: 180px; }
.form .row .btn, .row .btn { margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters input, .filters select { width: auto; flex: 1 1 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.vcell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.mini-thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin: 2px 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; }
.pill-ok { color: var(--ok); } .pill-warn { color: var(--warn); } .pill-bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.stat-n { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.plain-list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; }
.edit-thumb { border-radius: 10px; width: 100%; max-width: 320px; aspect-ratio: 16/9; object-fit: cover; background: var(--surface-2); }
.progress { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.progress-box[hidden] { display: none; }
.confirm { max-width: 560px; }
.login-box { max-width: 380px; margin: 10vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.login-box h1 { font-size: 1.4rem; text-align: center; }
.brand-center { display: grid; place-items: center; margin-bottom: 10px; }

/* ---- Larger screens ---- */
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 760px) {
  .search { flex: 1 1 320px; order: 0; max-width: 560px; margin: 0 auto; }
  .brand { margin-right: 0; }
  .two-col { grid-template-columns: 1fr 1fr; }
  .two-col.wide-left { grid-template-columns: 2fr 1fr; }
  .hero h1 { font-size: 2rem; }
}
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } .stats { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1000px) {
  .watch { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .watch-title { font-size: 1.5rem; }
}
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(4, 1fr); } }
