/*
 * Raven Drive — shared styling.
 *
 * The palette is lifted from the padel documentation page so the two feel like
 * one product, with Raven Studio's own red as the accent. No build step and no
 * framework, matching every other app in this stack.
 */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2129;
  --border:    #21262d;
  --border-2:  #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --dim:       #6e7681;
  --link:      #58a6ff;
  --raven:     #760000;
  --raven-lt:  #990000;
  --good:      #3fb950;
  --warn:      #f0883e;
  --bad:       #f85149;
  --radius:    10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.brand {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.2px;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--raven-lt); }
.topbar .sub { font-size: 12px; color: var(--muted); }
.topbar .spacer { flex: 1; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.page-title { margin: 0 0 4px; font-size: 22px; font-weight: 650; }
.page-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

/* ── Controls ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: #262c36; border-color: #444c56; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--raven); border-color: var(--raven-lt); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--raven-lt); border-color: #b30000; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { color: var(--bad); border-color: #55282a; }

.input, select.input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 7px;
  padding: 8px 11px; font-size: 13px; font-family: inherit; width: 100%;
}
.input:focus { outline: none; border-color: var(--link); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  padding: 10px 16px; font-size: 14px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
  background: none; border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--raven-lt); font-weight: 600; }

/* ── Chips ───────────────────────────────────────────────────────────────── */

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  padding: 6px 13px; border-radius: 999px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--muted); cursor: pointer; font-family: inherit;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--raven); border-color: var(--raven-lt); color: #fff; }

/* ── Event cards (hub) ───────────────────────────────────────────────────── */

.event-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.event-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: border-color .12s, transform .12s;
  display: block; color: inherit; text-decoration: none;
}
.event-card:hover { border-color: var(--link); transform: translateY(-2px); text-decoration: none; }
.event-card .src {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); margin-bottom: 10px;
}
.event-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.3; }
.event-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.event-card .foot {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--dim);
}

/* ── Media grid ──────────────────────────────────────────────────────────── */

.media-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.media-tile {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .12s;
}
.media-tile:hover { border-color: var(--link); }
.media-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: var(--surface-2);
}
.media-tile .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 34px; opacity: .35;
}
.media-tile .badge {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.72); color: #fff; font-size: 11px;
  padding: 2px 7px; border-radius: 4px; backdrop-filter: blur(2px);
}

/* ── Face grid (Find Yourself) ───────────────────────────────────────────── */

.face-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}
.face-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: border-color .12s, transform .12s; text-align: center;
}
.face-card:hover { border-color: var(--raven-lt); transform: translateY(-3px); }
.face-card .face {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  background: var(--surface-2);
}
.face-card .ph {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center;
  justify-content: center; font-size: 40px; opacity: .3; background: var(--surface-2);
}
.face-card .count { padding: 9px 6px 11px; }
.face-card .count b { display: block; font-size: 17px; font-weight: 650; }
.face-card .count span { font-size: 11px; color: var(--muted); }

/* ── States ──────────────────────────────────────────────────────────────── */

.state {
  text-align: center; padding: 70px 22px; color: var(--muted);
  max-width: 460px; margin: 0 auto;
}
.state .icon { font-size: 46px; margin-bottom: 14px; opacity: .8; }
.state h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); font-weight: 600; }
.state p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; }

.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--link);
}
.banner.warn { border-left-color: var(--warn); }
.banner.bad  { border-left-color: var(--bad); }
.banner.good { border-left-color: var(--good); }
.banner .body { flex: 1; }
.banner .title { font-weight: 600; margin-bottom: 3px; }
.banner .detail { color: var(--muted); font-size: 12.5px; }

.progress-track {
  height: 6px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; margin-top: 9px;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--raven), var(--raven-lt));
  border-radius: 999px; transition: width .4s ease;
}

.spinner {
  display: inline-block; width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid var(--border-2); border-top-color: var(--link);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Lightbox ────────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.93);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox .inner {
  max-width: 96vw; max-height: 96vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); overflow: hidden; position: relative;
}
.lightbox .stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  background: #000;
}
.lightbox .stage img, .lightbox .stage video { max-width: 92vw; max-height: 82vh; display: block; }
.lightbox .bar {
  display: flex; align-items: center; gap: 12px; padding: 11px 15px;
  border-top: 1px solid var(--border); background: var(--bg);
}
.lightbox .bar .name {
  flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lightbox .close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,.65); border: 1px solid var(--border-2); color: #fff;
  font-size: 15px; font-family: inherit;
}
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 62px; border: 0; cursor: pointer;
  background: rgba(0,0,0,.5); color: #fff; font-size: 22px; font-family: inherit;
}
.lightbox .nav.prev { left: 0; border-radius: 0 8px 8px 0; }
.lightbox .nav.next { right: 0; border-radius: 8px 0 0 8px; }

/* ── Misc ────────────────────────────────────────────────────────────────── */

.sentinel { height: 40px; display: flex; align-items: center; justify-content: center; }
.pill {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.pill.good { color: var(--good); }
.pill.warn { color: var(--warn); }
.pill.bad  { color: var(--bad); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 11px 18px; font-size: 13px;
  z-index: 200; box-shadow: 0 8px 28px rgba(0,0,0,.5); max-width: 90vw;
}
.toast.bad { border-color: #55282a; color: #ffa198; }
.toast.good { border-color: #2b4a30; color: #7ee787; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 11px; color: var(--muted);
  font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border);
}
table.data td { padding: 9px 11px; border-bottom: 1px solid var(--border); }
table.data tr:hover td { background: var(--surface); }

@media (max-width: 640px) {
  .wrap { padding: 16px 12px 50px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 7px; }
  .face-grid  { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 11px; }
  .event-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 19px; }
}
