/* 
 * Thread Lifecycle Visualizer - Theme CSS
 * This file contains theme variables and styles for dark/light mode support
 */

/* Light Theme (Default) */
:root {
  /* Base colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f2f5;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-muted: #6c757d;
  --border-color: #e0e0e0;
  
  /* Accent colors */
  --accent-primary: #1976d2;
  --accent-secondary: #2196f3;
  --accent-tertiary: #64b5f6;
  
  /* Component colors */
  --card-bg: #ffffff;
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --btn-primary-bg: #1976d2;
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #e0e0e0;
  --btn-secondary-text: #333333;
  
  /* Thread state colors */
  --color-new: #64b5f6;
  --color-runnable: #81c784;
  --color-running: #4caf50;
  --color-blocked: #e57373;
  --color-waiting: #ffb74d;
  --color-timed-waiting: #ffd54f;
  --color-terminated: #9e9e9e;
  
  /* Header and footer */
  --header-bg: linear-gradient(135deg, #1976d2, #2196f3);
  --header-text: #ffffff;
  --footer-bg: #f0f2f5;
  --footer-text: #555555;
  
  /* UI elements */
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #c1c1c1;
  --tooltip-bg: #333333;
  --tooltip-text: #ffffff;
  
  /* Timeline and events */
  --timeline-bg: #f8f9fa;
  --event-thread1-bg: rgba(25, 118, 210, 0.1);
  --event-thread1-border: #1976d2;
  --event-thread2-bg: rgba(156, 39, 176, 0.1);
  --event-thread2-border: #9c27b0;
  --event-system-bg: rgba(0, 0, 0, 0.05);
  --event-system-border: #616161;
  --event-error-bg: rgba(244, 67, 54, 0.1);
  --event-error-border: #f44336;
  
  /* Code syntax highlighting */
  --code-bg: #f5f5f5;
  --code-text: #333333;
  --code-keyword: #7b1fa2;
  --code-function: #0277bd;
  --code-string: #2e7d32;
  --code-number: #d84315;
  --code-comment: #757575;
  --code-variable: #d32f2f;
  --code-operator: #1565c0;
  --code-class: #ed6c02;
  
  /* Visualization enhancements */
  --diagram-connection: rgba(0, 0, 0, 0.4);
  --diagram-highlight: #1976d2;
  --diagram-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  
  /* Icons and indicators */
  --icon-color: #1976d2;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --info-color: #2196f3;
}

/* Theme transition effect */
.theme-transition {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
}

/* Dark Theme */
[data-theme="dark"] {
  /* Base colors */
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #9e9e9e;
  --border-color: #444444;
  
  /* Accent colors */
  --accent-primary: #2196f3;
  --accent-secondary: #64b5f6;
  --accent-tertiary: #90caf9;
  
  /* Component colors */
  --card-bg: #1e1e1e;
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  --btn-primary-bg: #2196f3;
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #424242;
  --btn-secondary-text: #ffffff;
  
  /* Thread state colors - slightly adjusted for dark mode visibility */
  --color-new: #64b5f6;
  --color-runnable: #81c784;
  --color-running: #4caf50;
  --color-blocked: #e57373;
  --color-waiting: #ffb74d;
  --color-timed-waiting: #ffd54f;
  --color-terminated: #bdbdbd;
  
  /* Header and footer */
  --header-bg: linear-gradient(135deg, #164572, #1565c0);
  --header-text: #ffffff;
  --footer-bg: #1e1e1e;
  --footer-text: #9e9e9e;
  
  /* UI elements */
  --scrollbar-track: #2d2d2d;
  --scrollbar-thumb: #555555;
  --tooltip-bg: #616161;
  --tooltip-text: #ffffff;
  
  /* Timeline and events */
  --timeline-bg: #1e1e1e;
  --event-thread1-bg: rgba(33, 150, 243, 0.2);
  --event-thread1-border: #2196f3;
  --event-thread2-bg: rgba(156, 39, 176, 0.2);
  --event-thread2-border: #9c27b0;
  --event-system-bg: rgba(255, 255, 255, 0.07);
  
  /* Code syntax highlighting for dark mode */
  --code-bg: #2d2d2d;
  --code-text: #e0e0e0;
  --code-keyword: #c792ea;
  --code-function: #82aaff;
  --code-string: #c3e88d;
  --code-number: #f78c6c;
  --code-comment: #616161;
  --code-variable: #f07178;
  --code-operator: #89ddff;
  --code-class: #ffcb6b;
  
  /* Visualization enhancements for dark mode */
  --diagram-connection: rgba(255, 255, 255, 0.6);
  --diagram-highlight: #4fc3f7;
  --diagram-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  --event-system-border: #9e9e9e;
  --event-error-bg: rgba(244, 67, 54, 0.15);
  --event-error-border: #f44336;
  
  /* Icons and indicators */
  --icon-color: #64b5f6;
  --success-color: #81c784;
  --warning-color: #ffb74d;
  --error-color: #e57373;
  --info-color: #64b5f6;
}

/* Modern UI Enhancements */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.theme-transition * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 1.5rem 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 1.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

/* Card styling */
.problem-card, .state-item, .demo-result, .demo-explanation-panel, .demo-step-tracker {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
}

/* Button styling */
.btn, .demo-btn {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

.demo-btn, .btn.primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 1000;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.theme-toggle i {
  color: var(--text-primary);
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}
