/* ─── Design Tokens — Arctic Dawn ────────────────────────────────── */
:root {
  --primary: #00CEC9;
  --primary-dim: rgba(0, 206, 201, 0.15);
  --secondary: #81ECEC;
  --accent: #FF7675;
  --accent-dim: rgba(255, 118, 117, 0.15);
  --warn: #FDCB6E;
  --warn-dim: rgba(253, 203, 110, 0.15);
  --info: #74B9FF;
  --info-dim: rgba(116, 185, 255, 0.15);
  --debug: #636E72;
  --debug-dim: rgba(99, 110, 114, 0.15);

  --bg: #0B2023;
  --bg-elevated: #0F2E32;
  --bg-card: rgba(15, 46, 50, 0.7);
  --bg-hover: rgba(0, 206, 201, 0.08);
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(0, 206, 201, 0.12);
  --border-strong: rgba(0, 206, 201, 0.25);

  --text: #E0F7F7;
  --text-dim: rgba(224, 247, 247, 0.6);
  --text-muted: rgba(224, 247, 247, 0.35);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: 200ms ease;
  --transition-slow: 300ms ease;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Utility ───────────────────────────────────────────────────── */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── App Layout ────────────────────────────────────────────────── */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ─── Header ────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions { display: flex; gap: 8px; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #00B4AE);
  color: var(--bg);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(0, 206, 201, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-hover); }

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

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ─── Input Section ─────────────────────────────────────────────── */
.input-section { margin-bottom: 20px; }

.input-card { padding: 20px; }

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.input-header h2 { font-size: 1rem; font-weight: 600; }

.input-meta { display: flex; align-items: center; gap: 8px; }

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(0, 206, 201, 0.2);
}

.log-textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition);
}

.log-textarea::placeholder { color: var(--text-muted); }
.log-textarea:focus { outline: none; border-color: var(--primary); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.line-count { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ─── Controls ──────────────────────────────────────────────────── */
.controls-section { margin-bottom: 20px; animation: fadeIn 300ms ease; }

.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-label { font-size: 0.8rem; color: var(--text-dim); margin-right: 4px; }

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--border-strong); color: var(--text); }
.filter-btn.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-error { background: var(--accent); }
.dot-warn { background: var(--warn); }
.dot-info { background: var(--info); }
.dot-debug { background: var(--debug); }

.stats-group { display: flex; gap: 20px; }

.stat { text-align: center; }
.stat-value { display: block; font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-error { color: var(--accent); }
.stat-warn { color: var(--warn); }

/* ─── Heatmap ───────────────────────────────────────────────────── */
.heatmap-section { margin-bottom: 20px; animation: fadeIn 400ms ease; }

.heatmap-container { padding: 20px; }

.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.heatmap-header h2 { font-size: 1rem; font-weight: 600; }

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.legend-gradient {
  width: 120px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(0, 206, 201, 0.1),
    rgba(0, 206, 201, 0.3),
    rgba(253, 203, 110, 0.5),
    rgba(255, 118, 117, 0.7),
    rgba(255, 118, 117, 1)
  );
}

.heatmap-grid {
  display: grid;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.heatmap-row {
  display: contents;
}

.heatmap-cell {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  border: 1px solid transparent;
}

.heatmap-cell:hover {
  transform: scale(1.15);
  z-index: 2;
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 206, 201, 0.3);
}

.heatmap-cell.active {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(0, 206, 201, 0.4);
}

.heatmap-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  min-width: 60px;
}

.heatmap-col-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: center;
  padding-bottom: 4px;
}

/* ─── Detail Panel ──────────────────────────────────────────────── */
.detail-section { animation: slideUp 300ms ease; }

.detail-panel { padding: 20px; max-height: 400px; display: flex; flex-direction: column; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.detail-header h3 { font-size: 0.9rem; font-weight: 600; }

.detail-entries {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  border-left: 3px solid transparent;
  background: var(--surface);
  word-break: break-all;
  animation: fadeIn 200ms ease;
}

.log-entry.level-error { border-left-color: var(--accent); background: var(--accent-dim); }
.log-entry.level-warn { border-left-color: var(--warn); background: var(--warn-dim); }
.log-entry.level-info { border-left-color: var(--info); background: var(--info-dim); }
.log-entry.level-debug { border-left-color: var(--debug); background: var(--debug-dim); }

/* ─── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app { padding: 16px 12px 32px; }
  .header { flex-direction: column; align-items: flex-start; }
  .controls-bar { flex-direction: column; align-items: flex-start; }
  .stats-group { width: 100%; justify-content: space-around; }
  .heatmap-cell { min-width: 28px; height: 28px; font-size: 0.55rem; }
}

@media (max-width: 480px) {
  .filter-group { gap: 4px; }
  .filter-btn { padding: 4px 8px; font-size: 0.7rem; }
}
