/**
 * ParlorOps operator admin console — styles.
 * Shares the design token palette from the marketing site.
 */

:root {
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --paper: #fafaf7;
  --rule: #e5e3dc;
  --accent: #8a3ffc;
  --accent-dark: #6d2fd4;
  --error: #c0392b;
  --error-bg: #fdf3f2;
  --success: #1a7a45;
  --success-bg: #f0faf4;
  --surface: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0f0f0;
    --ink-soft: #b8b8b8;
    --paper: #121212;
    --rule: #2a2a2a;
    --surface: #1e1e1e;
    --error-bg: #2a0f0f;
    --success-bg: #0a2015;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  font-size: 15px;
}

/* ── Topbar ─────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.topbar-title {
  flex: 1;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Main container ─────────────────────────────────────────────── */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Status bar ─────────────────────────────────────────────────── */

.status-bar {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
  min-height: 1.25rem;
}

/* ── Tab bar ────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Table ──────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, var(--paper)); }

.col-date {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.col-version {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.col-body {
  font-size: 0.9rem;
  max-width: 400px;
}

.col-action { white-space: nowrap; }

.loading-row td,
.empty-row td,
.error-row td {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.error-row td { color: var(--error); }

/* ── Badges ─────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-bug         { background: #fdecea; color: #c0392b; }
.badge-feature_request { background: #eaf0fd; color: #2563eb; }
.badge-praise      { background: #f0faf4; color: #1a7a45; }
.badge-other       { background: #f3f0ff; color: #6d2fd4; }

.badge-status-open      { background: #fdecea; color: #c0392b; }
.badge-status-closed    { background: #f0faf4; color: #1a7a45; }
.badge-status-triaged   { background: #fff7e6; color: #b45309; }
.badge-status-in_progress { background: #eaf0fd; color: #2563eb; }
.badge-status-duplicate { background: #f3f0f3; color: #6b6b7b; }

/* ── User role + status badges ──────────────────────────────────────── */

.badge-shop_admin { background: #f3f0ff; color: #6d2fd4; }
.badge-artist     { background: #eaf0fd; color: #2563eb; }
.badge-client     { background: #f0faf4; color: #1a7a45; }
.badge-active     { background: #f0faf4; color: #1a7a45; }
.badge-disabled   { background: #fdecea; color: #c0392b; }

/* ── View link ──────────────────────────────────────────────────── */

.view-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.view-link:hover { text-decoration: underline; }

/* ── Pagination ─────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--ink);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Detail page ────────────────────────────────────────────────── */

.detail-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.75rem;
  max-width: 720px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.detail-date {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-left: auto;
}

.detail-body {
  font-size: 1rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.meta-table th {
  text-align: left;
  padding: 0.45rem 0.85rem 0.45rem 0;
  color: var(--ink-soft);
  font-weight: 600;
  width: 130px;
  white-space: nowrap;
}

.meta-table td {
  padding: 0.45rem 0;
  word-break: break-all;
}

.meta-table tr { border-bottom: 1px solid var(--rule); }
.meta-table tr:last-child { border-bottom: none; }

.meta-table code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

.detail-actions {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.close-btn {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.close-btn:hover:not(:disabled) { opacity: 0.8; }
.close-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.closed-notice {
  font-size: 0.875rem;
  color: var(--success);
  font-weight: 600;
}

.back-link-btn {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.back-link-btn:hover { text-decoration: underline; }

.loading-msg, .error-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
}

.error-msg { color: var(--error); }

/* ── Announcement status badges ─────────────────────────────── */

.badge-ann-active    { background: #f0faf4; color: #1a7a45; }
.badge-ann-scheduled { background: #eaf0fd; color: #2563eb; }
.badge-ann-expired   { background: #f1f1f0; color: #555555; }
.badge-ann-inactive  { background: #fff7e6; color: #b45309; }

/* ── Announcement role badges ───────────────────────────────── */

.badge-role-all        { background: #f3f0ff; color: #6d2fd4; }
.badge-role-client     { background: #f0faf4; color: #1a7a45; }
.badge-role-artist     { background: #eaf0fd; color: #2563eb; }
.badge-role-shop_admin { background: #f3f0ff; color: #6d2fd4; }

/* ── Priority chip ──────────────────────────────────────────── */

.badge-priority {
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ── System Health — service status dot colours ─────────────── */
/* Used by health.html; defined here for reuse if other pages need them. */

.dot-ok             { background: #16a34a; }
.dot-degraded       { background: #d97706; }
.dot-down           { background: #dc2626; }
.dot-not_configured { background: #d97706; }
.dot-unknown        { background: #9ca3af; }

/* ── System Health — rotation status badges ──────────────────── */

.rot-fresh         { background: #f0faf4; color: #1a7a45; }
.rot-due_soon      { background: #fff7e6; color: #b45309; }
.rot-overdue       { background: #fdecea; color: #dc2626; }
.rot-never         { background: #f3f0f3; color: #6b6b7b; }
.rot-do_not_rotate { background: #eaf0fd; color: #2563eb; }

/* ── Left sidebar navigation ────────────────────────────────────── */
/* Injected by admin.js on every page whose <body> carries data-nav. */

.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.8rem 1rem;
  z-index: 20;
}

.sidenav .brand {
  display: block;
  padding: 0 0.7rem 1.1rem;
}

.sidenav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.sidenav-link {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidenav-link:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.sidenav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.sidenav-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.sidenav-footer .logout-btn { width: 100%; }

body.has-sidenav { padding-left: 220px; }

/* Narrow screens: the sidebar becomes a wrapping strip across the top. */
@media (max-width: 800px) {
  body.has-sidenav { padding-left: 0; }
  .sidenav {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 0.6rem 0.8rem;
  }
  .sidenav .brand { padding: 0 0.6rem 0 0; }
  .sidenav-links { flex-direction: row; flex-wrap: wrap; flex: 1 1 auto; overflow: visible; }
  .sidenav-link { border-left: none; padding: 0.35rem 0.6rem; }
  .sidenav-footer { margin-top: 0; margin-left: auto; padding-top: 0; border-top: none; }
  .sidenav-footer .logout-btn { width: auto; }
}
