/**
 * MC Hybrid Migration — Shared Components (Phase 1)
 *
 * All .hy-* prefixed and bare-class component styles.
 * Requires tokens.css to be loaded first.
 * No pages reference this file until Phase 2.
 *
 * Sources: approved pattern-library mockup + v2 plan §2.3
 */

/* ═══════════════════════════════════════
   Glass Card
   ═══════════════════════════════════════ */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: var(--hy-radius);
  padding: var(--hy-space-5);
  transition: background 0.2s, border-color 0.2s;
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(148, 163, 184, 0.2);
}

/* ─── Metric card variant ─── */
.metric-card {
  min-width: 160px;
  text-align: center;
}
.metric-card .metric-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}
.metric-card .metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--hy-space-1);
}
.metric-card .metric-delta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-top: var(--hy-space-2);
}
.metric-delta.up { color: var(--status-online); }
.metric-delta.down { color: var(--status-error); }

/* ─── Sidebar row variant ─── */
.sidebar-row {
  display: flex;
  align-items: center;
  gap: var(--hy-space-3);
  padding: var(--hy-space-3) var(--hy-space-4);
  cursor: pointer;
}
.sidebar-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.online { background: var(--status-online); }
.dot.offline { background: var(--status-idle); }
.dot.active { background: var(--status-active); }
.dot.pulse { animation: dot-breathe 2s ease-in-out infinite; }
.sidebar-row .agent-name { font-size: 0.85rem; font-weight: 500; }
.sidebar-row .agent-role { font-size: 0.7rem; color: var(--text-dim); }

/* ─── Detail panel variant ─── */
.detail-panel { max-width: 400px; }
.detail-panel .detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--hy-space-4);
}
.detail-panel .detail-title { font-weight: 600; font-size: 0.95rem; }

/* ─── Activity ticker ─── */
.ticker-strip {
  display: flex;
  gap: var(--hy-space-3);
  overflow-x: auto;
  padding: var(--hy-space-3);
  scrollbar-width: none;
}
.ticker-strip::-webkit-scrollbar { display: none; }
.ticker-item {
  flex-shrink: 0;
  padding: var(--hy-space-2) var(--hy-space-3);
  font-size: 0.75rem;
  white-space: nowrap;
}
.ticker-item .ticker-time {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

/* ═══════════════════════════════════════
   Status Pill
   ═══════════════════════════════════════ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--hy-space-1);
  padding: 2px var(--hy-space-3);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pill.idle { background: rgba(107, 114, 128, 0.2); color: #9ca3b0; }
.status-pill.idle .pill-dot { background: var(--status-idle); }
.status-pill.healthy { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-pill.healthy .pill-dot { background: var(--status-online); }
.status-pill.active { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.status-pill.active .pill-dot { background: var(--status-active); animation: pm-pulse 2s ease-in-out infinite; }
.status-pill.warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.status-pill.warn .pill-dot { background: var(--status-warn); animation: pm-pulse 1.5s ease-in-out infinite; }
.status-pill.failed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.status-pill.failed .pill-dot { background: var(--status-error); animation: pulse-glow-red 1.5s ease-in-out infinite; }
.status-pill.done { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-pill.done .pill-dot { background: var(--status-done); }

/* ═══════════════════════════════════════
   Buttons
   ═══════════════════════════════════════ */
.hy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--hy-space-2);
  padding: var(--hy-space-2) var(--hy-space-5);
  border-radius: var(--hy-radius);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
/* --hy-brand usage 1/2: primary CTA background + border */
.hy-btn.primary {
  background: var(--hy-brand);
  color: #fff;
  border-color: var(--hy-brand);
}
.hy-btn.primary:hover { filter: brightness(1.1); }
.hy-btn.secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}
.hy-btn.secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.hy-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.hy-btn.danger:hover { background: rgba(239, 68, 68, 0.25); }
.hy-btn.success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}
.hy-btn.success:hover { background: rgba(16, 185, 129, 0.25); }

/* ═══════════════════════════════════════
   Form Inputs
   ═══════════════════════════════════════ */
