/* Theme Toggle Styles */
.theme-toggle-container {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: none;
}

.theme-toggle:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.15);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.95);
}

.theme-toggle-icon {
  font-size: 1.2rem;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.9);
}

.theme-toggle:hover .theme-toggle-icon {
  transform: rotate(15deg) scale(1.05);
  color: #ffffff;
}

/* Light theme specific styles */
:root[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: none !important;
}

:root[data-theme="light"] .theme-toggle:hover {
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

:root[data-theme="light"] .theme-toggle-icon {
  color: rgba(255, 255, 255, 0.9) !important;
}

:root[data-theme="light"] .theme-toggle:hover .theme-toggle-icon {
  color: #ffffff !important;
}

/* Smooth theme transitions */
.theme-transitioning,
.theme-transitioning * {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Focus styles for accessibility */
.theme-toggle:focus {
  outline: none;
  border-color: var(--focus-ring, #60a5fa);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .theme-toggle {
    width: 40px;
    height: 40px;
  }

  .theme-toggle-icon {
    font-size: 1.1rem;
  }

  .theme-toggle-container {
    margin-right: 0.5rem;
  }
}

/* Navigation theme toggle styles */
.nav-theme-toggle {
  display: flex;
  align-items: center;
  margin: 0;
  position: relative;
  z-index: 100;
}

.nav-theme-toggle .theme-toggle {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  pointer-events: all;
  position: relative;
  z-index: 101;
  box-shadow: none;
}

.nav-theme-toggle .theme-toggle:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.15);
}

.nav-theme-toggle .theme-toggle:active {
  transform: translateY(0) scale(0.98);
  background: var(--accent, #32d399);
}

.nav-theme-toggle .theme-toggle-icon {
  font-size: 0.9rem;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.9);
}

/* Navigation integration */
.theme-section {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 100;
}

.top-nav .theme-section {
  margin: 0 0.5rem;
}

/* Light theme navigation toggle */
:root[data-theme="light"] .nav-theme-toggle .theme-toggle {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: none !important;
}

:root[data-theme="light"] .nav-theme-toggle .theme-toggle:hover {
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

:root[data-theme="light"] .nav-theme-toggle .theme-toggle-icon {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Header integration styles */
#header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

#logo-box {
  flex: 0 0 auto;
}

#user-area {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  #header-inner {
    gap: 0.5rem;
  }

  .theme-toggle-container {
    order: 1;
    margin-left: 0.5rem;
    margin-right: 0;
  }
}

/* Animation for theme switching */
@keyframes themeSwitch {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.theme-toggle.switching .theme-toggle-icon {
  animation: themeSwitch 0.6s ease-in-out;
}
