/* ============================================================
   0ARCH Tools — NERV/Cyberpunk Design System
   Ported from 0arch.io main site.
   Red on black. Scanlines. HUD brackets. Terminal aesthetic.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Barlow+Condensed:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
  /* ---- Dark Palette ---- */
  --bg-primary: #0a0a0a;
  --bg-secondary: #0d0d0d;
  --bg-tertiary: #111111;
  --bg-hover: #1a1a1a;
  --bg-elevated: rgba(13, 13, 13, 0.95);

  /* ---- NERV Red ---- */
  --accent: #cc0000;
  --accent-hover: #ff0000;
  --accent-muted: rgba(204, 0, 0, 0.08);
  --accent-glow: rgba(204, 0, 0, 0.25);
  --accent-border: rgba(204, 0, 0, 0.25);

  /* ---- Status ---- */
  --success: #22c55e;
  --warning: #ff6a00;
  --error: #ff0000;

  /* ---- Text ---- */
  --text-primary: #e0e0e0;
  --text-secondary: #999999;
  --text-tertiary: #666666;

  /* ---- Borders ---- */
  --border: rgba(204, 0, 0, 0.15);
  --border-hover: rgba(204, 0, 0, 0.35);

  /* ---- Edge (legacy compat) ---- */
  --edge-light: rgba(204, 0, 0, 0.12);
  --edge-dark: rgba(204, 0, 0, 0.20);
  --edge-darker: rgba(204, 0, 0, 0.30);

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 15px rgba(204, 0, 0, 0.15);

  /* ---- Radii (minimal — brutalist) ---- */
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;

  /* ---- Typography ---- */
  --font-sans: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;

  /* ---- Layout ---- */
  --sidebar-width: 250px;
  --sidebar-collapsed: 64px;
  --topbar-height: 42px;
  --transition: 150ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Scanlines Overlay ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
}

/* ---- Grain/Noise Overlay ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, 2px); }
  100% { transform: translate(0, 0); }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

::selection {
  background: rgba(204, 0, 0, 0.30);
  color: #fff;
}

/* ---- Scrollbar (Dark + Red) ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: rgba(204, 0, 0, 0.3);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: rgba(204, 0, 0, 0.5); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes scanMove {
  0% { top: -2px; }
  100% { top: calc(100% + 2px); }
}

@keyframes glitch-1 {
  0%, 100% { clip-path: inset(0 0 96% 0); transform: translate(0); }
  10% { clip-path: inset(20% 0 60% 0); transform: translate(-2px, 1px); }
  20% { clip-path: inset(55% 0 20% 0); transform: translate(2px, -1px); }
  30% { clip-path: inset(80% 0 5% 0); transform: translate(-1px); }
  40%, 100% { clip-path: inset(0 0 100% 0); transform: translate(0); }
}

@keyframes glitch-2 {
  0%, 100% { clip-path: inset(0 0 96% 0); transform: translate(0); }
  15% { clip-path: inset(40% 0 30% 0); transform: translate(2px, -1px); }
  25% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, 1px); }
  35% { clip-path: inset(70% 0 10% 0); transform: translate(1px); }
  45%, 100% { clip-path: inset(0 0 100% 0); transform: translate(0); }
}

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

@keyframes hazardScroll {
  0% { background-position: 0 0; }
  100% { background-position: 24px 0; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR — NERV Command Panel
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  position: relative;
}

/* Hazard stripe under sidebar header */
.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0,
    var(--accent) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.4;
  animation: hazardScroll 1s linear infinite;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-logo span {
  color: var(--accent);
  font-weight: 900;
}

.sidebar-badge {
  font-size: 0.55rem;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--accent);
  background: transparent;
  padding: 2px 6px;
  letter-spacing: 2px;
  border: 1px solid var(--accent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 8px 8px;
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  padding: 0 10px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  opacity: 0.8;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(204, 0, 0, 0.06);
  color: var(--text-primary);
  border-left-color: rgba(204, 0, 0, 0.3);
}

.sidebar-link.active {
  background: rgba(204, 0, 0, 0.10);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-link svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
  flex-shrink: 0;
  opacity: 0.5;
}

.sidebar-link.active svg { opacity: 1; color: var(--accent); }

.sidebar-link .tool-count {
  margin-left: auto;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-primary);
  padding: 1px 5px;
  border: 1px solid var(--border);
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: rgba(204, 0, 0, 0.06);
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  background: rgba(204, 0, 0, 0.15);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--accent);
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.5px;
}

.sidebar-user-email {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition);
}

/* ============================================================
   TOP BAR — NERV Status Bar
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.topbar-breadcrumb {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.topbar-breadcrumb span {
  color: var(--accent);
  font-weight: 400;
}

.topbar-spacer { flex: 1; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 4px 12px;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 180px;
}

.topbar-search:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.15);
}

.topbar-search svg {
  width: 13px;
  height: 13px;
  color: var(--text-tertiary);
}

.topbar-search span {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.topbar-search kbd {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 1px 5px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  padding: 28px 28px;
  max-width: 1200px;
  animation: fadeIn 400ms ease;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-header p {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* ============================================================
   CATEGORY HEADERS — Classification/Division Labels
   ============================================================ */
.category-title {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Red tick mark before category */
.category-title::before {
  content: '//';
  margin-right: 8px;
  opacity: 0.5;
}

/* ============================================================
   TOOL CARDS GRID — HUD Bracket Cards
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

/* HUD bracket — top-left */
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  opacity: 0.5;
  transition: all 300ms ease;
}

