/* ============================================
   Dead Code Detector — Styles
   Theme: Dark mode with Pink/Magenta palette
   ============================================ */

:root {
  --primary: #EC4899;
  --primary-dim: rgba(236, 72, 153, 0.15);
  --secondary: #F472B6;
  --accent: #FBCFE8;
  --accent-text: #0D0D1A;
  --bg: #1A1A2E;
  --bg-card: rgba(26, 26, 50, 0.65);
  --bg-surface: #22223A;
  --border: rgba(236, 72, 153, 0.12);
  --border-hover: rgba(236, 72, 153, 0.3);
  --text: #F0EAF2;
  --text-dim: #8A7FA0;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 250ms ease;
  --font: 'Inter', system-ui, sans-serif;
  --shadow-glow: 0 0 40px rgba(236, 72, 153, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(236, 72, 153, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 100%, rgba(251, 207, 232, 0.03) 0%, transparent 50%);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
  padding: 1.5rem;
}

/* Header */
.header {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.04) 0%, transparent 100%);
}
.header-inner { max-width: 960px; margin: 0 auto; }
.logo { display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
.logo-icon { font-size: 1.75rem; }
.logo 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;
}
.tagline { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }

/* Main */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title { font-size: 1rem; font-weight: 600; color: var(--primary); margin-bottom: 0.5rem; }

/* File Tabs */
.file-tabs { display: flex; gap: 4px; margin-bottom: 0.5rem; flex-wrap: wrap; }
.file-tab {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}
.file-tab:hover { border-color: var(--primary); color: var(--text); }
.file-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.add-tab { border-style: dashed; }

/* Code Textarea */
.code-textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
  color: var(--secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 150px;
  tab-size: 2;
  transition: border-color var(--transition);
}
.code-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.input-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* Filter */
.filter-section { padding: 0; }
.filter-group { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Results */
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.results-header .section-title { margin-bottom: 0; }
.results-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 400px; overflow-y: auto; }
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  transition: border-color var(--transition);
}
.result-item:hover { border-color: var(--primary); }
.result-type-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.result-type-badge.function { background: rgba(99, 102, 241, 0.2); color: #818CF8; }
.result-type-badge.variable { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.result-type-badge.import { background: rgba(245, 158, 11, 0.2); color: #FBBF24; }
.result-type-badge.export { background: rgba(236, 72, 153, 0.2); color: var(--secondary); }
.result-info { display: flex; flex-direction: column; gap: 0.1rem; }
.result-name { font-family: 'SF Mono', monospace; font-size: 0.85rem; font-weight: 600; }
.result-detail { font-size: 0.72rem; color: var(--text-dim); }
.confidence-bar { display: flex; align-items: center; gap: 0.3rem; }
.confidence-fill {
  width: 40px;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.confidence-fill::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--success);
}
.confidence-text { font-size: 0.68rem; color: var(--text-dim); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  background: var(--primary-dim);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Graph */
.graph-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}
#graphCanvas { display: block; width: 100%; height: 300px; }

/* History */
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.history-header .section-title { margin-bottom: 0; }
.history-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 150px; overflow-y: auto; }
.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.history-item:hover { border-color: var(--primary); }
.history-count { font-weight: 700; color: var(--primary); font-size: 0.85rem; min-width: 24px; }
.history-date { font-size: 0.72rem; color: var(--text-dim); flex: 1; }
.placeholder-text { color: var(--text-dim); text-align: center; padding: 1rem; font-size: 0.85rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #DB2777); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(236, 72, 153, 0.35); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(236, 72, 153, 0.4);
  z-index: 1000;
  transition: transform 300ms ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Footer */
.footer { text-align: center; padding: 1.5rem; color: var(--text-dim); font-size: 0.8rem; border-top: 1px solid var(--border); }

@media (max-width: 600px) {
  .main { padding: 1rem; gap: 1rem; }
  .result-item { grid-template-columns: 1fr; gap: 0.3rem; }
}
