/* Desktop floating nav */
#floating-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffff;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 9999;
  padding: 5px 10px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
}

#floating-nav ul {
  list-style: none;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 0;
  padding: 0;
}

#floating-nav ul li {
  margin: 0;
}

.header-btn,
#floating-nav ul li a,
#floating-nav ul li button {
  background-color: #000000;
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 6px 14px;
  border-radius: 25px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  position: relative;
}

.header-btn i {
  font-size: 20px;
  display: block;
  text-align: center;
}

.header-btn:hover,
#floating-nav ul li a:hover,
#floating-nav ul li button:hover {
  background-color: #005f8d;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.header-btn:focus {
  outline: none;
}

#toggle-nav {
  display: none;
  position: fixed;
  bottom: 2vw;
  right: 2vw;
  z-index: 10000;
  background-color: #000000;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Mobile layout and animation */
@media (max-width: 768px) {
  #toggle-nav {
    display: block;
  }

  #toggle-nav i {
    font-size: 24px;
    color: #fff;
  }

  #floating-nav {
    background: none;
    top: auto;
    left: auto;
    bottom: calc(2vw + 60px);
    right: 2vw;
    transform: none;
    border: none;
    display: none;
    box-shadow: none;
  }

  #floating-nav.active {
    display: block;
  }

  #floating-nav ul {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }

  .header-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  /* Default hidden state */
  #floating-nav:not(.active) .header-btn i {
    opacity: 0;
    transform: translateY(20px);
    animation: none !important;
  }

  .header-btn i {
    font-size: 28px;
    color: #a84dfa;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.5s ease-out forwards;
  }

  .header-btn:hover i {
    color: #005f8d;
  }

  #floating-nav ul li:nth-child(1) i { animation-delay: 0.1s; }
  #floating-nav ul li:nth-child(2) i { animation-delay: 0.2s; }
  #floating-nav ul li:nth-child(3) i { animation-delay: 0.3s; }
  #floating-nav ul li:nth-child(4) i { animation-delay: 0.4s; }
  #floating-nav ul li:nth-child(5) i { animation-delay: 0.5s; }
  #floating-nav ul li:nth-child(6) i { animation-delay: 0.6s; }

  /* Reverse-closing animation */
  #floating-nav.hiding .header-btn i {
    animation: slideDown 0.3s ease-in forwards !important;
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideDown {
    from {
      opacity: 1;
      transform: translateY(0);
    }
    to {
      opacity: 0;
      transform: translateY(20px);
    }
  }
}
