/* Header Controls Container */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Theme Toggle - Draggable */
.theme-toggle-container {
  position: relative;
  width: 70px;
  height: 32px;
  cursor: grab;
  user-select: none;
}

.theme-toggle-container:active {
  cursor: grabbing;
}

.theme-toggle-track {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ffd700 0%, #ff6b35 100%);
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.4s ease;
}

body.dark-mode .theme-toggle-track {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.theme-icon {
  font-size: 14px;
  z-index: 1;
  transition: all 0.3s ease;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sun-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  color: #ffd700;
}

.moon-icon {
  opacity: 0.5;
  transform: scale(0.8) rotate(-20deg);
  color: #e0e0e0;
}

body.dark-mode .sun-icon {
  opacity: 0.5;
  transform: scale(0.8) rotate(180deg);
}

body.dark-mode .moon-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  color: #ffd700;
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: left 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 2;
}

body.dark-mode .theme-toggle-thumb {
  /* Position handled by JavaScript for responsiveness */
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Menu Toggle Button */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.menu-toggle span {
  width: 28px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-green),
    var(--vibrant-green)
  );
  border-radius: 3px;
  transition: all 0.3s ease;
}

.menu-toggle:hover span {
  background: linear-gradient(
    90deg,
    var(--vibrant-green),
    var(--primary-green)
  );
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: linear-gradient(135deg, var(--white) 0%, var(--off-white) 100%);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1002;
  transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow-y: auto;
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: linear-gradient(
    135deg,
    var(--primary-green) 0%,
    var(--vibrant-green) 100%
  );
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-header h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 800;
}

.sidebar-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  font-size: 2.5rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.sidebar-content {
  padding: 1.5rem 2rem 2rem;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 1.2rem;
  color: var(--primary-green);
  margin-bottom: 1rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--light-gray);
}

.sidebar-section ul {
  list-style: none;
}

.sidebar-section ul li {
  margin-bottom: 0.5rem;
}

.sidebar-section a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--dark-gray);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 1.05rem;
}

.sidebar-section a:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 106, 78, 0.1) 0%,
    rgba(0, 168, 107, 0.1) 100%
  );
  color: var(--primary-green);
  transform: translateX(8px);
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile responsive for menu and theme toggle */
@media (max-width: 968px) {
  .nav-menu {
    display: none;
  }

  .sidebar {
    width: 320px;
    right: -340px;
  }

  .header-controls {
    gap: 1rem;
  }

  .theme-toggle-container {
    width: 60px;
    height: 28px;
  }

  .theme-toggle-thumb {
    width: 22px;
    height: 22px;
    top: 3px;
  }

  /* Dark mode thumb position handled by JavaScript */

  .theme-icon {
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .menu-toggle {
    display: flex !important;
  }

  .header-controls {
    gap: 0.75rem;
  }

  .theme-toggle-container {
    width: 56px;
    height: 26px;
  }

  .theme-toggle-thumb {
    width: 20px;
    height: 20px;
    top: 3px;
  }

  /* Dark mode thumb position handled by JavaScript */

  .theme-icon {
    font-size: 11px;
  }

  .nav-container {
    padding: 0.75rem var(--spacing-sm);
  }

  .logo-text {
    font-size: 1.5rem;
  }

  .logo-domain {
    font-size: 1.35rem;
  }
}

@media (max-width: 480px) {
  .theme-toggle-container {
    width: 52px;
    height: 24px;
  }

  .theme-toggle-thumb {
    width: 18px;
    height: 18px;
    top: 3px;
  }

  /* Dark mode thumb position handled by JavaScript */

  .theme-icon {
    font-size: 10px;
  }

  .menu-toggle span {
    width: 24px;
    height: 2.5px;
  }
}
