/* ============================================================
   DAPS.Web — Creator Studio shell + screens (WO6).
   Dense operator surface. Faithful CSS translation of
   design-system/ui_kits/creator-studio/StudioShell.jsx + StudioScreens.jsx.
   RULE: design tokens ONLY for colour / font / radius / motion. A few
   structural px (nav width, chart height, tiny thumb/bar radii, hairlines)
   are permitted where no token applies. Components themselves come from the
   WO3/WO4 Tag Helpers — this file only composes and positions them, denser
   than the consumer app.
   ============================================================ */

/* ============================================================
   Shell — top bar + dense left nav
   ============================================================ */
.studio-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
}

/* ---- Top bar (60px) ---- */
.studio-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-h);
  padding: 0 var(--space-5);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 10;
}

.studio-logo {
  display: inline-flex;
  text-decoration: none;
  border-radius: var(--radius-full);
}

.studio-chip {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-button);
  white-space: nowrap;
}

.studio-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* External back-to-DAPS link (44px min target) */
.studio-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-primary);
  border-radius: var(--radius-button);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-standard);
}

.studio-ext:hover {
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
}

.studio-ext i {
  width: 18px;
  height: 18px;
}

/* ---- Body: dense nav + main ---- */
.studio-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.studio-nav {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}

.studio-nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  text-align: left;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-standard);
}

.studio-nav__item:hover {
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
}

.studio-nav__item i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.studio-nav__item.active {
  background: color-mix(in srgb, var(--accent-primary) 16%, transparent);
  color: var(--accent-primary);
  font-weight: var(--fw-semibold);
}

.studio-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ============================================================
   Screens — shared
   ============================================================ */
.studio-screen {
  padding: var(--space-6) var(--space-8) var(--space-12);
}

.studio-screen__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.studio-h1 {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h1);
  color: var(--text-primary);
}

.studio-screen__head .studio-h1 {
  margin: 0;
}

.studio-sub {
  margin: 0 0 var(--space-6);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text-muted);
}

/* ============================================================
   Stat cards — large Sora numbers (money type scale)
   ============================================================ */
.studio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.studio-stat__label {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

.studio-stat__value-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.studio-stat__value {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-money);
  letter-spacing: var(--ls-money);
  line-height: var(--lh-tight);
  color: var(--text-primary);
}

.studio-stat__unit {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h1);
  color: var(--accent-primary);
}

.studio-stat__delta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
}

.studio-stat__delta i {
  width: 14px;
  height: 14px;
}

.studio-stat__delta.is-up {
  color: var(--success);
}

.studio-stat__delta.is-down {
  color: var(--error);
}

/* ============================================================
   Dashboard — chart + top-performing rail
   ============================================================ */
.studio-dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-4);
}

.studio-chart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.studio-chart__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  color: var(--text-primary);
}

/* Flat token-coloured bar chart. Heights are data (inline % per bar). */
.studio-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 140px;
  padding: 0 var(--space-1);
}

.studio-bar {
  flex: 1;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--bg-elevated);
}

.studio-bar--active {
  background: var(--accent-primary);
}

.studio-rail__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.studio-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.studio-top:last-child {
  border-bottom: none;
}

.studio-top__rank {
  width: 18px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-body);
  color: var(--accent-primary);
}

.studio-top__body {
  flex: 1;
  min-width: 0;
}

.studio-top__title {
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-top__meta {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  color: var(--text-muted);
}

/* ============================================================
   Content — uploads/drafts table
   ============================================================ */
.studio-table-card {
  overflow: hidden;
}

.studio-table {
  width: 100%;
  border-collapse: collapse;
}

.studio-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.studio-table__title-col {
  width: 40%;
}

.studio-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.studio-table tbody tr:last-child td {
  border-bottom: none;
}

.studio-table__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.studio-table__thumb {
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 5px;
  background: var(--bg-tertiary);
}

.studio-table__name {
  font-weight: var(--fw-semibold);
}

.studio-table__earned {
  font-weight: var(--fw-semibold);
}

.studio-table__date {
  color: var(--text-muted);
}

/* ============================================================
   Monetization — "money is sacred" note
   ============================================================ */
.studio-money-note__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.studio-money-note__head i {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

.studio-money-note__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  color: var(--text-primary);
}

.studio-money-note__body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body);
  color: var(--text-muted);
}

/* ============================================================
   Analytics banner + Settings form (tokens only)
   ============================================================ */
.studio-screen .ds-banner {
  margin-bottom: var(--space-5);
}

.studio-settings-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 560px;
}

.studio-settings-switches {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.studio-settings-actions {
  margin-top: var(--space-2);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .studio-dash-grid {
    grid-template-columns: 1fr;
  }
  .studio-screen {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
  }
}

@media (max-width: 768px) {
  .studio-nav {
    display: none;
  }
}
