/* ============================================================
   HCK DASHBOARD — Design System & Core Styles
   Premium Cyberpunk / Hacker Aesthetic
   ============================================================ */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111627;
  --bg-tertiary: #161b2e;
  --bg-card: rgba(17, 22, 39, 0.8);
  --bg-sidebar: rgba(10, 14, 26, 0.95);
  --bg-input: rgba(17, 22, 39, 0.6);
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: rgba(0, 212, 255, 0.15);
  --accent-magenta: #ff006e;
  --accent-magenta-dim: rgba(255, 0, 110, 0.15);
  --accent-green: #00ff88;
  --accent-green-dim: rgba(0, 255, 136, 0.15);
  --accent-amber: #ffb800;
  --accent-amber-dim: rgba(255, 184, 0, 0.15);
  --accent-red: #ff3366;
  --accent-red-dim: rgba(255, 51, 102, 0.15);
  --text-primary: #e8eaf6;
  --text-secondary: #8892b0;
  --text-muted: #4a5568;
  --text-inverse: #0a0e1a;
  --border-color: rgba(0, 212, 255, 0.1);
  --border-hover: rgba(0, 212, 255, 0.3);
  --glass-bg: rgba(17, 22, 39, 0.6);
  --glass-border: rgba(0, 212, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-magenta: 0 0 20px rgba(255, 0, 110, 0.3);
  --glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
  --glow-red: 0 0 20px rgba(255, 51, 102, 0.3);
  --overlay-bg: rgba(5, 7, 15, 0.8);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  /* Spacing */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* ── Base Reset ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1224 40%, var(--bg-secondary) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Subtle scan-line effect */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Scrollbar Styling ────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p {
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

a:hover {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-cyan);
  border: 1px solid var(--border-color);
}

pre {
  background: var(--bg-card);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

small {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

::selection {
  background: rgba(0, 212, 255, 0.3);
  color: var(--text-primary);
}

/* ── Layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: var(--z-base);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl);
  transition: margin-left var(--transition-base);
  min-height: 100vh;
  position: relative;
}

.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed);
}

.view-container {
  animation: fadeIn 0.3s ease;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: width var(--transition-base);
  overflow: hidden;
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  min-height: 72px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--bg-primary);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.sidebar-logo::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta), var(--accent-cyan));
  background-size: 200% 200%;
  border-radius: var(--radius-md);
  z-index: -1;
  animation: borderGlow 3s ease-in-out infinite;
}

.sidebar-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  overflow-y: auto;
}

.nav-section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-md) var(--space-sm) var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-secondary);
  position: relative;
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--accent-cyan-dim);
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.1);
}

.nav-item.active {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border-color: rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-cyan);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.nav-item svg,
.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.nav-item .nav-text {
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-item .nav-text {
  opacity: 0;
  pointer-events: none;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-magenta);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

.sidebar-collapsed .nav-item .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  margin: 0;
  padding: 0;
  width: 8px;
  height: 8px;
  min-width: 8px;
  font-size: 0;
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--glass-border);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
}

.sidebar-toggle:hover {
  background: var(--accent-cyan-dim);
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.2);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-base);
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.page-header h1 {
  font-size: var(--fs-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.page-header h1 .header-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled::before {
  display: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
  font-weight: var(--fw-semibold);
}

.btn-primary::before {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 153, 204, 0.2));
}

.btn-primary:hover {
  box-shadow: var(--glow-cyan), inset 0 0 20px rgba(0, 212, 255, 0.1);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #cc2952);
  color: white;
  border-color: var(--accent-red);
}

.btn-danger::before {
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.2), rgba(204, 41, 82, 0.2));
}

.btn-danger:hover {
  box-shadow: var(--glow-red);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #00cc6a);
  color: var(--bg-primary);
  border-color: var(--accent-green);
  font-weight: var(--fw-semibold);
}

.btn-success::before {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 106, 0.2));
}

.btn-success:hover {
  box-shadow: var(--glow-green);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: var(--accent-cyan-dim);
  color: var(--text-primary);
  border-color: rgba(0, 212, 255, 0.3);
}

.btn-icon {
  padding: var(--space-sm);
  width: 36px;
  height: 36px;
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--fs-md);
  border-radius: var(--radius-lg);
}

/* ── Inputs ───────────────────────────────────────────────── */
.input,
.select,
.textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-base);
  backdrop-filter: blur(8px);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), var(--glow-cyan);
}

