/*
 * Operator nav — left sidebar shared across clients.standard-dev.com/*.
 *
 * Mirrors the client portal sidebar (functions/_client_layout.js) so the team-
 * facing and client-facing surfaces feel like one family. Same colors, same
 * 240px width, same active-state treatment (purple left border + bg tint).
 *
 * Used by:
 *   /index.html            (Clients dashboard)
 *   /clients/index.html    (Per-client detail view)
 *
 * NOT used by:
 *   status.standard-dev.com — separate CF Worker, inlines its own CSS.
 *
 * Layout invariant: page-level body is the .gradient-bar + .op-layout flex
 * container. The sidebar is sticky-100vh on the left; existing per-page
 * `.container` flows to the right of it without further changes.
 */

.op-layout {
  display: flex;
  min-height: 100vh;
}

/* Make the right-hand .container grow to fill the remaining flex space (up
   to its own max-width of 1320px). Without this, .container only sizes to
   its intrinsic content width — so pages with narrow content (like
   /prospecting/search.html before its results render) collapsed to
   ~700px while the wider Sequences grid happened to fill out to 1320px.
   `min-width: 0` keeps the column from overflowing on small viewports. */
.op-layout > .container {
  flex: 1;
  min-width: 0;
}

/* ── SIDEBAR ───────────────────────────────────────────────────────────── */

.op-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0F0B16;
  border-right: 1px solid rgba(196, 184, 216, 0.08);
  padding: 32px 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
}

.op-sidebar-wordmark {
  display: block;
  text-decoration: none;
  color: #FFFFFF;
  font-size: 16px;
  letter-spacing: -0.01em;
  padding: 0 8px 4px;
  line-height: 1;
}
.op-sidebar-wordmark .b { font-weight: 700; }
.op-sidebar-wordmark .l { font-weight: 300; }

.op-sidebar-kicker {
  padding: 2px 8px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(196, 184, 216, 0.55);
}

.op-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.op-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 10px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(196, 184, 216, 0.78);
  text-decoration: none;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.op-sidebar-item:hover {
  color: #FFFFFF;
  background: rgba(168, 85, 247, 0.06);
}
.op-sidebar-item.current {
  color: #FFFFFF;
  background: rgba(168, 85, 247, 0.10);
  border-left-color: #A855F7;
}

.op-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: currentColor;
}

.op-sidebar-arrow {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.55;
}

/* Sub-items — nested under a primary nav item (e.g. Sequences under
   Prospecting). Indented to align past the parent icon, slightly muted
   text. Active state uses a thinner accent so it doesn't compete with
   the parent's full purple bar. */
.op-sidebar-subitem {
  padding: 6px 12px 6px 36px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(196, 184, 216, 0.55);
  text-decoration: none;
  border-radius: 6px;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  transition: color 120ms, background 120ms;
}
.op-sidebar-subitem:hover {
  color: #FFFFFF;
  background: rgba(168, 85, 247, 0.04);
}
.op-sidebar-subitem.current {
  color: #FFFFFF;
  background: rgba(168, 85, 247, 0.06);
  border-left-color: rgba(168, 85, 247, 0.55);
}

.op-sidebar-divider {
  height: 1px;
  background: rgba(196, 184, 216, 0.08);
  margin: 14px 8px 12px;
}

/* Collapsable group: a <details> wrapping a primary <summary class="op-sidebar-item">
   plus its op-sidebar-subitem children. Toggling open/closed shows/hides the
   subitems. The persistence script in /shared/operator-nav.js restores the
   last state from localStorage. */
.op-sidebar-group { display: contents; }   /* the <details> shouldn't add layout */
.op-sidebar-group > summary.op-sidebar-item {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.op-sidebar-group > summary.op-sidebar-item::-webkit-details-marker { display: none; }
.op-sidebar-group > summary.op-sidebar-item::after {
  content: '';
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);   /* points right when collapsed */
  opacity: 0.55;
  transition: transform 160ms;
}
.op-sidebar-group[open] > summary.op-sidebar-item::after {
  transform: rotate(45deg);    /* points down when open */
}
.op-sidebar-group:not([open]) > .op-sidebar-subitem { display: none; }

.op-sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 4px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(196, 184, 216, 0.08);
  padding-top: 14px;
}

