/* ============================================
   KEYWORD RESEARCH TOOL — Design System
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  /* Colors */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-tertiary: #1a1a3e;
  --bg-card: rgba(22, 22, 60, 0.6);
  --bg-card-hover: rgba(30, 30, 80, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);

  --text-primary: #e8e8ff;
  --text-secondary: #9d9dcc;
  --text-tertiary: #6b6b99;
  --text-muted: #4a4a77;

  --accent-primary: #7c3aed;
  --accent-primary-light: #a78bfa;
  --accent-secondary: #06b6d4;
  --accent-secondary-light: #67e8f9;
  --accent-gradient: linear-gradient(135deg, #7c3aed, #06b6d4);
  --accent-gradient-hover: linear-gradient(135deg, #8b5cf6, #22d3ee);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.15));

  --success: #10b981;
  --success-light: #34d399;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --danger: #ef4444;
  --danger-light: #f87171;
  --info: #3b82f6;
  --info-light: #60a5fa;

  /* Difficulty colors */
  --diff-easy: #10b981;
  --diff-medium: #f59e0b;
  --diff-hard: #ef4444;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(124, 58, 237, 0.3);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.15);
  --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.15);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

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

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

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

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

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

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

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

a { color: var(--accent-primary-light); text-decoration: none; }
a:hover { color: var(--accent-secondary-light); }

::selection {
  background: rgba(124, 58, 237, 0.4);
  color: #fff;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Animated Background ---------- */
#particlesCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.bg-gradient-orbs {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-gradient-orbs .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  animation: orbFloat 20s ease-in-out infinite;
}

.bg-gradient-orbs .orb:nth-child(1) {
  width: 600px; height: 600px;
  background: var(--accent-primary);
  top: -10%; left: -5%;
  animation-delay: 0s;
}
.bg-gradient-orbs .orb:nth-child(2) {
  width: 500px; height: 500px;
  background: var(--accent-secondary);
  bottom: -15%; right: -5%;
  animation-delay: -7s;
}
.bg-gradient-orbs .orb:nth-child(3) {
  width: 400px; height: 400px;
  background: #ec4899;
  top: 50%; left: 40%;
  animation-delay: -14s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 35px) scale(1.02); }
}

