/* ============================================
   NexCore Innovations - Theme System
   Dark/Light Mode Toggle
   ============================================ */

/* Theme Switcher Button */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  overflow: hidden;
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.theme-toggle svg {
  position: absolute;
  width: 22px;
  height: 22px;
  transition: all var(--transition-normal);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* Sun Icon */
.icon-sun svg {
  color: #fbbf24;
}

/* Moon Icon */
.icon-moon svg {
  color: #3b82f6;
}

/* Theme Transition on Body */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth Color Transitions for All Elements */
*,
*::before,
*::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Theme-Specific Animations */
@keyframes sunrise {
  0% {
    transform: translateY(20px) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-20px) scale(0.5);
    opacity: 0;
  }
}

@keyframes moonlight {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 30px 10px rgba(59, 130, 246, 0.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
}

/* Dark Mode Specific Styles */
[data-theme="dark"] {
  /* Enhance glow effects in dark mode */
  --shadow-glow: 0 0 80px rgba(59, 130, 246, 0.3);
  
  /* Enhance contrast for accessibility */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
}

/* Light Mode Specific Enhancements */
[data-theme="light"] {
  --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.15);
}

/* Theme Preference Indicator */
.theme-indicator {
  position: fixed;
  bottom: 24px;
  left: 24px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.theme-indicator.show {
  opacity: 1;
  visibility: visible;
}

.theme-indicator-icon {
  width: 18px;
  height: 18px;
}

.theme-indicator-icon.sun {
  color: #fbbf24;
}

.theme-indicator-icon.moon {
  color: #3b82f6;
}

/* Auto Theme Detection */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0b0f19;
    --bg-secondary: #1e293b;
    --bg-tertiary: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-light: #334155;
    --border-medium: #475569;
    --border-dark: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #22d3ee;
    --shadow-glow: 0 0 60px rgba(59, 130, 246, 0.25);
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    --accent-primary: #2563eb;
    --accent-secondary: #06b6d4;
    --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.15);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border-light: #000;
    --border-medium: #000;
    --border-dark: #000;
  }
  
  [data-theme="dark"] {
    --border-light: #fff;
    --border-medium: #fff;
    --border-dark: #fff;
  }
}

/* Print Theme Override */
@media print {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
  }
}

/* Transition Classes */
.theme-transition {
  transition: all 0.3s ease;
}

.theme-transition-fast {
  transition: all 0.15s ease;
}

.theme-transition-slow {
  transition: all 0.5s ease;
}

/* Color Utilities */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.bg-card { background-color: var(--bg-card); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }

.border-light { border-color: var(--border-light); }
.border-medium { border-color: var(--border-medium); }
.border-dark { border-color: var(--border-dark); }

.accent-gradient {
  background: var(--accent-gradient);
}

.glow-effect {
  box-shadow: var(--shadow-glow);
}

/* Hover Effects by Theme */
@media (hover: hover) {
  .hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
  }
  
  .hover-glow:hover {
    box-shadow: var(--shadow-glow);
  }
}

/* Focus Visible for Accessibility */
.focus-visible:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Selection Colors */
::selection {
  background: var(--accent-primary);
  color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Glassmorphism Effect */
.glass {
  background: rgba(var(--bg-secondary), 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(var(--border-light), 0.3);
}

[data-theme="dark"] .glass {
  background: rgba(var(--bg-secondary), 0.8);
  border: 1px solid rgba(var(--border-light), 0.2);
}

/* Gradient Text */
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 2px;
  background: var(--accent-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Animated Background */
.animated-bg {
  background: linear-gradient(-45deg, var(--bg-primary), var(--bg-secondary), var(--bg-tertiary), var(--bg-primary));
  background-size: 400% 400%;
  animation: gradient-bg 15s ease infinite;
}

@keyframes gradient-bg {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Pulse Animation */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Bounce Animation */
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Fade In Animation */
.fade-in {
  animation: fade-in 0.5s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide Up Animation */
.slide-up {
  animation: slide-up 0.5s ease-out;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In Animation */
.scale-in {
  animation: scale-in 0.3s ease-out;
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