.op-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #EC4899, #A855F7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.op-sidebar-user-email {
  font-size: 10px;
  color: rgba(196, 184, 216, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "JetBrains Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}

.op-sidebar-signout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(196, 184, 216, 0.55);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 120ms;
}
.op-sidebar-signout:hover { color: #FBCFE8; }
.op-sidebar-signout::after { content: '↗'; opacity: 0.6; }

/* Inspector popover trigger — visual hint that the avatar/email is clickable. */
.op-sidebar-avatar[data-id-trigger],
.op-sidebar-user-email[data-id-trigger] {
  transition: opacity 120ms;
}
.op-sidebar-avatar[data-id-trigger]:hover,
.op-sidebar-user-email[data-id-trigger]:hover { opacity: 0.85; }

/* ── ACCOUNT INSPECTOR POPOVER ─────────────────────────────────────────── */

.op-identity-popover {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.op-identity-popover.open { display: flex; }
.op-identity-popover .oip-backdrop {
  position: absolute; inset: 0;
  background: rgba(13, 10, 20, 0.72);
  backdrop-filter: blur(4px);
}
.op-identity-popover .oip-card {
  position: relative;
  width: min(480px, 100%);
  max-height: 80vh; overflow-y: auto;
  background: #0D0A14;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #fff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.op-identity-popover .oip-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(196, 184, 216, 0.10);
}
.op-identity-popover .oip-kicker {
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(196, 184, 216, 0.65);
}
.op-identity-popover .oip-close {
  background: transparent; border: 0; color: rgba(196, 184, 216, 0.65);
  font-size: 22px; cursor: pointer; padding: 0 6px;
  border-radius: 6px;
}
.op-identity-popover .oip-close:hover { color: #fff; background: rgba(168,85,247,0.10); }
.op-identity-popover .oip-body { padding: 16px 20px; }
.op-identity-popover .oip-section { margin-bottom: 18px; }
.op-identity-popover .oip-section:last-child { margin-bottom: 0; }
.op-identity-popover .oip-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: #A855F7;
  margin-bottom: 8px;
}
.op-identity-popover .oip-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(196, 184, 216, 0.06);
  font-size: 12px;
}
.op-identity-popover .oip-row:first-child { border-top: 0; }
.op-identity-popover .oip-row-label { color: rgba(196, 184, 216, 0.65); font-weight: 600; }
.op-identity-popover .oip-row-value {
  color: #fff;
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
}
.op-identity-popover .oip-row-value.empty { color: rgba(196, 184, 216, 0.40); }
.op-identity-popover .oip-row-hint {
  grid-column: 1 / -1;
  font-size: 10px; color: rgba(196, 184, 216, 0.40);
  margin-top: 2px;
}
.op-identity-popover .oip-empty {
  color: rgba(196, 184, 216, 0.55); font-size: 12px;
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.05);
  border-radius: 8px;
  border: 1px dashed rgba(168, 85, 247, 0.20);
}
.op-identity-popover .oip-status {
  padding: 10px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.op-identity-popover .oip-status.ok {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.30);
  color: #86EFAC;
}
.op-identity-popover .oip-status.warn {
  background: rgba(236, 72, 153, 0.08);
  border: 1px solid rgba(236, 72, 153, 0.30);
  color: #FBCFE8;
}
.op-identity-popover .oip-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(196, 184, 216, 0.10);
  display: flex; justify-content: flex-end;
}
.op-identity-popover .oip-signout {
  font-size: 12px; font-weight: 700;
  color: #FBCFE8; text-decoration: none;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(236, 72, 153, 0.10);
  border: 1px solid rgba(236, 72, 153, 0.30);
  transition: background 120ms, color 120ms;
}
.op-identity-popover .oip-signout:hover { background: rgba(236, 72, 153, 0.20); color: #fff; }

/* ── RESPONSIVE ────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .op-layout { flex-direction: column; }
  .op-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: 0;
    border-bottom: 1px solid rgba(196, 184, 216, 0.08);
    flex-direction: column;
    padding: 20px 16px 16px;
  }
  .op-sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .op-sidebar-item { flex: 1; min-width: 130px; }
  /* Sub-items collapse to look like regular pills in horizontal mobile mode —
     the indent visual stops making sense outside of a vertical column. */
  .op-sidebar-subitem {
    padding: 9px 12px;
    margin-left: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgba(196, 184, 216, 0.78);
    flex: 1;
    min-width: 130px;
  }
  .op-sidebar-divider { display: none; }
  .op-sidebar-footer { display: none; }
}
