/* Hidden checkbox */
#darkModeToggle {
  display: none;
}

.toggle-label {
  position: relative;
  float: right;
  width: 120px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #FFFFFF;
  display: block;
}

/* Background layers */
.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: all 0.6s ease;
}

.day-bg {
  background: linear-gradient(135deg, #87CEEB 0%, #B8E6F7 50%, #E0F6FF 100%);
  opacity: 1;
}

.night-bg {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d3561 50%, #16213e 100%);
  opacity: 0;
}

#darkModeToggle:checked~.wrapper .toggle-container .day-bg {
  opacity: 0;
}

#darkModeToggle:checked~.wrapper .toggle-container .night-bg {
  opacity: 1;
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 34px;
  height: 34px;
  background: #FFD700;
  border-radius: 50%;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3);
  z-index: 10;
}

#darkModeToggle:checked~.wrapper .toggle-container .toggle-slider {
  transform: translateX(80px);
  background: #E6E6FA;
  box-shadow: 0 4px 16px rgba(230, 230, 250, 0.2);
}

/* Sun rays */
.sun-rays {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: all 0.4s ease;
}

#darkModeToggle:checked~.wrapper .toggle-container .sun-rays {
  opacity: 0;
  transform: rotate(180deg);
}

/* Moon craters */
.moon-craters {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: all 0.4s ease 0.2s;
}

#darkModeToggle:checked~.wrapper .toggle-container .moon-craters {
  opacity: 1;
}

.crater {
  position: absolute;
  background: #D3D3D3;
  border-radius: 50%;
}

.crater:nth-child(1) {
  width: 6px;
  height: 6px;
  top: 10px;
  right: 8px;
}

.crater:nth-child(2) {
  width: 4px;
  height: 4px;
  top: 18px;
  right: 12px;
}

.crater:nth-child(3) {
  width: 3px;
  height: 3px;
  top: 13px;
  right: 16px;
}

/* Clouds */
.cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.9;
  transition: all 0.6s ease;
  animation: float 4s ease-in-out infinite;
}

.cloud:before,
.cloud:after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50px;
}

.cloud1 {
  width: 24px;
  height: 12px;
  top: 8px;
  right: 12px;
  animation: float1 4s ease-in-out infinite;
}

.cloud1:before {
  width: 16px;
  height: 16px;
  top: -8px;
  left: 4px;
}

.cloud1:after {
  width: 12px;
  height: 12px;
  top: -6px;
  right: 4px;
}

.cloud2 {
  width: 20px;
  height: 10px;
  bottom: 10px;
  right: 15px;
  animation: float2 5s ease-in-out infinite;
}

.cloud2:before {
  width: 14px;
  height: 14px;
  top: -6px;
  left: 2px;
}

.cloud2:after {
  width: 10px;
  height: 10px;
  top: -4px;
  right: 2px;
}

.cloud3 {
  width: 18px;
  height: 9px;
  top: 22px;
  right: 8px;
  animation: float1 3.5s ease-in-out infinite;
  animation-delay: -1s;
}

.cloud3:before {
  width: 12px;
  height: 12px;
  top: -5px;
  left: 2px;
}

.cloud3:after {
  width: 8px;
  height: 8px;
  top: -3px;
  right: 2px;
}

.cloud4 {
  width: 22px;
  height: 11px;
  top: 5px;
  right: 35px;
  animation: float2 4.5s ease-in-out infinite;
  animation-delay: -2s;
}

.cloud4:before {
  width: 14px;
  height: 14px;
  top: -6px;
  left: 3px;
}

.cloud4:after {
  width: 10px;
  height: 10px;
  top: -4px;
  right: 3px;
}

.cloud5 {
  width: 16px;
  height: 8px;
  bottom: 8px;
  right: 40px;
  animation: float1 5.5s ease-in-out infinite;
  animation-delay: -0.5s;
}

.cloud5:before {
  width: 10px;
  height: 10px;
  top: -4px;
  left: 2px;
}

.cloud5:after {
  width: 8px;
  height: 8px;
  top: -3px;
  right: 2px;
}

#darkModeToggle:checked~.wrapper .toggle-container .cloud {
  opacity: 0;
  transform: translateX(-20px);
}

/* Stars */
.star {
  position: absolute;
  background: white;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0;
  transition: all 0.4s ease;
}

#darkModeToggle:checked~.wrapper .toggle-container .star {
  opacity: 1;
  animation: twinkle 2s ease-in-out infinite alternate;
}

.star1 {
  width: 5px;
  height: 5px;
  top: 10px;
  left: 20px;
  animation-delay: 0s;
}

.star2 {
  width: 3px;
  height: 3px;
  top: 22px;
  left: 12px;
  animation-delay: 0.5s;
}

.star3 {
  width: 4px;
  height: 4px;
  top: 28px;
  left: 28px;
  animation-delay: 1s;
}

.star4 {
  width: 3px;
  height: 3px;
  top: 15px;
  left: 35px;
  animation-delay: 1.5s;
}

.star5 {
  width: 3px;
  height: 3px;
  top: 25px;
  left: 16px;
  animation-delay: 0.3s;
}

.star6 {
  width: 2px;
  height: 2px;
  top: 8px;
  left: 30px;
  animation-delay: 0.8s;
}

.star7 {
  width: 3px;
  height: 3px;
  top: 18px;
  left: 42px;
  animation-delay: 1.2s;
}

.star8 {
  width: 2px;
  height: 2px;
  top: 30px;
  left: 38px;
  animation-delay: 0.2s;
}

.star9 {
  width: 4px;
  height: 4px;
  top: 12px;
  left: 8px;
  animation-delay: 1.8s;
}

.star10 {
  width: 2px;
  height: 2px;
  top: 32px;
  left: 8px;
  animation-delay: 0.7s;
}

.star11 {
  width: 3px;
  height: 3px;
  top: 20px;
  left: 25px;
  animation-delay: 1.3s;
}

.star12 {
  width: 2px;
  height: 2px;
  top: 6px;
  left: 15px;
  animation-delay: 2.1s;
}

@keyframes float1 {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes float2 {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-2px);
  }
}

@keyframes twinkle {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Container for the entire toggle */
.toggle-container {
  position: relative;
  padding: 8px 30px;
}