/* HUD bracket — bottom-right */
.tool-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  opacity: 0.5;
  transition: all 300ms ease;
}

.tool-card:hover {
  border-color: rgba(204, 0, 0, 0.4);
  box-shadow: 0 0 20px rgba(204, 0, 0, 0.08), inset 0 0 20px rgba(204, 0, 0, 0.03);
}

.tool-card:hover::before {
  width: 22px;
  height: 22px;
  opacity: 1;
}

.tool-card:hover::after {
  width: 22px;
  height: 22px;
  opacity: 1;
}

.tool-card:active {
  transform: scale(0.99);
}

.tool-card-icon {
  width: 34px;
  height: 34px;
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.tool-card-icon svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.tool-card h3 {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.tool-card p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
  font-family: var(--font-sans);
}

.tool-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 400;
  padding: 2px 6px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.tool-card-badge.client {
  color: var(--success);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.tool-card-badge.server {
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
}

/* ============================================================
   TOOL PAGE LAYOUT
   ============================================================ */
.tool-layout {
  max-width: 900px;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.tool-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(204, 0, 0, 0.08);
  border: 1px solid rgba(204, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-header-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.tool-header h1 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.tool-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
  font-family: var(--font-sans);
  letter-spacing: 0.3px;
}

/* ============================================================
   INPUT/OUTPUT PANELS — Terminal Windows
   ============================================================ */
.tool-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 14px;
  position: relative;
}

.tool-panel-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

/* Terminal status dot instead of Mac dots */
.tool-panel-header::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: statusBlink 2s infinite;
  box-shadow: 0 0 4px rgba(204, 0, 0, 0.5);
}

.tool-panel-title {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.tool-panel-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.tool-panel-body {
  padding: 12px;
  background: var(--bg-secondary);
}

.tool-textarea {
  width: 100%;
  min-height: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--transition);
  caret-color: var(--accent);
}

.tool-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(204, 0, 0, 0.1);
}

.tool-textarea::placeholder {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.tool-output {
  width: 100%;
  min-height: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================
   BUTTONS — NERV Style (outline with fill on hover)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform 200ms ease;
  z-index: -1;
}

.btn-primary:hover {
  color: #000;
}

.btn-primary:hover::before {
  transform: translateX(0);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.btn-sm {
  padding: 3px 8px;
  font-size: 0.65rem;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 0.78rem;
  letter-spacing: 1.5px;
}

/* ============================================================
   FILE DROP ZONE
   ============================================================ */
.dropzone {
  border: 1px dashed rgba(204, 0, 0, 0.3);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-primary);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(204, 0, 0, 0.04);
  box-shadow: inset 0 0 30px rgba(204, 0, 0, 0.05);
}

.dropzone svg {
  width: 36px;
  height: 36px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.dropzone.dragover svg { color: var(--accent); }

.dropzone p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dropzone span {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 200ms ease;
  min-width: 220px;
  letter-spacing: 0.5px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--accent); }

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

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 300ms ease;
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.4);
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
.status-dot.processing {
  background: var(--warning);
  animation: statusBlink 1.5s infinite;
  box-shadow: 0 0 4px rgba(255, 106, 0, 0.5);
}
.status-dot.error {
  background: var(--error);
  box-shadow: 0 0 4px rgba(255, 0, 0, 0.5);
}

/* ============================================================
   SEARCH MODAL (Cmd+K)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 20px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 16px;
  width: 100%;
  max-width: 460px;
  max-height: 55vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(204, 0, 0, 0.1);
  position: relative;
}

/* HUD brackets on modal */
.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}

.modal::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.search-modal-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-family: var(--font-mono);
  caret-color: var(--accent);
}

.search-modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.15);
}

.search-modal-input::placeholder {
  color: var(--text-tertiary);
}

.search-results {
  margin-top: 8px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background var(--transition);
  border-left: 2px solid transparent;
}

.search-result-item:hover {
  background: rgba(204, 0, 0, 0.06);
  border-left-color: var(--accent);
}

.search-result-item svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  opacity: 0.7;
}

.search-result-item span {
  font-size: 0.82rem;
  font-family: var(--font-sans);
  letter-spacing: 0.3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 6px;
}

.mobile-menu-btn svg {
  width: 18px;
  height: 18px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

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

  .mobile-menu-btn {
    display: block;
  }

  .page-content {
    padding: 14px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .topbar-search {
    min-width: 0;
    flex: 1;
  }

  .topbar-search kbd {
    display: none;
  }

  .page-header h1 {
    font-size: 0.85rem;
    letter-spacing: 2px;
  }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background: var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* HUD brackets on login card */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  z-index: 2;
  pointer-events: none;
}

.login-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  z-index: 2;
  pointer-events: none;
}

.login-logo {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.login-logo h1 span {
  color: var(--accent);
  font-weight: 900;
}

.login-logo p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: var(--font-sans);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-error {
  color: var(--error);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  text-align: center;
  margin-top: 6px;
  min-height: 20px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
  color: var(--accent);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.empty-state p {
  font-size: 0.82rem;
  font-family: var(--font-sans);
}

/* ============================================================
   DASHBOARD STATS
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 14px;
  position: relative;
}

/* HUD bracket on stat cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  opacity: 0.6;
}

.stat-card-label {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stat-card-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.stat-card-sub {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.font-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
