/* 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 */
}

/* Enhanced Light Mode Variables - More tech-focused, less plain white */
:root.light-mode {
  --bg-primary: #f0f4f8;  /* Subtle blue-gray instead of white */
  --bg-secondary: #e5eaf2; /* Slightly darker secondary */
  --bg-tertiary: #dae2ef;  /* Even more blue tint for tertiary */
  --bg-code: #e5edf7;
  --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(37, 99, 235, 0.15); /* More visible blue-tinted borders */
  --border-secondary: rgba(8, 145, 178, 0.1);
  --card-bg: rgba(255, 255, 255, 0.6); /* More transparent card background */
  --card-border: rgba(37, 99, 235, 0.2); /* Subtle blue border */
  --ui-element: rgba(226, 232, 240, 0.7); /* More transparent UI elements */
  --ui-element-hover: rgba(203, 213, 225, 0.8);
  --bg-primary-rgb: 240, 244, 248; /* RGB for gradients */
  --bg-secondary-rgb: 229, 234, 242; /* 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 - More transparent in light mode */
:root.light-mode .graph-container {
  background: rgba(248, 250, 252, 0.08); /* Much more transparent - lighter gray */
  backdrop-filter: blur(2px);
  border: 1px solid rgba(37, 99, 235, 0.15);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.05);
}

:root.light-mode .node-details {
  background: rgba(255, 255, 255, 0.8); /* More opaque for readability */
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

:root.light-mode .graph-filters {
  background: rgba(248, 250, 252, 0.6); /* Slightly more opaque */
  backdrop-filter: blur(3px);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

:root.light-mode .graph-filter {
  color: var(--text-secondary);
  border-color: var(--border-primary);
  background: rgba(255, 255, 255, 0.5);
}

:root.light-mode .graph-filter:hover {
  background: rgba(255, 255, 255, 0.7);
}

:root.light-mode .graph-filter.active {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(37, 99, 235, 0.1));
  border-color: rgba(37, 99, 235, 0.3);
}

: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.1);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(37, 99, 235, 0.1));
}

:root.light-mode .node-link:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.2), rgba(37, 99, 235, 0.2));
}

/* Fix for code blocks in light mode */
:root.light-mode pre, 
:root.light-mode code {
  background-color: var(--bg-code);
  color: var(--text-secondary);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

/* Services and Newsletter sections - More transparent in light mode */
:root.light-mode .service-card {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

:root.light-mode .newsletter-container,
:root.light-mode .cta-container {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

:root.light-mode .newsletter-input {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Enhanced light mode body background with more pronounced grid pattern */
:root.light-mode body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 20% 35%, rgba(8, 145, 178, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 75% 15%, rgba(37, 99, 235, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(124, 58, 237, 0.08) 0%, transparent 40%),
    linear-gradient(rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px);
  background-size: auto, auto, auto, 16px 16px, 16px 16px;
  background-position: 0 0, 0 0, 0 0, center center, center center;
}

/* 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);
}

/* Light mode buttons are more attractive */
:root.light-mode button {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.05), rgba(37, 99, 235, 0.05));
  border: 1px solid rgba(37, 99, 235, 0.1);
}

:root.light-mode button:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(37, 99, 235, 0.1));
  border-color: rgba(37, 99, 235, 0.2);
}

/* Other light mode improvements */
:root.light-mode .primary-button,
:root.light-mode .cta-primary-button {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

:root.light-mode .secondary-button,
:root.light-mode .cta-secondary-button {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

:root.light-mode .hero-section {
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
}

:root.light-mode .hero-bg {
  background-image: 
    radial-gradient(circle at 20% 35%, rgba(8, 145, 178, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 15%, rgba(37, 99, 235, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(124, 58, 237, 0.1) 0%, transparent 40%);
}

/* Fix for knowledge graph in both themes */
.graph-container {
  backdrop-filter: blur(2px);
}