/* CPB CPD Portal — institutional theme */

:root {
  --bg:          #eef2f3;
  --surface:     #ffffff;
  --surface-2:   #f6f9f9;
  --ink:         #14242b;
  --muted:       #5a6a71;
  --primary:     #0f5f5c;
  --primary-dk:  #0a4744;
  --primary-ink: #e8f4f2;
  --accent:      #b7791f;
  --line:        #dbe4e6;
  --ok:          #1e7d5a;
  --ok-bg:       #e6f4ee;
  --danger:      #b3261e;
  --danger-bg:   #fbeae9;
  --radius:      10px;
  --shadow:      0 1px 2px rgba(20,36,43,.06), 0 8px 24px rgba(20,36,43,.06);
  --font:        "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display:     "Bricolage Grotesque", var(--font);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

a { color: var(--primary); }

/* ---------- top bar ---------- */
.topbar {
  background: var(--primary);
  color: var(--primary-ink);
  border-bottom: 3px solid var(--accent);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--primary-ink); color: var(--primary);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 18px;
  letter-spacing: -.02em;
}
.brand .name { font-family: var(--display); font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.brand .name small { display: block; font-family: var(--font); font-weight: 400; font-size: .74rem; opacity: .85; }
.topbar a { color: var(--primary-ink); text-decoration: none; font-size: .9rem; }
.topbar a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 32px 20px 64px; }
.narrow { max-width: 520px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 20px; }

h1 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; font-size: 1.6rem; }
h2 { font-family: var(--display); font-weight: 600; margin: 0 0 4px; font-size: 1.15rem; }
.lead { color: var(--muted); margin: 0 0 22px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .72rem;
  font-weight: 600; color: var(--accent); margin: 0 0 8px;
}

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 5px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(15,95,92,.35); outline-offset: 1px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; font-size: 1rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--primary-dk); }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface); color: var(--primary); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 8px 14px; font-size: .85rem; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .92rem; margin-bottom: 18px; border: 1px solid; }
.alert.err { background: var(--danger-bg); border-color: #f0c5c2; color: #7c1a15; }
.alert.ok  { background: var(--ok-bg); border-color: #bfe3d3; color: #14624a; }

/* ---------- confirm popup ---------- */
.confirm-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; margin-bottom: 20px;
}
.confirm-box dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.confirm-box dt { color: var(--muted); font-size: .85rem; }
.confirm-box dd { margin: 0; font-weight: 600; }

/* ---------- video library ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.vcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.vcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.vthumb { aspect-ratio: 16/9; background: #0b1417 center/cover no-repeat; position: relative; }
.vthumb::after {
  content: "▶"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 1.4rem; text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.vbody { padding: 14px 16px; }
.vbody .t { font-weight: 600; line-height: 1.35; }

.player { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: 10px; background: #000; }

/* ---------- tables (admin) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.data th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-2); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: #eef1f2; color: var(--muted); }

.row-actions { display: flex; gap: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { text-decoration: none; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; min-width: 150px; }
.stat .n { font-family: var(--display); font-size: 1.7rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .82rem; }

@media (max-width: 540px) {
  .card { padding: 20px; }
  .topbar .brand .name small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
