/* Simple Theme System for Manager.Builders */

:root {
  /* Default theme (existing colors) */
  --theme-primary: #b87333;
  --theme-primary-dark: #9d6329;
  --theme-background: #fdf1d9;
  --theme-surface: #ffffff;
  --theme-text: #3d2914;
  --theme-text-muted: #343434;
  --theme-accent: #f5f0e4;
}

/* Dark mode */
[data-mode="dark"] {
  --theme-background: #111827;
  --theme-surface: #1f2937;
  --theme-text: #f9fafb;
  --theme-text-muted: #d1d5db;
  --theme-accent: #374151;
}

/* Blue theme */
[data-theme="blue"] {
  --theme-primary: #3b82f6;
  --theme-primary-dark: #2563eb;
  --theme-background: #eff6ff;
  --theme-accent: #dbeafe;
}

[data-theme="blue"][data-mode="dark"] {
  --theme-primary: #60a5fa;
  --theme-primary-dark: #3b82f6;
  --theme-background: #0f172a;
  --theme-accent: #1e293b;
}

/* Green theme */
[data-theme="green"] {
  --theme-primary: #10b981;
  --theme-primary-dark: #059669;
  --theme-background: #ecfdf5;
  --theme-accent: #d1fae5;
}

[data-theme="green"][data-mode="dark"] {
  --theme-primary: #34d399;
  --theme-primary-dark: #10b981;
  --theme-background: #0f172a;
  --theme-accent: #1e293b;
}

/* Purple theme */
[data-theme="purple"] {
  --theme-primary: #8b5cf6;
  --theme-primary-dark: #7c3aed;
  --theme-background: #faf5ff;
  --theme-accent: #e9d5ff;
}

[data-theme="purple"][data-mode="dark"] {
  --theme-primary: #a78bfa;
  --theme-primary-dark: #8b5cf6;
  --theme-background: #0f172a;
  --theme-accent: #1e293b;
}

/* Rose theme */
[data-theme="rose"] {
  --theme-primary: #f43f5e;
  --theme-primary-dark: #e11d48;
  --theme-background: #fff1f2;
  --theme-accent: #fecdd3;
}

[data-theme="rose"][data-mode="dark"] {
  --theme-primary: #fb7185;
  --theme-primary-dark: #f43f5e;
  --theme-background: #0f172a;
  --theme-accent: #1e293b;
}

/* Apply theme variables to existing CSS variables */
body {
  background-color: var(--theme-background);
  color: var(--theme-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Override existing CSS custom properties */
:root {
  --soft-copper: var(--theme-primary);
  --primary-blue: var(--theme-primary);
  --primary-blue-dark: var(--theme-primary-dark);
  --warm-cream: var(--theme-background);
  --dark-walnut: var(--theme-text);
  --graphite: var(--theme-text-muted);
  --light-blue: var(--theme-accent);
}

/* Theme controls styling */
.theme-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--gray-300);
  background: var(--theme-surface);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--theme-text);
}

.theme-toggle:hover {
  background: var(--theme-accent);
}

.theme-selector {
  position: relative;
}

.theme-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  width: 8rem;
  background: var(--theme-surface);
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 0.25rem;
  display: none;
}

.theme-dropdown.open {
  display: block;
}

.theme-option {
  width: 100%;
  text-align: left;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: var(--theme-text);
  transition: background-color 0.2s ease;
}

.theme-option:hover,
.theme-option.selected {
  background: var(--theme-accent);
}

/* Dark mode specific adjustments */
[data-mode="dark"] {
  --gray-50: #2a2a2a;
  --gray-100: #333333;
  --gray-200: #404040;
  --gray-300: #525252;
  --gray-600: #cccccc;
  --gray-800: #ffffff;
  --shadow: 0 1px 3px 0 rgba(255, 255, 255, 0.1), 0 1px 2px 0 rgba(255, 255, 255, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(255, 255, 255, 0.1), 0 4px 6px -2px rgba(255, 255, 255, 0.05);
}

/* Smooth transitions for all themed elements */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Make sure the theme controls don't print */
@media print {
  .theme-controls {
    display: none !important;
  }
}