/* ═══════════════════════════════════════════════════════════════════════════
   Myrah NOC Hub — Aurora Noir Design System
   Accent colour is driven by CSS variables injected from client.config.json
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Theme tokens (defaults — overridden by config.js at runtime) ─────────── */
:root {
  --bg:             #0a0f1e;
  --surface:        #0f172a;
  --surface-2:      #1e293b;
  --surface-3:      #27364b;
  --border:         #1e293b;
  --border-strong:  #334155;
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --accent:         #6366f1;
  --accent-light:   #818cf8;
  --accent-dim:     rgba(99,102,241,0.15);
  --green:          #22c55e;
  --green-dim:      rgba(34,197,94,0.15);
  --amber:          #f59e0b;
  --amber-dim:      rgba(245,158,11,0.15);
  --red:            #ef4444;
  --red-dim:        rgba(239,68,68,0.15);
  --blue:           #38bdf8;
  --blue-dim:       rgba(56,189,248,0.15);
  --mono:           'Fira Code', 'Cascadia Code', monospace;
  --radius:         8px;
  --radius-sm:      5px;
  --shadow:         0 4px 24px rgba(0,0,0,0.4);
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.noc-root       { display: flex; flex-direction: column; min-height: 100vh; }
.noc-header     { background: var(--surface); border-bottom: 1px solid var(--border);
                  padding: 0.65rem 1.25rem; display: flex; align-items: center;
                  justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.noc-main       { flex: 1; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.noc-footer     { background: var(--surface); border-top: 1px solid var(--border);
                  padding: 0.6rem 1.25rem; display: flex; align-items: center;
                  justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); }

/* ── Header internals ─────────────────────────────────────────────────────── */
.header-brand   { display: flex; align-items: center; gap: 0.75rem; }
.header-logo    { height: 32px; width: auto; }
.header-name    { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.header-tagline { font-size: 0.7rem; color: var(--text-muted); }
.header-right   { display: flex; align-items: center; gap: 1rem; }
.header-clock   { font-family: var(--mono); font-size: 0.78rem; color: var(--text-secondary); }

/* ── KPI pill strip ───────────────────────────────────────────────────────── */
.kpi-strip      { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.kpi-pill       { display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem;
                  border-radius: 99px; font-size: 0.72rem; font-weight: 600;
                  background: var(--surface-2); border: 1px solid var(--border); }
.kpi-pill.red   { background: var(--red-dim);   border-color: var(--red);   color: #fca5a5; }
.kpi-pill.amber { background: var(--amber-dim); border-color: var(--amber); color: #fde68a; }
.kpi-pill.green { background: var(--green-dim); border-color: var(--green); color: #86efac; }
.kpi-pill.blue  { background: var(--blue-dim);  border-color: var(--blue);  color: #7dd3fc; }
.kpi-dot        { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.kpi-dot.pulse  { animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

/* ── Panel cards ──────────────────────────────────────────────────────────── */
.panel          { background: var(--surface); border: 1px solid var(--border);
                  border-radius: var(--radius); overflow: hidden; }
.panel-header   { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border);
                  display: flex; align-items: center; justify-content: space-between; }
.panel-title    { font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
                  letter-spacing: 0.07em; color: var(--text-secondary); }
.panel-badge    { font-size: 0.65rem; padding: 0.15rem 0.55rem; border-radius: 9px;
                  font-weight: 600; }
.badge-green    { background: var(--green-dim); color: #4ade80; }
.badge-amber    { background: var(--amber-dim); color: #fbbf24; }
.badge-red      { background: var(--red-dim);   color: #f87171; }
.badge-blue     { background: var(--blue-dim);  color: #93c5fd; }
.badge-grey     { background: var(--surface-2); color: var(--text-muted); }
.panel-body     { padding: 0.75rem; }

/* ── Sections grid layout ─────────────────────────────────────────────────── */
.sections-grid        { display: grid; gap: 0.75rem;
                        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.section-panel        { background: var(--surface); border-radius: var(--radius);
                        border: 2px solid var(--border); overflow: hidden; transition: border-color 0.15s; }
.section-panel:hover  { border-color: var(--border-strong); }
.section-panel.ok     { border-left-color: var(--green); }
.section-panel.warn   { border-left-color: var(--amber); }
.section-panel.crit   { border-left-color: var(--red); }
.section-hdr          { padding: 0.6rem 0.8rem; display: flex; align-items: center;
                        justify-content: space-between; border-bottom: 1px solid var(--border); }
.section-icon-label   { display: flex; align-items: center; gap: 0.5rem;
                        font-size: 0.75rem; font-weight: 700; color: var(--text-primary); }
.section-chips        { padding: 0.5rem 0.8rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ── Monitor chips ────────────────────────────────────────────────────────── */
.chip             { display: inline-flex; align-items: center; gap: 0.3rem;
                    padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.65rem;
                    background: var(--surface-2); color: var(--text-secondary);
                    border: 1px solid var(--border); }
.chip-dot         { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.chip-dot.up      { background: var(--green); }
.chip-dot.down    { background: var(--red); animation: pulse-dot 1s infinite; }
.chip-dot.warn    { background: var(--amber); }
.chip-dot.pending { background: var(--text-muted); }

/* ── Cost widget ──────────────────────────────────────────────────────────── */
.cost-bar-track   { background: var(--surface-2); border-radius: 3px; height: 6px;
                    overflow: hidden; margin: 0.4rem 0; }
.cost-bar-fill    { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.cost-row         { display: flex; justify-content: space-between;
                    font-size: 0.7rem; color: var(--text-secondary); }
.cost-amount      { font-family: var(--mono); color: var(--text-primary); font-weight: 600; }

/* ── Alerts feed ──────────────────────────────────────────────────────────── */
.alert-list       { display: flex; flex-direction: column; gap: 0.4rem; max-height: 320px;
                    overflow-y: auto; }
.alert-item       { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0.65rem;
                    border-radius: var(--radius-sm); background: var(--surface-2);
                    border-left: 3px solid var(--border); font-size: 0.72rem;
                    animation: slide-in 0.2s ease; }
.alert-item.crit  { border-left-color: var(--red); }
.alert-item.warn  { border-left-color: var(--amber); }
.alert-item.info  { border-left-color: var(--accent); }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert-sev        { font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.4rem;
                    border-radius: 3px; flex-shrink: 0; }
.alert-sev.crit   { background: var(--red-dim);   color: #fca5a5; }
.alert-sev.warn   { background: var(--amber-dim); color: #fde68a; }
.alert-sev.info   { background: var(--blue-dim);  color: #93c5fd; }
.alert-sev.ok     { background: var(--green-dim); color: #86efac; }
.alert-name       { font-weight: 600; color: var(--text-primary); }
.alert-desc       { color: var(--text-muted); font-size: 0.67rem; margin-top: 1px; }
.alert-age        { font-size: 0.62rem; color: var(--text-muted); flex-shrink: 0; margin-left: auto; }

/* ── Configure alerts CTA button ──────────────────────────────────────────── */
.btn-primary  { display: inline-flex; align-items: center; gap: 0.4rem;
                padding: 0.45rem 1rem; border-radius: var(--radius-sm);
                background: var(--accent); color: #fff; font-size: 0.78rem;
                font-weight: 600; text-decoration: none; border: none; cursor: pointer;
                transition: background 0.15s, transform 0.1s; }
.btn-primary:hover  { background: var(--accent-light); transform: translateY(-1px); }
.btn-outline  { display: inline-flex; align-items: center; gap: 0.4rem;
                padding: 0.35rem 0.85rem; border-radius: var(--radius-sm);
                background: transparent; color: var(--text-secondary);
                border: 1px solid var(--border-strong); font-size: 0.75rem;
                text-decoration: none; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.btn-outline:hover { color: var(--text-primary); border-color: var(--accent); }

/* ── Live indicator ───────────────────────────────────────────────────────── */
.live-dot     { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
                animation: pulse-dot 1.5s infinite; display: inline-block; }
.live-label   { font-size: 0.68rem; color: var(--green); font-weight: 600; }

/* ── Empty + loading states ───────────────────────────────────────────────── */
.empty-state  { padding: 1.5rem; text-align: center; color: var(--text-muted);
                font-size: 0.78rem; }
.skeleton     { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%,
                var(--surface-2) 75%); background-size: 200% 100%;
                animation: shimmer 1.5s infinite; border-radius: 4px; }
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

/* ── AI Assistant widget ──────────────────────────────────────────────────── */
.ai-fab       { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 48px; height: 48px;
                border-radius: 50%; background: var(--accent); color: white;
                border: none; cursor: pointer; font-size: 1.2rem; display: flex;
                align-items: center; justify-content: center;
                box-shadow: var(--shadow); transition: transform 0.2s, background 0.2s;
                z-index: 200; }
.ai-fab:hover { transform: scale(1.1); background: var(--accent-light); }

.ai-panel     { position: fixed; bottom: 4.5rem; right: 1.5rem; width: 360px;
                background: var(--surface); border: 1px solid var(--border-strong);
                border-radius: var(--radius); box-shadow: var(--shadow);
                display: flex; flex-direction: column; z-index: 199;
                max-height: 500px; transition: opacity 0.2s, transform 0.2s; }
.ai-panel.hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }
.ai-panel-hdr { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border);
                display: flex; justify-content: space-between; align-items: center; }
.ai-panel-title { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.ai-close     { background: none; border: none; color: var(--text-muted);
                cursor: pointer; font-size: 1rem; line-height: 1; }
.ai-close:hover { color: var(--text-primary); }
.ai-messages  { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex;
                flex-direction: column; gap: 0.6rem; min-height: 200px; }
.ai-msg       { max-width: 90%; padding: 0.5rem 0.7rem; border-radius: var(--radius-sm);
                font-size: 0.75rem; line-height: 1.5; }
.ai-msg.user  { background: var(--accent-dim); color: var(--text-primary);
                border: 1px solid var(--accent); align-self: flex-end; }
.ai-msg.bot   { background: var(--surface-2); color: var(--text-secondary);
                border: 1px solid var(--border); align-self: flex-start; }
.ai-msg.bot a { color: var(--accent-light); text-decoration: underline; }
.ai-input-row { padding: 0.6rem; border-top: 1px solid var(--border);
                display: flex; gap: 0.4rem; }
.ai-input     { flex: 1; background: var(--surface-2); border: 1px solid var(--border);
                border-radius: var(--radius-sm); padding: 0.4rem 0.6rem;
                color: var(--text-primary); font-size: 0.75rem; outline: none; }
.ai-input:focus { border-color: var(--accent); }
.ai-send      { background: var(--accent); color: white; border: none;
                border-radius: var(--radius-sm); padding: 0.4rem 0.7rem;
                font-size: 0.8rem; cursor: pointer; transition: background 0.15s; }
.ai-send:hover { background: var(--accent-light); }
.ai-typing    { color: var(--text-muted); font-size: 0.7rem; padding: 0.5rem; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .noc-main   { padding: 0.75rem; }
  .ai-panel   { width: calc(100vw - 2rem); right: 1rem; }
  .sections-grid { grid-template-columns: 1fr; }
}
