/* =========================================================================
 * apps/admin/styles.css — admin-console-specific styles on /shared/theme.css.
 * ========================================================================= */

.admin-app { max-width: 720px; }

/* ---- View layout: separate the category cards --------------------------
 * Each view is a plain <section> (normal block flow) and .gos-card carries no
 * margin, so stacked category cards fused into one seamless block with 0px
 * between them — e.g. "Revenue" touching "Breakdown by item type", or
 * "Upsells & photo" touching "Hook numbers". Lay every card-bearing view out
 * as a column with a real gap so each category reads as its own card. */
#settings-view,
#dashboard-view,
#history-view,
#tags-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---- Nav tab bar -------------------------------------------------------- */
.admin-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
.admin-nav-brand { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.admin-nav-brand strong { font-size: var(--text-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-nav-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.nav-tab[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* ---- Settings form: vertical rhythm -------------------------------------
 * Fields must read as grouped label+control units, not one flat stack. The
 * default .gos-stack gap (12px) puts a label the SAME distance from its own
 * control as from the next field, which flattens the whole form together.
 * Settings cards instead breathe generously BETWEEN fields, while each label
 * stays tightly coupled to its own control (.settings-field / .settings-group). */
.settings-card { gap: var(--space-5); }
.settings-card > h2 { margin-bottom: 0; }
.settings-card > p  { margin-bottom: 0; }
.settings-card > h2 + p { margin-top: calc(-1 * var(--space-4)); } /* keep a description tucked under its heading */
.settings-card > .gos-divider { margin: 0; }                        /* the card gap supplies the breathing room */

/* A stacked field: label sitting directly above a full-width control. */
.settings-field { display: flex; flex-direction: column; gap: var(--space-2); }
.settings-field > .gos-label { margin: 0; }

/* Related controls that belong together (e.g. an upsell toggle + its price):
   snug internally, but spaced apart from the next group by the card gap. */
.settings-group { display: flex; flex-direction: column; gap: var(--space-4); }

/* ---- Generic settings rows (label left, control right) ------------------ */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.field-hint { font-size: var(--text-xs); color: var(--text-faint); margin-top: calc(-1 * var(--space-2)); }

/* Keep the label/description on the left flexible and give every row's control
   the SAME fixed width, so the text inputs, selects and read-only values line
   up into one tidy column (matching left AND right edges) instead of each row
   picking its own max-width. Toggles / color pickers keep their natural size. */
.settings-row > label:first-child,
.settings-row > div:first-child,
.settings-row > span:first-child:not(.gos-toggle-wrap) { flex: 1 1 auto; min-width: 0; }
.settings-row .gos-input,
.settings-row .gos-select { flex: none; width: 150px; }
.settings-row .gos-input[type="number"] { text-align: right; }
.settings-readonly { flex: none; width: 150px; text-align: right; font-weight: var(--weight-bold); color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Toggle switch (checkbox styled as a pill switch) -------------------- */
.gos-toggle-wrap { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; user-select: none; }
.gos-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gos-toggle-track {
  position: relative;
  width: 48px; height: 28px;
  border-radius: var(--radius-pill);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  transition: background var(--motion), border-color var(--motion);
  flex: none;
}
.gos-toggle-track::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--motion), background var(--motion);
}
.gos-toggle-input:checked + .gos-toggle-track { background: var(--accent-soft); border-color: var(--accent); }
.gos-toggle-input:checked + .gos-toggle-track::after { transform: translateX(20px); background: var(--accent); }
.gos-toggle-input:focus-visible + .gos-toggle-track { box-shadow: var(--focus-ring); }

/* ---- Item pricing table -------------------------------------------------- */
.item-price-row {
  display: grid;
  grid-template-columns: auto 1fr 6rem auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.item-price-row:last-child { border-bottom: none; }
.item-price-row.is-disabled { opacity: 0.5; }
.item-price-row .item-icon { font-size: var(--text-lg); width: 1.5em; text-align: center; }
.item-price-row .gos-input { min-height: 40px; padding: var(--space-2) var(--space-3); }
.item-remove-btn { min-height: 40px; padding: 0 var(--space-3); }

/* ---- Accent color picker -------------------------------------------------- */
.accent-picker { display: flex; align-items: center; gap: var(--space-3); }
.accent-picker input[type="color"] {
  width: 48px; height: 48px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-md); background: none; cursor: pointer;
}

/* ---- Sponsor preview (mocks exactly what the guest pass shows) ---------- */
.sponsor-preview {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  padding: var(--space-4);
}
.sponsor-preview-pass {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.sponsor-preview-pass .gos-hook-number { font-size: var(--text-2xl); }

/* ---- Dashboard stat tiles -------------------------------------------------- */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.tile {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.tile-value { font-size: var(--text-3xl); font-weight: var(--weight-black); line-height: 1; }
.tile-label { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }

#live-indicator { background: var(--ok-soft); color: var(--ok); }
#live-indicator.is-offline { background: var(--danger-soft); color: var(--danger); }

/* ---- Occupancy tile (live checked-in vs. configured hook-range capacity) --- */
.occupancy-bar { margin-top: var(--space-2); height: 6px; border-radius: var(--radius-pill); background: var(--bg-raised); overflow: hidden; }
.occupancy-bar-fill { height: 100%; background: var(--accent); transition: width var(--motion); }
.occupancy-bar-fill.is-full { background: var(--danger); }

/* ---- Inline field validation (settings form) ------------------------------ */
.gos-input.is-invalid, .item-price-row.is-invalid { border-color: var(--danger); }
.item-price-row.is-invalid { border: 1px solid var(--danger); border-radius: var(--radius-md); }
.field-error { color: var(--danger); font-size: var(--text-xs); margin-top: calc(-1 * var(--space-1)); margin-bottom: var(--space-1); }

/* ---- Revenue figures + bar charts ------------------------------------------ */
.revenue-figure { font-size: var(--text-3xl); font-weight: var(--weight-black); }
.revenue-line { display: flex; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.revenue-line:last-child { border-bottom: none; }
.revenue-line--share { color: var(--accent-text); font-weight: var(--weight-bold); }

.bar-row { margin: var(--space-3) 0; }
.bar-row-label { display: flex; justify-content: space-between; font-size: var(--text-sm); margin-bottom: var(--space-1); }

/* Hand-rolled inline SVG bar charts (items-by-type, upsells, revenue-by-hour) — see barRow() in app.js. */
.chart-svg { display: block; overflow: visible; }
.chart-track { fill: var(--bg-raised); }
.chart-fill { fill: var(--accent); transition: width var(--motion); }
.chart-fill.bar-fill--express { fill: var(--info); }

/* ---- History table --------------------------------------------------------- */
.history-toolbar { margin-bottom: var(--space-3); flex-wrap: wrap; }
.history-toggle.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.history-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.history-table th, .history-table td { padding: var(--space-2) var(--space-3); text-align: right; border-bottom: 1px solid var(--line); }
.history-table th:first-child, .history-table td:first-child { text-align: left; }
.history-table thead th { color: var(--text-muted); font-weight: var(--weight-medium); }
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tfoot th { text-align: right; font-weight: var(--weight-bold); border-top: 2px solid var(--line-strong); border-bottom: none; }
.history-table tfoot th:first-child { text-align: left; }
.history-breakdown { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }

/* ---- Hanger tags inventory ------------------------------------------------- */
.tags-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; max-height: 320px; overflow-y: auto; }
.tag-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-elevated); }
.tag-num { font-weight: var(--weight-black); font-size: var(--text-lg); min-width: 3ch; text-align: center; color: var(--text); }
.tag-id { flex: 1 1 auto; color: var(--text-faint); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-del { border: 0; background: none; color: var(--danger); font-size: var(--text-lg); cursor: pointer; padding: 2px 8px; border-radius: var(--radius-sm); line-height: 1; }
.tag-del:hover { background: var(--danger-soft); }
