/* ==========================================
   DARK MODE TOGGLE BUTTON STYLES
   ========================================== */

.theme-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Theme Toggle Button */
.theme-toggle {
  position: relative;
  background: linear-gradient(135deg, #f8f6f3 0%, #e8e8e8 100%);
  border: 2px solid #d1d5db;
  border-radius: 50px;
  width: 50px;
  height: 28px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.theme-toggle:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.98);
}

/* Toggle Slider */
.theme-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dark mode active state */
[data-theme="dark"] .theme-toggle {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border-color: #374151;
}

[data-theme="dark"] .theme-toggle-slider {
  transform: translateX(22px);
  background: #0d0d0d;
}

/* Icon Styles */
.theme-toggle-icon {
  width: 12px;
  height: 12px;
  transition: all 0.4s ease;
  opacity: 0.8;
}

/* Sun Icon (Light Mode) */
.sun-icon {
  color: #f59e0b;
  display: block;
}

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

/* Moon Icon (Dark Mode) */
.moon-icon {
  color: #9ed0ff;
  display: none;
}

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

/* Toggle Label */
.theme-toggle-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE10+ */
  user-select: none;         /* Standard */
  transition: color 0.4s ease;
}

/* Keyboard Focus */
.theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
  .theme-toggle {
    border-width: 3px;
  }
  
  .theme-toggle-slider {
    box-shadow: 
      0 0 0 2px var(--text-primary),
      0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle-slider,
  .theme-toggle-icon,
  .theme-toggle-label {
    transition: none !important;
  }
}

/* Loading animation */
.theme-toggle.loading {
  pointer-events: none;
}

.theme-toggle.loading .theme-toggle-slider {
  animation: pulse 1s ease-in-out infinite;
}

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

/* Additional Visual Polish */
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0) 50%, 
    rgba(0, 0, 0, 0.05) 100%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.theme-toggle:hover::before {
  opacity: 0.7;
}

/* Tooltip */
.theme-toggle-container::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 6px 12px;
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: var(--shadow-gentle);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(5px);
  transition: all 0.3s ease;
  pointer-events: none;
  border: 1px solid var(--border-light);
}

.theme-toggle-container:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
