/* TCC Design Tokens */

/* ── Design tokens ─────────────────────────────────────── */
:root {
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --bg-primary:   #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-tertiary:  #f0f0ed;
  --bg-hover:     #f2f2ef;

  --text-primary:   #1a1a18;
  --text-secondary: #6b6b66;
  --text-tertiary:  #a0a09a;
  --text-inverse:   #ffffff;

  --border-subtle:  rgba(0,0,0,0.08);
  --border-default: rgba(0,0,0,0.12);
  --border-strong:  rgba(0,0,0,0.20);

  --accent:         #1a1a18;
  --accent-hover:   #333330;

  --green-bg:   #eaf3de;
  --green-text: #27500a;
  --green-border: #c0dd97;

  --amber-bg:   #faeeda;
  --amber-text: #633806;
  --amber-border: #fac775;

  --red-bg:   #fcebeb;
  --red-text: #791f1f;
  --red-border: #f7c1c1;

  --blue-bg:   #e6f1fb;
  --blue-text: #0c447c;
  --blue-border: #b5d4f4;

  --purple-bg:   #eeedfe;
  --purple-text: #3c3489;
  --purple-border: #cecbf6;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

/* ── Dark mode ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary:   #1c1c1a;
  --bg-secondary: #242422;
  --bg-tertiary:  #2a2a27;
  --bg-hover:     #2e2e2b;

  --text-primary:   #f0f0ed;
  --text-secondary: #9a9a94;
  --text-tertiary:  #65655f;
  --text-inverse:   #1a1a18;

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  --accent:       #f0f0ed;
  --accent-hover: #d0d0cc;

  --green-bg:   #1a2e0e;
  --green-text: #a8d470;
  --green-border: #3b5c1a;

  --amber-bg:   #2e1e06;
  --amber-text: #e8a830;
  --amber-border: #5c3a0a;

  --red-bg:   #2e0e0e;
  --red-text: #f09090;
  --red-border: #5c1e1e;

  --blue-bg:   #0a1e30;
  --blue-text: #70b0f0;
  --blue-border: #1a3c5c;

  --purple-bg:   #1a1630;
  --purple-text: #a898f0;
  --purple-border: #342e5c;
}

/* ── Base reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ─────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-head {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-mark {
  padding-top: 24px;
  margin-bottom: 6px;
}
.sidebar-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.sidebar-sub  { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; margin-bottom: 16px; }

.nav-section { padding: 10px 8px 0; }
.nav-label {
  font-size: 9px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 6px 5px;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 1px;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-secondary); color: var(--text-primary); font-weight: 500; }
.nav-item i { font-size: 15px; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Main area ─────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}
.topbar {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title { font-size: 14px; font-weight: 500; }
.topbar-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 6px;
}
.filter-row {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: transparent;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn i { font-size: 14px; }

.btn-primary {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { border-color: var(--red-border); color: var(--red-text); }
.btn-danger:hover { background: var(--red-bg); }

.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; }

.btn-secondary { }

.btn-sm { padding: 3px 10px; font-size: 11px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
  font-family: var(--font-sans);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }
.icon-btn i { font-size: 14px; }
.icon-btn.dim { opacity: 0.3; pointer-events: none; }
.icon-btn.active { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-default); }
.icon-btn-danger:hover { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }

/* ── Inputs ────────────────────────────────────────────── */
.input {
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--border-strong); }
.input-search { flex: 1; }

select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 72px; font-size: 13px; }
.input-lg { font-size: 13px; padding: 7px 11px; }

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-hint { font-size: 10px; color: var(--text-tertiary); margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { font-size: 11px; color: var(--red-text); margin-top: 4px; }

/* ── Asset list row ────────────────────────────────────── */
.asset-list { }
.asset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s;
}
.asset-row:last-child { border-bottom: none; }
.asset-row:hover { background: var(--bg-hover); }

