/* e-video panel. Left sidebar, cards, one accent: the shop's orange. */

:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --ground: #f4f5f7;
  --card: #fff;
  --accent: #fd6f1a;
  --accent-dark: #e25c0a;
  --accent-soft: #fff1e8;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --sidebar: #111318;
  --sidebar-ink: #a1a7b3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--ground);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

/* ------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-ink);
  padding: 1.25rem .75rem;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .6rem;
  color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem;
  padding: .25rem .75rem 1.5rem;
}
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
}
.brand-mark svg { width: 16px; height: 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; border-radius: 8px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar nav a.active { background: rgba(253, 111, 26, .14); color: #fff; }
.sidebar nav a.active svg { color: var(--accent); }
.sidebar nav svg { width: 18px; height: 18px; flex: none; }

.sidebar .account {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 1rem .5rem 0; display: flex; flex-direction: column; gap: .75rem;
}
.sidebar .who { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.sidebar .avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; font-weight: 700; text-transform: uppercase;
}
.sidebar .account-text { min-width: 0; flex: 1; }
.sidebar .account-label { font-size: .72rem; white-space: nowrap; }
.sidebar .account-email { color: #fff; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .account form { display: block; }
.sidebar .logout {
  display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%; padding: .5rem .6rem; border-radius: 8px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); color: var(--sidebar-ink); cursor: pointer; font: inherit; font-size: .85rem;
}
.sidebar .logout:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar .logout svg { width: 15px; height: 15px; }

.main { min-width: 0; padding: 2rem 2.5rem 4rem; }
.container { max-width: 76rem; margin: 0 auto; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem; }
  .sidebar .brand { padding: 0 .5rem 0 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar nav a { padding: .45rem .6rem; }
  .sidebar .account { border: 0; padding: 0; flex-direction: row; align-items: center; }
  .sidebar .account-text { display: none; }
  .sidebar .logout { width: auto; }
  .main { padding: 1.25rem 1rem 3rem; }
}

/* ------------------------------------------------------------ page parts */

