/* src/styles/theme.css */

/* Base Variables (Dark Mode Default) */
:root {
  --bg-primary: #0f1219;
  --bg-secondary: #161a24;
  --bg-tertiary: #1e2330;
  --bg-code: #1a1e2a;
  --text-primary: #e2e8f0;
  --text-secondary: #a0aec0;
  --text-tertiary: #718096;
  --accent-primary: #06b6d4; /* Cyan */
  --accent-secondary: #3b82f6; /* Blue */
  --accent-tertiary: #8b5cf6; /* Violet */
  --glow-primary: rgba(6, 182, 212, 0.2);
  --glow-secondary: rgba(59, 130, 246, 0.2);
  --glow-tertiary: rgba(139, 92, 246, 0.2);
  --border-primary: rgba(255, 255, 255, 0.1);
  --border-secondary: rgba(255, 255, 255, 0.05);
  --card-bg: rgba(24, 28, 44, 0.5);
  --card-border: rgba(56, 189, 248, 0.2); /* Cyan border */
  --ui-element: #1e293b;
  --ui-element-hover: #334155;
  --container-padding: clamp(1rem, 5vw, 3rem);
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --bg-primary-rgb: 15, 18, 25; /* RGB for gradients */
  --bg-secondary-rgb: 22, 26, 36; /* RGB for gradients */
}

/* Light Mode Variables */
:root.light-mode {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc; /* Lighter secondary */
  --bg-tertiary: #f1f5f9; /* Even lighter tertiary */
  --bg-code: #f1f5f9;
  --text-primary: #1e293b; /* Darker primary text */
  --text-secondary: #475569; /* Darker secondary text */
  --text-tertiary: #64748b; /* Darker tertiary text */
  --accent-primary: #0891b2; /* Slightly darker cyan */
  --accent-secondary: #2563eb; /* Slightly darker blue */
  --accent-tertiary: #7c3aed; /* Slightly darker violet */
  --glow-primary: rgba(8, 145, 178, 0.15);
  --glow-secondary: rgba(37, 99, 235, 0.15);
  --glow-tertiary: rgba(124, 58, 237, 0.15);
  --border-primary: rgba(0, 0, 0, 0.1); /* Darker borders */
  --border-secondary: rgba(0, 0, 0, 0.05);
  --card-bg: rgba(255, 255, 255, 0.8); /* White card with opacity */
  --card-border: rgba(37, 99, 235, 0.3); /* Blue border */
  --ui-element: #e2e8f0; /* Lighter UI elements */
  --ui-element-hover: #cbd5e1;
  --bg-primary-rgb: 255, 255, 255; /* RGB for gradients */
  --bg-secondary-rgb: 248, 250, 252; /* RGB for gradients */
}

/* Ensure transitions for smooth theme changes */
*, *::before, *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Knowledge Graph specific theme adjustments */
:root.light-mode .graph-container {
  background: rgba(248, 250, 252, 0.3);
  border: 1px solid var(--card-border);
}

:root.light-mode .node-details {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

:root.light-mode .graph-filters {
  background: rgba(248, 250, 252, 0.7);
}

:root.light-mode .graph-filter {
  color: var(--text-secondary);
  border-color: var(--border-primary);
}

:root.light-mode .connections-list a {
  color: var(--accent-secondary);
}

:root.light-mode .node-link {
  box-shadow: 0 4px 10px rgba(8, 145, 178, 0.15);
}

/* Fix for code blocks in light mode */
:root.light-mode pre, 
:root.light-mode code {
  background-color: var(--bg-code);
  color: var(--text-secondary);
}

/* Apply base styles using variables */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

a {
  color: var(--accent-primary);
}

/* Fix for inputs/selects */
input, select, textarea {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

/* Ensure header and footer adapt to theme */
.site-header, .site-footer {
  background-color: var(--bg-secondary);
  border-color: var(--border-primary);
}

/* Fix card styles */
.post-card, .sidebar-block {
  background-color: var(--card-bg);
  border-color: var(--card-border);
}