/* ---------- App Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-base);
}

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

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

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

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  font-weight: 600;
}

.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-fast);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 3px; height: 100%;
  background: var(--accent-gradient);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-gradient-subtle);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.nav-item.active::before { opacity: 1; }

.nav-item .icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

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

.sidebar-stats {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.stat-mini {
  text-align: center;
  flex: 1;
}

.stat-mini-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-primary-light);
}

.stat-mini-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl) var(--space-2xl);
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

/* ---------- Page Header ---------- */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.page-title .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- Search Bar ---------- */
.search-container {
  position: relative;
  margin-bottom: var(--space-xl);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  font-size: 1.3rem;
  color: var(--text-tertiary);
  margin-right: var(--space-md);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1.05rem;
  padding: var(--space-md) 0;
  font-weight: 500;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-filters {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: var(--space-md);
  flex-shrink: 0;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover, .filter-chip.active {
  background: var(--accent-gradient-subtle);
  border-color: var(--border-accent);
  color: var(--accent-primary-light);
}

.search-btn {
  padding: 10px 28px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  margin-left: var(--space-sm);
}

.search-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.search-btn:active { transform: translateY(0); }

/* ---------- Keyword History Pills ---------- */
.search-history {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.history-pill {
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-pill:hover {
  border-color: var(--border-accent);
  color: var(--accent-primary-light);
  background: var(--accent-gradient-subtle);
}

/* ---------- Stats Overview Row ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

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

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.stat-card-icon.purple { background: rgba(124, 58, 237, 0.15); color: var(--accent-primary-light); }
.stat-card-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-secondary-light); }
.stat-card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success-light); }
.stat-card-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--warning-light); }

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: var(--space-sm);
}

.stat-card-change.up { background: rgba(16, 185, 129, 0.12); color: var(--success-light); }
.stat-card-change.down { background: rgba(239, 68, 68, 0.12); color: var(--danger-light); }

/* ---------- Glass Card ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.glass-card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title .icon {
  font-size: 1.1rem;
}

.card-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  padding: 4px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  font-family: var(--font-primary);
}

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

.tab.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------- Keyword Results Table ---------- */
.results-container {
  margin-top: var(--space-lg);
}

.results-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.results-table thead {
  background: var(--bg-glass);
  position: sticky;
  top: 0;
  z-index: 5;
}

.results-table th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.results-table th:hover {
  color: var(--text-primary);
}

.results-table th .sort-icon {
  margin-left: 6px;
  opacity: 0.4;
  font-size: 0.7rem;
}

.results-table th.sorted .sort-icon {
  opacity: 1;
  color: var(--accent-primary-light);
}

.results-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.results-table tbody tr {
  transition: background var(--transition-fast);
}

.results-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

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

.keyword-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  position: relative;
}

.keyword-checkbox:checked {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
}

.keyword-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.keyword-text {
  font-weight: 500;
}

.keyword-text mark {
  background: rgba(124, 58, 237, 0.25);
  color: var(--accent-primary-light);
  border-radius: 2px;
  padding: 0 2px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-easy { background: rgba(16, 185, 129, 0.12); color: var(--success-light); }
.badge-medium { background: rgba(245, 158, 11, 0.12); color: var(--warning-light); }
.badge-hard { background: rgba(239, 68, 68, 0.12); color: var(--danger-light); }

.badge-info { background: rgba(59, 130, 246, 0.12); color: var(--info-light); }
.badge-commercial { background: rgba(124, 58, 237, 0.12); color: var(--accent-primary-light); }
.badge-transactional { background: rgba(16, 185, 129, 0.12); color: var(--success-light); }
.badge-navigational { background: rgba(6, 182, 212, 0.12); color: var(--accent-secondary-light); }

/* ---------- Difficulty Meter ---------- */
.difficulty-meter {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.difficulty-bar {
  width: 60px;
  height: 6px;
  background: var(--bg-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.difficulty-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.difficulty-fill.easy { background: var(--diff-easy); }
.difficulty-fill.medium { background: var(--diff-medium); }
.difficulty-fill.hard { background: var(--diff-hard); }

.difficulty-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 28px;
}

/* ---------- Volume Indicator ---------- */
.volume-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
}

.volume-bar {
  width: 4px;
  border-radius: 2px;
  transition: all var(--transition-base);
}

.volume-bar.active { background: var(--accent-secondary); }
.volume-bar.inactive { background: var(--border-subtle); }

/* ---------- Trend Sparkline ---------- */
.sparkline-container {
  width: 80px;
  height: 24px;
}

/* ---------- CPC Display ---------- */
.cpc-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--success-light);
}

/* ---------- Intent Tag ---------- */
.intent-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Gauge Chart ---------- */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.gauge-canvas {
  width: 180px;
  height: 110px;
}

.gauge-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
}

/* ---------- SERP Preview ---------- */
.serp-preview-card {
  max-width: 640px;
  padding: var(--space-lg);
}

.serp-preview {
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  color: #202124;
  font-family: Arial, sans-serif;
}

.serp-url {
  font-size: 12px;
  color: #202124;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.serp-url .favicon {
  width: 26px;
  height: 26px;
  background: #f1f3f4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.serp-url .url-text {
  color: #4d5156;
  font-size: 12px;
}

.serp-title {
  font-size: 20px;
  color: #1a0dab;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 4px;
  cursor: pointer;
}

.serp-title:hover { text-decoration: underline; }

.serp-description {
  font-size: 14px;
  color: #4d5156;
  line-height: 1.58;
}

.serp-description .highlight {
  font-weight: 700;
  color: #202124;
}

.serp-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.serp-input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

.serp-input-group input,
.serp-input-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.serp-input-group input:focus,
.serp-input-group textarea:focus {
  border-color: var(--accent-primary);
}

.serp-input-group textarea {
  resize: vertical;
  min-height: 80px;
}

.char-count {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  margin-top: 4px;
  text-align: right;
}

.char-count.warning { color: var(--warning); }
.char-count.danger { color: var(--danger); }
.char-count.ok { color: var(--text-muted); }

/* ---------- Keyword Groups ---------- */
.keyword-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.keyword-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.keyword-group-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.group-name {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

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

.group-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-keyword-tag {
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.group-keyword-tag:hover {
  background: var(--accent-gradient-subtle);
  color: var(--accent-primary-light);
  border-color: var(--border-accent);
}

/* ---------- Saved Keywords Panel ---------- */
.saved-panel {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-lg);
}

.saved-lists {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.saved-list-item {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.saved-list-item:hover, .saved-list-item.active {
  background: var(--accent-gradient-subtle);
  border-color: var(--border-accent);
}

.saved-list-name {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.saved-list-count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---------- Action Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

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

.btn-ghost:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.result-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.result-count strong {
  color: var(--accent-primary-light);
  font-family: var(--font-mono);
}

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

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.empty-state-desc {
  color: var(--text-tertiary);
  font-size: 0.88rem;
  max-width: 400px;
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-glass) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    var(--bg-glass) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 90%; }

.skeleton-row {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.skeleton-cell {
  height: 16px;
  border-radius: var(--radius-sm);
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn var(--transition-bounce) forwards;
  min-width: 280px;
  max-width: 420px;
}

.toast.exiting {
  animation: toastSlideOut var(--transition-base) forwards;
}

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-message { font-size: 0.85rem; flex: 1; }
.toast-close {
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 1rem;
  padding: 4px;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }

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

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

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

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-fast) forwards;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 90%;
  max-width: 500px;
  animation: modalSlideUp var(--transition-bounce) forwards;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

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

@keyframes modalSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- View Sections ---------- */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeInView var(--transition-base) forwards;
}

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

/* ---------- Two Column Layout ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* ---------- Keyword Detail Panel ---------- */
.keyword-detail-panel {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-lg);
}

.detail-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

/* ---------- Progress Ring ---------- */
.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.progress-ring canvas {
  width: 100%;
  height: 100%;
}

.progress-ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
}

/* ---------- Pulse Animation ---------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }

/* ---------- Select Dropdown ---------- */
.select-wrapper {
  position: relative;
}

.select-custom {
  appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 36px 8px 14px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.select-custom:focus { border-color: var(--accent-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .keyword-detail-panel {
    grid-template-columns: 1fr;
  }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
}

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

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

  .main-content {
    margin-left: 0;
    padding: var(--space-lg);
  }

  .mobile-menu-btn {
    display: flex !important;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .search-filters { display: none; }

  .three-col { grid-template-columns: 1fr; }

  .saved-panel { grid-template-columns: 1fr; }
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 201;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-primary);
}

/* ---------- Utility Classes ---------- */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.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); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }

.hidden { display: none !important; }
.visible { display: block !important; }
