/* style.css — Agent Hub Dashboard Design Tokens & Components */

/* ═══════════════════════════════════════════════
   FONTS
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ═══════════════════════════════════════════════
   TYPE SCALE
   ═══════════════════════════════════════════════ */

:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
}

/* ═══════════════════════════════════════════════
   SPACING (4px base)
   ═══════════════════════════════════════════════ */

:root {
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;
}

/* ═══════════════════════════════════════════════
   COLOR — DARK FIRST (Nexus palette)
   ═══════════════════════════════════════════════ */

:root, [data-theme="dark"] {
  --color-bg:               #131215;
  --color-surface:          #1a191d;
  --color-surface-2:        #201f23;
  --color-surface-offset:   #1d1c20;
  --color-surface-offset-2: #242328;
  --color-surface-dynamic:  #2d2c30;
  --color-divider:          #2a292d;
  --color-border:           #363539;

  --color-text:             #cdccca;
  --color-text-muted:       #797876;
  --color-text-faint:       #504f53;
  --color-text-inverse:     #131215;

  /* Primary Accent — Teal */
  --color-primary:          #4f98a3;
  --color-primary-hover:    #227f8b;
  --color-primary-active:   #1a626b;
  --color-primary-highlight: #1e2e30;

  /* Success — Green */
  --color-success:          #6daa45;
  --color-success-hover:    #4d8f25;
  --color-success-highlight: #1e2a19;

  /* Warning — Amber */
  --color-warning:          #bb653b;
  --color-warning-hover:    #b95525;
  --color-warning-highlight: #2a2019;

  /* Error */
  --color-error:            #d163a7;
  --color-error-hover:      #b9478f;

  /* Shadows — dark mode */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

/* ═══════════════════════════════════════════════
   LIGHT MODE
   ═══════════════════════════════════════════════ */

[data-theme="light"] {
  --color-bg:               #f7f6f2;
  --color-surface:          #ffffff;
  --color-surface-2:        #fbfbf9;
  --color-surface-offset:   #f3f0ec;
  --color-surface-offset-2: #edeae5;
  --color-surface-dynamic:  #e6e4df;
  --color-divider:          #dcd9d5;
  --color-border:           #d4d1ca;

  --color-text:             #28251d;
  --color-text-muted:       #7a7974;
  --color-text-faint:       #bab9b4;
  --color-text-inverse:     #f9f8f4;

  --color-primary:          #01696f;
  --color-primary-hover:    #0c4e54;
  --color-primary-active:   #0f3638;
  --color-primary-highlight: #cedcd8;

  --color-success:          #437a22;
  --color-success-hover:    #2e5c10;
  --color-success-highlight: #d4dfcc;

  --color-warning:          #964219;
  --color-warning-hover:    #713417;
  --color-warning-highlight: #ddcfc6;

  --color-error:            #a12c7b;
  --color-error-hover:      #7d1e5e;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg:               #f7f6f2;
    --color-surface:          #ffffff;
    --color-surface-2:        #fbfbf9;
    --color-surface-offset:   #f3f0ec;
    --color-surface-offset-2: #edeae5;
    --color-surface-dynamic:  #e6e4df;
    --color-divider:          #dcd9d5;
    --color-border:           #d4d1ca;
    --color-text:             #28251d;
    --color-text-muted:       #7a7974;
    --color-text-faint:       #bab9b4;
    --color-text-inverse:     #f9f8f4;
    --color-primary:          #01696f;
    --color-primary-hover:    #0c4e54;
    --color-primary-active:   #0f3638;
    --color-primary-highlight: #cedcd8;
    --color-success:          #437a22;
    --color-success-hover:    #2e5c10;
    --color-success-highlight: #d4dfcc;
    --color-warning:          #964219;
    --color-warning-hover:    #713417;
    --color-warning-highlight: #ddcfc6;
    --color-error:            #a12c7b;
    --color-error-hover:      #7d1e5e;
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
  }
}

/* ═══════════════════════════════════════════════
   COMPONENT STYLES
   ═══════════════════════════════════════════════ */

/* ---- Status Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.pill--running,
.pill--active,
.pill--connected {
  background: oklch(from var(--color-success) l c h / 0.12);
  color: var(--color-success);
}

.pill--completed {
  background: oklch(from var(--color-text-muted) l c h / 0.12);
  color: var(--color-text-muted);
}

.pill--degraded,
.pill--amber {
  background: oklch(from var(--color-warning) l c h / 0.12);
  color: var(--color-warning);
}

.pill--checking {
  background: oklch(from var(--color-text-faint) l c h / 0.12);
  color: var(--color-text-faint);
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.pill--running .pill__dot,
.pill--active .pill__dot,
.pill--connected .pill__dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card--kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.card__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.card__value {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.card__meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-interactive),
              color var(--transition-interactive),
              border-color var(--transition-interactive);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn--ghost:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.btn--icon {
  padding: var(--space-2);
  width: 2rem;
  height: 2rem;
}

/* ---- Endpoint Tags ---- */
.endpoint-tag {
  display: inline-flex;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ---- Utility ---- */
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