.input::placeholder {
  color: var(--text-muted);
}

.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-group .input {
  padding-left: calc(var(--space-md) + 26px);
}

.select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238892b0' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-running {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge-running::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.badge-stopped {
  background: rgba(74, 85, 104, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(74, 85, 104, 0.2);
}

.badge-error {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(255, 51, 102, 0.2);
}

.badge-error::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-red);
  animation: pulse 1.5s ease-in-out infinite;
}

.badge-installing {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
  border: 1px solid rgba(255, 184, 0, 0.2);
}

.badge-installing::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-amber);
  animation: pulse 1s ease-in-out infinite;
}

.badge-category {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.15);
  font-size: var(--fs-xs);
}

.badge-update {
  background: var(--accent-magenta-dim);
  color: var(--accent-magenta);
  border: 1px solid rgba(255, 0, 110, 0.2);
}

/* ── Cards (base) ─────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--glass-shadow), 0 0 30px rgba(0, 212, 255, 0.08);
}

.card:hover::before {
  opacity: 1;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.2s ease;
  padding: var(--space-lg);
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), var(--glow-cyan);
  width: 100%;
  max-width: 480px;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta), var(--accent-cyan));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

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

.modal-header h3 {
  font-size: var(--fs-lg);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  border-top: 1px solid var(--glass-border);
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: var(--z-toast);
  pointer-events: none;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  min-width: 300px;
}

.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast-info::before { background: var(--accent-cyan); }
.toast-success::before { background: var(--accent-green); }
.toast-warning::before { background: var(--accent-amber); }
.toast-error::before { background: var(--accent-red); }

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-info .toast-icon { color: var(--accent-cyan); }
.toast-success .toast-icon { color: var(--accent-green); }
.toast-warning .toast-icon { color: var(--accent-amber); }
.toast-error .toast-icon { color: var(--accent-red); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  animation: toastProgress 5s linear forwards;
}

.toast-info .toast-progress { background: var(--accent-cyan); }
.toast-success .toast-progress { background: var(--accent-green); }
.toast-warning .toast-progress { background: var(--accent-amber); }
.toast-error .toast-progress { background: var(--accent-red); }

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--text-secondary);
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  transition: width var(--transition-base);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
}

.progress-indeterminate .progress-fill {
  width: 30% !important;
  animation: indeterminate 1.5s ease-in-out infinite;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  min-height: 300px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: var(--space-lg);
}

/* ── Utility Classes ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-magenta { color: var(--accent-magenta); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: var(--fw-medium); }
.font-semibold { font-weight: var(--fw-semibold); }
.font-bold { font-weight: var(--fw-bold); }
.w-full { width: 100%; }
.relative { position: relative; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  padding: 4px 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ── Keyframe Animations ──────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 currentColor; }
  50% { transform: scale(1.1); box-shadow: 0 0 0 6px transparent; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

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

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes borderRotate {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}

@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content {
    margin-left: var(--sidebar-collapsed);
    padding: var(--space-lg);
  }

  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .sidebar-title,
  .sidebar .nav-text,
  .sidebar .nav-section-label {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar .nav-item .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin: 0;
    padding: 0;
    width: 8px;
    height: 8px;
    min-width: 8px;
    font-size: 0;
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding: var(--space-md);
    padding-bottom: 80px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100% !important;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--glass-border);
  }

  .sidebar-header,
  .sidebar-footer,
  .nav-section-label {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    padding: var(--space-sm);
    gap: 0;
  }

  .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--fs-xs);
  }

  .nav-item .nav-text {
    opacity: 1 !important;
    font-size: 10px;
  }

  .nav-item.active::before {
    display: none;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    max-width: none;
  }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .sidebar,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  body {
    background: white;
    color: black;
  }
}
