/* ===================================
   THEME TOGGLE BUTTON - Top Right
   =================================== */

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001; /* Above navbar */
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.theme-toggle-track {
  position: relative;
  width: 65px;
  height: 32px;
  background: linear-gradient(135deg, rgba(10, 25, 41, 0.9), rgba(5, 13, 24, 0.9));
  border: 2px solid rgba(0, 212, 255, 0.4);
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover .theme-toggle-track {
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
  transform: scale(1.05);
}

.theme-icon {
  font-size: 1.1rem;
  z-index: 1;
  transition: all 0.3s ease;
  opacity: 0.5;
}

.theme-toggle-thumb {
  position: absolute;
  left: 3px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #0066CC, #00D4FF);
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 10px rgba(0, 212, 255, 0.5);
}

/* Light Mode State */
.theme-toggle.light-mode .theme-toggle-track {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(250, 251, 252, 0.95));
  border-color: rgba(0, 168, 204, 0.4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-toggle.light-mode:hover .theme-toggle-track {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.theme-toggle.light-mode .theme-toggle-thumb {
  left: 36px;
  background: linear-gradient(135deg, #FF8C00, #FFA500);
  box-shadow: 0 2px 10px rgba(255, 140, 0, 0.5);
}

.theme-toggle.light-mode .sun-icon {
  opacity: 1;
}

.theme-toggle.light-mode .moon-icon {
  opacity: 0.3;
}

.theme-toggle:not(.light-mode) .sun-icon {
  opacity: 0.3;
}

.theme-toggle:not(.light-mode) .moon-icon {
  opacity: 1;
}

/* Animation on click */
.theme-toggle:active .theme-toggle-thumb {
  transform: scale(0.85);
}

/* Make sure it's visible on navbar scroll */
.navbar.scrolled ~ .theme-toggle {
  background: rgba(10, 25, 41, 0.3);
  border-radius: 50px;
  padding: 4px;
}

/* Responsive */
@media (max-width: 968px) {
  .theme-toggle {
    top: 15px;
    right: 80px; /* Leave space for mobile menu button */
  }

  .theme-toggle-track {
    width: 58px;
    height: 28px;
  }

  .theme-toggle-thumb {
    width: 20px;
    height: 20px;
  }

  .theme-toggle.light-mode .theme-toggle-thumb {
    left: 33px;
  }

  .theme-icon {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .theme-toggle {
    top: 12px;
    right: 70px;
  }
}
