/* ============================================
   THEME SYSTEM - CSS Custom Properties
   ============================================ */

:root {
  /* Light Theme (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --accent-primary: #1672ce;
  --accent-hover: #1361b3;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --card-hover-glow: rgba(22, 114, 206, 0.3);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6);
  --card-hover-glow: rgba(59, 130, 246, 0.4);
}

/* Ocean Theme */
[data-theme="ocean"] {
  --bg-primary: #ecfeff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #cffafe;
  --text-primary: #164e63;
  --text-secondary: #0e7490;
  --text-tertiary: #155e75;
  --accent-primary: #0891b2;
  --accent-hover: #0e7490;
  --border-color: #a5f3fc;
  --shadow-sm: 0 1px 2px 0 rgb(14 116 144 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(14 116 144 / 0.15), 0 2px 4px -2px rgb(14 116 144 / 0.15);
  --shadow-lg: 0 10px 15px -3px rgb(14 116 144 / 0.2), 0 4px 6px -4px rgb(14 116 144 / 0.2);
  --card-hover-glow: rgba(8, 145, 178, 0.35);
}

/* Sunset Theme */
[data-theme="sunset"] {
  --bg-primary: #fef2f2;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fee2e2;
  --text-primary: #7f1d1d;
  --text-secondary: #991b1b;
  --text-tertiary: #b91c1c;
  --accent-primary: #dc2626;
  --accent-hover: #b91c1c;
  --border-color: #fecaca;
  --shadow-sm: 0 1px 2px 0 rgb(153 27 27 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(153 27 27 / 0.15), 0 2px 4px -2px rgb(153 27 27 / 0.15);
  --shadow-lg: 0 10px 15px -3px rgb(153 27 27 / 0.2), 0 4px 6px -4px rgb(153 27 27 / 0.2);
  --card-hover-glow: rgba(220, 38, 38, 0.35);
}

/* Smooth transitions for theme changes */
body,
header,
footer,
.bg-slate-50,
.bg-white,
.bg-slate-800,
.text-slate-900,
.text-slate-800,
.text-slate-700,
.text-slate-600,
.text-slate-500,
.text-slate-400,
.text-slate-300 {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Apply theme colors to common elements */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.bg-slate-50 {
  background-color: var(--bg-primary) !important;
}

.bg-white {
  background-color: var(--bg-secondary) !important;
}

.bg-slate-800 {
  background-color: var(--bg-tertiary) !important;
}

.text-slate-900,
.text-slate-800 {
  color: var(--text-primary) !important;
}

.text-slate-700,
.text-slate-600 {
  color: var(--text-secondary) !important;
}

.text-slate-500,
.text-slate-400 {
  color: var(--text-tertiary) !important;
}

.border-slate-200,
.border-slate-300 {
  border-color: var(--border-color) !important;
}

/* Theme-aware accent colors */
.text-\[\#1672ce\],
a[href]:not(.social-link) {
  color: var(--accent-primary) !important;
}

.bg-\[\#1672ce\] {
  background-color: var(--accent-primary) !important;
}

.hover\:bg-\[\#1361b3\]:hover {
  background-color: var(--accent-hover) !important;
}

.hover\:text-\[\#1672ce\]:hover {
  color: var(--accent-primary) !important;
}

/* Theme-aware shadows */
.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-md,
.shadow-lg,
.shadow-xl {
  box-shadow: var(--shadow-md) !important;
}

/* Card hover effects */
.hover-glow:hover {
  box-shadow: 0 0 15px 5px var(--card-hover-glow) !important;
}

/* ============================================
   THEME SWITCHER UI COMPONENT
   ============================================ */

.theme-switcher {
  position: relative;
  display: inline-block;
  margin-left: 16px;
}

.theme-switcher-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.theme-switcher-button:hover {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.theme-switcher-button:hover svg {
  color: white;
}

.theme-switcher-button svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
  transition: color 0.2s ease;
  position: absolute;
}

/* Show/hide icons based on theme */
.theme-icon-light {
  display: none;
}

.theme-icon-dark {
  display: block;
}

[data-theme="dark"] .theme-icon-light {
  display: block;
}

[data-theme="dark"] .theme-icon-dark {
  display: none;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.theme-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.theme-option:hover {
  background-color: var(--bg-tertiary);
}

.theme-option.active {
  background-color: var(--accent-primary);
  color: white;
}

.theme-option-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.theme-option.active .theme-option-icon {
  border-color: white;
}

/* Theme preview colors */
.theme-option[data-theme="light"] .theme-option-icon {
  background: linear-gradient(135deg, #f8fafc 0%, #1672ce 100%);
}

.theme-option[data-theme="dark"] .theme-option-icon {
  background: linear-gradient(135deg, #0f172a 0%, #3b82f6 100%);
}

.theme-option[data-theme="ocean"] .theme-option-icon {
  background: linear-gradient(135deg, #ecfeff 0%, #0891b2 100%);
}

.theme-option[data-theme="sunset"] .theme-option-icon {
  background: linear-gradient(135deg, #fef2f2 0%, #dc2626 100%);
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .theme-dropdown {
    right: -8px;
  }
}