.asset-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-blue   { background: #e6f1fb; color: #185fa5; }
.thumb-purple { background: #eeedfe; color: #3c3489; }
.thumb-green  { background: #eaf3de; color: #27500a; }
.thumb-amber  { background: #faeeda; color: #633806; }
.thumb-red    { background: #fcebeb; color: #791f1f; }
.thumb-teal   { background: #e1f5ee; color: #085041; }

.asset-info { flex: 1; min-width: 0; }
.asset-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-pub { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.asset-tags { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }

/* ── Image preview strip ───────────────────────────────── */
.img-strip { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.img-preview {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-preview.loading { animation: skeleton 1.2s ease-in-out infinite; }
@keyframes skeleton {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.img-none {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.img-none i { font-size: 15px; }
.img-more {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Divider ───────────────────────────────────────────── */
.vdivider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-ready   { background: var(--green-bg);  color: var(--green-text);  border: 1px solid var(--green-border); }
.badge-missing { background: var(--amber-bg);  color: var(--amber-text);  border: 1px solid var(--amber-border); }
.badge-admin   { background: var(--purple-bg); color: var(--purple-text); border: 1px solid var(--purple-border); }
.badge-dev     { background: var(--blue-bg);   color: var(--blue-text);   border: 1px solid var(--blue-border); }
.badge-error   { background: var(--red-bg);    color: var(--red-text);    border: 1px solid var(--red-border); }

/* ── Tags ──────────────────────────────────────────────── */
.tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.tag-filter { cursor: pointer; }
.tag-filter.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}

/* ── Action buttons row ────────────────────────────────── */
.actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* ── Stat cards ────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 10px 13px;
}
.stat-label { font-size: 10px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 500; }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  background: var(--bg-secondary);
  padding: 8px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 440px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-sm { width: 360px; }
.modal-lg { width: 560px; }
.modal-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.modal-sub   { font-size: 12px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Toast notifications ───────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  min-width: 260px;
  max-width: 340px;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast i.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 500; margin-bottom: 1px; }
.toast-msg   { color: var(--text-secondary); font-size: 11px; }
.toast-close { color: var(--text-tertiary); cursor: pointer; font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.toast-success { border-color: var(--green-border); }
.toast-success .toast-icon { color: var(--green-text); }

.toast-error { border-color: var(--red-border); }
.toast-error .toast-icon { color: var(--red-text); }

.toast-info { border-color: var(--blue-border); }
.toast-info .toast-icon { color: var(--blue-text); }

.toast-warning { border-color: var(--amber-border); }
.toast-warning .toast-icon { color: var(--amber-text); }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  gap: 10px;
  color: var(--text-tertiary);
}
.empty-state i { font-size: 32px; }
.empty-state p { font-size: 13px; color: var(--text-secondary); }

/* ── Login screen ──────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}
.login-mark {
  padding-top: 12px;
  margin-bottom: 8px;
}
.login-title { font-size: 16px; font-weight: 500; margin-bottom: 3px; }
.login-sub   { font-size: 12px; color: var(--text-secondary); margin-bottom: 22px; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* ── Utility ───────────────────────────────────────────── */
.text-muted    { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-danger   { color: var(--red-text); }
.text-sm       { font-size: 11px; }
.text-xs       { font-size: 10px; }
.font-medium   { font-weight: 500; }
.flex          { display: flex; }
.items-center  { align-items: center; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.mt-1          { margin-top: 4px; }
.mt-2          { margin-top: 8px; }
.mt-3          { margin-top: 12px; }

/* ── Loading indicator ─────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ── Asset grid ────────────────────────────────────────── */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.asset-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.1s, background 0.1s;
  display: flex;
  flex-direction: column;
}
.asset-card:hover { background: var(--bg-hover); border-color: var(--border-default); }
.asset-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 500;
  overflow: hidden;
  flex-shrink: 0;
}
.asset-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-card-body { padding: 10px 12px 6px; }
.asset-card-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-card-pub { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.asset-card-tags { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.asset-card-strip { display: flex; gap: 4px; padding: 0 12px 10px; flex-wrap: nowrap; overflow: hidden; }
.asset-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Analytics ─────────────────────────────────────────── */
.game-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.game-tab {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.1s;
}
.game-tab.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.metric-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.metric-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.metric-value { font-size: 24px; font-weight: 500; }
.metric-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 12px; font-weight: 500; }
.retention-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.retention-label { font-size: 11px; font-weight: 500; width: 28px; }
.retention-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.retention-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
}
.retention-pct { font-size: 11px; color: var(--text-secondary); width: 36px; text-align: right; }
