/* ── Director's Chair — Shared Styles ── */

:root {
  --bg-deep: hsl(220, 35%, 8%);
  --bg-mid: hsl(220, 30%, 12%);
  --bg-surface: hsl(220, 25%, 16%);
  --bg-elevated: hsl(220, 22%, 22%);
  --bg-hover: hsl(220, 20%, 26%);

  --text-primary: hsl(220, 20%, 90%);
  --text-secondary: hsl(220, 15%, 65%);
  --text-muted: hsl(220, 10%, 45%);

  --blue: hsl(210, 80%, 60%);
  --green: hsl(155, 65%, 45%);
  --amber: hsl(38, 95%, 60%);
  --purple: hsl(270, 60%, 65%);
  --red: hsl(0, 70%, 55%);
  --cyan: hsl(185, 60%, 50%);

  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.card-body { padding: 16px 18px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-blue { background: hsla(210, 80%, 60%, 0.15); color: var(--blue); }
.badge-green { background: hsla(155, 65%, 45%, 0.15); color: var(--green); }
.badge-amber { background: hsla(38, 95%, 60%, 0.15); color: var(--amber); }
.badge-purple { background: hsla(270, 60%, 65%, 0.15); color: var(--purple); }
.badge-red { background: hsla(0, 70%, 55%, 0.15); color: var(--red); }
.badge-cyan { background: hsla(185, 60%, 50%, 0.15); color: var(--cyan); }

/* ── Status Dots ── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

/* ── Metrics ── */
.metric-card {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════
   Glass Header (Affirm-style floating pill)
   ══════════════════════════════════════════════ */

.glass-header {
  position: sticky;
  top: 12px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 24px;
  border-radius: 999px;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(31, 31, 49, 0.72) 0%, rgba(22, 22, 38, 0.84) 100%);
  border: 1px solid hsla(185, 40%, 40%, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  margin-bottom: 48px;
}

.glass-header.content-with-sidebar {
  margin: 12px 16px 0 calc(56px + 16px);
}

.content-with-sidebar > .glass-header {
  margin: 12px 16px 0 16px;
}

.glass-header::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    transparent 28%,
    rgba(255,255,255,0.00) 36%,
    rgba(255,255,255,0.10) 46%,
    rgba(255,255,255,0.18) 50%,
    rgba(255,255,255,0.10) 54%,
    rgba(255,255,255,0.00) 64%,
    transparent 72%
  );
  transform: translateX(-130%);
  animation: glassSheen 6.4s ease-in-out infinite;
  pointer-events: none;
}

.glass-header::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  opacity: 0.8;
  pointer-events: none;
}

@keyframes glassSheen {
  0%   { transform: translateX(-130%); opacity: 0; }
  12%  { opacity: 1; }
  52%  { transform: translateX(130%); opacity: 1; }
  100% { transform: translateX(130%); opacity: 0; }
}

@media (max-width: 768px) {
  .glass-header.content-with-sidebar,
  .content-with-sidebar > .glass-header {
    margin: 8px 8px 0;
    padding: 8px 16px;
  }
}

/* ── Animations ── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

/* ── Layout ── */
.content-with-sidebar {
  margin-left: 56px;
  transition: margin-left 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
  .content-with-sidebar { margin-left: 0; }
  .desktop-only { display: none !important; }
}

/* ══════════════════════════════════════════════
   Sidebar Navigation
   ══════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  width: 56px;
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar:hover,
.sidebar.expanded {
  width: 280px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  transition: opacity 300ms;
}

.sidebar-hamburger {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 55;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-mid);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 200ms;
}
.sidebar-hamburger:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Nav items */
.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  border-radius: 8px;
  transition: all 150ms;
  text-decoration: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.sidebar-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.sidebar-nav-item.active {
  color: var(--cyan);
  background: hsla(185, 60%, 50%, 0.1);
}

.sidebar-active-bar {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: var(--cyan);
}

/* Tooltips (collapsed only) */
.sidebar-tooltip {
  position: absolute;
  left: 100%;
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 60;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms;
}
.sidebar-nav-item:hover .sidebar-tooltip { opacity: 1; }
.sidebar-tooltip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -4px;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

/* ── Sidebar Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-hamburger { display: flex; }
  .sidebar-tooltip { display: none; }
}

@media (min-width: 769px) {
  .sidebar-backdrop { display: none !important; }
}

/* ══════════════════════════════════════════════
   Toast Notifications
   ══════════════════════════════════════════════ */

.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 100;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}
.toast-success { background: hsla(155, 65%, 45%, 0.15); border: 1px solid var(--green); color: var(--green); }
.toast-info    { background: hsla(210, 80%, 60%, 0.15); border: 1px solid var(--blue); color: var(--blue); }
.toast-warning { background: hsla(38, 95%, 60%, 0.15); border: 1px solid var(--amber); color: var(--amber); }
.toast-error   { background: hsla(0, 70%, 55%, 0.15); border: 1px solid var(--red); color: var(--red); }

/* ══════════════════════════════════════════════
   Tab Navigation
   ══════════════════════════════════════════════ */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
}

.tab-nav-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms, border-color 150ms;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-nav-item:hover { color: var(--text-primary); }
.tab-nav-item.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

/* ══════════════════════════════════════════════
   Search Input
   ══════════════════════════════════════════════ */

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 150ms;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--blue); }

.search-wrapper {
  position: relative;
}
.search-wrapper svg,
.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   Markdown Content
   ══════════════════════════════════════════════ */

.markdown-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}
.markdown-body h1 { font-size: 1.6em; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.3em; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.25em; }
.markdown-body h3 { font-size: 1.1em; }
.markdown-body h4 { font-size: 1em; }

.markdown-body p { margin-bottom: 0.75em; }

.markdown-body a {
  color: var(--blue);
  text-decoration: none;
}
.markdown-body a:hover { text-decoration: underline; }

.markdown-body strong { font-weight: 600; color: var(--text-primary); }
.markdown-body em { font-style: italic; }

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em;
  margin-bottom: 0.75em;
}
.markdown-body li { margin-bottom: 0.25em; }
.markdown-body li > ul,
.markdown-body li > ol { margin-bottom: 0; }

.markdown-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--cyan);
}

.markdown-body pre {
  margin-bottom: 0.75em;
  border-radius: 8px;
  overflow-x: auto;
  background: var(--bg-deep);
  border: 1px solid var(--glass-border);
}

.markdown-body pre code {
  display: block;
  padding: 14px 18px;
  background: none;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.6;
}

.markdown-body blockquote {
  border-left: 3px solid var(--blue);
  padding: 4px 16px;
  margin: 0 0 0.75em 0;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 4px 4px 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1.5em 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75em;
  font-size: 13px;
}
.markdown-body th,
.markdown-body td {
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  text-align: left;
}
.markdown-body th {
  background: var(--bg-elevated);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.markdown-body td { color: var(--text-primary); }

.markdown-body img { max-width: 100%; border-radius: 8px; }
