:root {
  --bg: #0C0C1E;
  --surface: #1E1E3F;
  --surface-hover: #2A2A5A;
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --secondary: #818CF8;
  --accent: #22D3EE;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #312E81;
  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;
  --radius: 12px;
  --glass-bg: rgba(30, 30, 63, 0.7);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

.hidden {
  display: none !important;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 380px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1.5rem;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 5px 0 15px rgba(0,0,0,0.2);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  color: var(--accent);
  width: 28px;
  height: 28px;
}

.logo-area h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Search Box */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-box {
  position: relative;
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.8rem 1rem 0.8rem 2.5rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.search-box .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.metric-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-card.highlight {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.metric-card.highlight .metric-value {
  color: var(--accent);
}

/* Analysis Panel */
.analysis-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.analysis-panel h3 {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.insight-item.warning {
  border-left-color: var(--warning);
}

.insight-item.warning i { color: var(--warning); }

.insight-item.info {
  border-left-color: var(--accent);
}

.insight-item.info i { color: var(--accent); }

.insight-item i {
  flex-shrink: 0;
  margin-top: 2px;
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.insight-item strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.insight-item p {
  color: var(--text-muted);
}

/* Actions */
.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: var(--border);
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative;
  background: radial-gradient(circle at 50% -20%, var(--surface) 0%, var(--bg) 80%);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
  gap: 1rem;
  z-index: 5;
}

.empty-icon-wrapper {
  width: 80px;
  height: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 1rem;
}

.empty-icon-wrapper i {
  width: 40px;
  height: 40px;
}

.empty-state h2 {
  color: var(--text);
  font-size: 1.5rem;
}

.popular-tags {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tag-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* Visualizations */
.viz-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.viz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.viz-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.viz-tabs {
  display: flex;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--bg);
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.chart-area {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

/* Loader */
.loader {
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-left-color: var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  align-self: center;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  padding: 0.5rem;
  background: var(--danger-bg);
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-hover);
  border: 1px solid var(--secondary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