.page-header {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header .subtitle { color: var(--muted); margin-top: .3rem; }
.actions, .button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.button-row { margin: 1rem 0; }
form { margin: 0; }
.actions form, .button-row form { display: inline; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
.card-header .hint { margin: 0; }

.button {
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2); font: inherit; font-weight: 500; text-decoration: none;
  cursor: pointer; line-height: 1.2; transition: background .12s, border-color .12s;
}
.button:hover { background: #f9fafb; border-color: #c4c8cf; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(253, 111, 26, .3); }
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.danger { color: var(--danger); }
.button.danger:hover { background: var(--danger-soft); border-color: #fca5a5; }
.button.small { padding: .35rem .65rem; font-size: .85rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button svg { width: 16px; height: 16px; }

.flash {
  padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  border: 1px solid var(--line); background: #fff;
}
.flash-notice { border-color: #bbf7d0; background: var(--ok-soft); color: var(--ok); }
.flash-alert { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }
.flash ul { margin: 0; padding-left: 1.1rem; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
th { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #fafbfc; }
td a { text-decoration: none; font-weight: 500; }
td a:hover { color: var(--accent-dark); }
td.actions { justify-content: flex-end; }
code { font-size: .82rem; background: #f3f4f6; padding: .15rem .4rem; border-radius: 5px; }

.thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; display: block; background: #e5e7eb; }
.poster { width: 100%; max-width: 48rem; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); display: block; }

.status { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #f3f4f6; color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ready { background: var(--ok-soft); color: var(--ok); }
.status-failed { background: var(--danger-soft); color: var(--danger); }
.status-processing, .status-pending { background: var(--accent-soft); color: #b4480b; }
.muted, .hint { color: var(--muted); font-size: .88rem; }
.meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; color: var(--muted); }
.description { white-space: pre-line; line-height: 1.55; margin: 0; }

.search { margin-bottom: 1rem; position: relative; max-width: 26rem; }
.search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input[type=search] { padding-left: 2.3rem; }

.pagination { margin: 1rem 0; display: flex; gap: .75rem; align-items: center; }
.pagination .current { color: var(--muted); }

.show-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .show-grid { grid-template-columns: 1fr; } }
.show-grid .video-wrapper { max-width: none; margin: 0; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0; font-size: .92rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 500; }

/* ------------------------------------------------------------ forms */

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: 1fr; } }
.form-narrow { max-width: 36rem; }

.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field label, .label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: 8px;
  font: inherit; color: var(--ink); background: #fff; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 7rem; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(253, 111, 26, .15); }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.form-footer {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: .75rem; align-items: center;
  padding: .9rem 0; margin-top: .5rem;
  background: linear-gradient(to top, var(--ground) 70%, rgba(244, 245, 247, 0));
}
.form-footer .upload-status { margin-right: auto; }

/* Drop zone around a transparent file input. */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  padding: 1.5rem 1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: #fafbfc; text-align: center; cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone svg { width: 28px; height: 28px; color: var(--accent); }
.dropzone strong { font-weight: 600; }
.dropzone .chosen { color: var(--ink); font-weight: 600; word-break: break-all; }
.dropzone.small { padding: .9rem 1rem; flex-direction: row; gap: .75rem; text-align: left; justify-content: flex-start; }
.dropzone.small svg { width: 22px; height: 22px; flex: none; }

.upload-progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); margin-top: .75rem; }
.upload-progress::-webkit-progress-bar { background: var(--line); }
.upload-progress::-webkit-progress-value { background: var(--accent); }
.upload-progress::-moz-progress-bar { background: var(--accent); }

/* ------------------------------------------------------------ poster picker */

.picker-stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; }
.picker-stage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.picker-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9ca3af; padding: 1.5rem; text-align: center; font-size: .9rem; }
.picker-time { position: absolute; left: .6rem; top: .6rem; background: rgba(0, 0, 0, .65); color: #fff; font: 600 .8rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: .35rem .5rem; border-radius: 6px; }

.picker-strip { position: relative; margin-top: .75rem; height: 48px; border-radius: 6px; overflow: hidden; background: #1f2937; cursor: pointer; user-select: none; touch-action: none; }
.picker-strip canvas { width: 100%; height: 100%; display: block; }
.picker-strip .playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.picker-strip .poster-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #22c55e; pointer-events: none; }

.picker-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-right: 1px solid var(--line); background: #fff; padding: .45rem .6rem; font: inherit; font-size: .84rem; cursor: pointer; color: var(--ink-2); min-width: 2.3rem; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #f3f4f6; }
.seg button.on { background: var(--ink); color: #fff; }
.seg button svg { width: 15px; height: 15px; vertical-align: -3px; }
.picker-controls .spacer { flex: 1; }
.picker-keys { color: var(--muted); font-size: .8rem; margin-top: .65rem; line-height: 1.8; }
.picker-keys kbd { font: 600 .74rem ui-monospace, monospace; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; background: #fff; color: var(--ink-2); }

.poster-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.poster-choice figure { margin: 0; }
.poster-choice figcaption { font-size: .74rem; color: var(--muted); margin-bottom: .35rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.poster-choice img, .poster-choice canvas { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #e5e7eb; display: block; }
.placeholder { width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 8px, #eceef1 8px, #eceef1 16px); display: grid; place-items: center; color: var(--muted); font-size: .8rem; text-align: center; padding: .5rem; }

.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .76rem; margin: 1.25rem 0 1rem; text-transform: uppercase; letter-spacing: .05em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------ login */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at top, #fff5ee, var(--ground) 60%); }
.login { width: 100%; max-width: 24rem; background: #fff; padding: 2rem; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16, 24, 40, .08); }
.login .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.2rem; margin-bottom: 1.5rem; }
.login .button { width: 100%; margin-top: .5rem; }