.hy-input, .hy-select, .hy-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--hy-radius);
  color: var(--text-primary);
  padding: var(--hy-space-2) var(--hy-space-3);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
  width: 100%;
}
.hy-input:focus, .hy-select:focus, .hy-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.hy-textarea { min-height: 80px; resize: vertical; }
.hy-select { appearance: none; cursor: pointer; }
.hy-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--hy-space-1);
  font-weight: 500;
}
.hy-checkbox, .hy-radio {
  display: flex;
  align-items: center;
  gap: var(--hy-space-2);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
/* --hy-brand usage: checkbox/radio accent */
.hy-checkbox input, .hy-radio input {
  accent-color: var(--hy-brand);
  width: 16px;
  height: 16px;
}

/* ═══════════════════════════════════════
   Table
   ═══════════════════════════════════════ */
.hy-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}
.hy-table thead th {
  text-align: left;
  padding: var(--hy-space-3) var(--hy-space-4);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.hy-table tbody td {
  padding: var(--hy-space-3) var(--hy-space-4);
  border-bottom: 1px solid rgba(71, 85, 105, 0.2);
  color: var(--text-secondary);
}
.hy-table tbody tr:hover td { background: var(--bg-card-hover); }
.hy-table .mono { font-family: var(--font-mono); font-size: 0.75rem; }

/* ═══════════════════════════════════════
   Modal (§7.5: solid bg, NO glass on panel)
   ═══════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
/* modal-panel: opaque bg per §7.5 — NO backdrop-filter here */
.modal-panel {
  background: var(--bg-card-solid);
  border: var(--glass-border);
  border-radius: var(--hy-radius);
  padding: var(--hy-space-6);
  max-width: 480px;
  width: 90%;
  position: relative;
  box-shadow: var(--glass-shadow);
}
.modal-close {
  position: absolute;
  top: var(--hy-space-3);
  right: var(--hy-space-3);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: var(--hy-space-1);
}
.modal-close:hover { color: var(--text-primary); }
.modal-title { font-weight: 600; font-size: 1rem; margin-bottom: var(--hy-space-4); }

/* ═══════════════════════════════════════
   Tooltip
   ═══════════════════════════════════════ */
.hy-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-solid);
  border: var(--glass-border);
  border-radius: 8px;
  padding: var(--hy-space-2) var(--hy-space-3);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}
.hy-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--bg-card-solid);
}

/* ═══════════════════════════════════════
   Toast (§7.5: solid bg, NO backdrop-filter)
   ═══════════════════════════════════════ */
.hy-toast {
  display: inline-flex;
  align-items: center;
  gap: var(--hy-space-3);
  background: var(--bg-card-solid);
  border: var(--glass-border);
  border-radius: var(--hy-radius);
  padding: var(--hy-space-3) var(--hy-space-5);
  font-size: 0.8rem;
  box-shadow: var(--glass-shadow);
}
.toast-icon { font-size: 1rem; }
.toast-success .toast-icon { color: var(--status-online); }
.toast-error .toast-icon { color: var(--status-error); }
.toast-warn .toast-icon { color: var(--status-warn); }

/* ═══════════════════════════════════════
   Loading States
   ═══════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(51, 65, 85, 0.4) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-line { height: 12px; margin-bottom: var(--hy-space-2); }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

.hy-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: var(--hy-space-7);
  color: var(--text-dim);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: var(--hy-space-4); opacity: 0.4; }
.empty-state .empty-title { font-size: 0.95rem; color: var(--text-muted); margin-bottom: var(--hy-space-2); }
.empty-state .empty-desc { font-size: 0.8rem; }

/* ═══════════════════════════════════════
   Nav Item
   ═══════════════════════════════════════ */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--hy-space-3);
  padding: var(--hy-space-3) var(--hy-space-4);
  border-radius: var(--hy-radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
/* --hy-brand usage 2/2: nav-item active left-bar indicator */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--hy-brand);
  border-radius: 0 3px 3px 0;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.85rem; }

/* ═══════════════════════════════════════
   Typography helpers
   ═══════════════════════════════════════ */
.type-h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.type-h2 { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); }
.type-h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); }
.type-body { font-size: 0.85rem; color: var(--text-secondary); }
.type-caption { font-size: 0.75rem; color: var(--text-muted); }
.type-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   Keyframes
   ═══════════════════════════════════════ */
@keyframes pm-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px transparent; }
}

@keyframes dot-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.2); }
}

@keyframes pulse-glow-red {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 6px 2px rgba(239, 68, 68, 0.3); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}
