/* ===== BASE STYLES ===== */
#navbar {
  position: fixed;
  top: 50%;
  left: 10px; /* Margin from left */
  transform: translateY(-50%); /* Perfect vertical centering */
  width: 100px;
  height: 98vh;
  max-height: 98.5vh; /* Prevents touching edges */
  border-radius: 20px;
  backdrop-filter: blur(1px);
  transition: all 0.2s ease;
  z-index: 100;
  margin: 0; /* Replaced with individual positioning */
  box-sizing: border-box;
}

#navbar.expanded {
  width: 250px;
}

.main-content.expanded {
	transition: all 0.9s ease;
  margin: 0 0 0 20vw !important;
}

.mainnav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: calc(100% - 100px);
}

/* ===== TOGGLE SWITCH ===== */
.switch {
  position: absolute;
  display: inline-block;
  width: 60px;
  height: 34px;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 10px;
  transition: background-color 0.4s;
  overflow: hidden;
}

.slider:before {
  content: "";
  position: absolute;
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  border-radius: 5px;
  transition: transform 0.4s ease;
  z-index: 1;
}

.theme-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  left: 7px; /* Matches slider:before initial position */
  bottom: 7px;
  z-index: 2;
  pointer-events: none;
  transition: transform 0.4s ease;
}

.morph-path {
  transition: fill 0.4s ease;
}

/* Checked states */

.switch input:checked + .slider:before {
  transform: translateX(26px);
}

.switch input:checked + .slider .theme-icon {
  transform: translateX(26px);
}

/* ===== MENU STYLES (FIXED SVG SIZE) ===== */
.menu {
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.menu label {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  position: relative;
}

.menuinput {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.menu svg {
  display: block;
  position: relative;
  z-index: 1;
}

.menu rect {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.menu:hover rect {
  opacity: 0.3;
}

.menu path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  --length: 24;
  --offset: -38;
  stroke-dasharray: var(--length) var(--total-length);
  stroke-dashoffset: var(--offset);
  transition: all 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Menu animation states */
.menu--1 .line--1,
.menu--1 .line--3 {
  --total-length: 126.64183044433594;
}

.menu--1 .line--2 {
  --total-length: 70;
}

.menu--1 input:checked + svg .line--1,
.menu--1 input:checked + svg .line--3 {
  --length: 22.627416998;
  --offset: -94.1149185097;
}

.menu--1 input:checked + svg .line--2 {
  --length: 0;
  --offset: -50;
}

/* ===== NAVIGATION ITEMS ===== */
.navbutton {
  display: flex;
  align-items: center;
  padding: 30px;
  text-decoration: none;
}

.navicon {
  width: 40px;
  height: 40px;
  padding-right: 15px;
  transition: all 0.4s ease;
}

.navtext {
  font-size: 25px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

/* Collapsed state */
#navbar:not(.expanded) .navicon {
  padding: 0;
  width: 50px;
  height: 50px;
}

#navbar:not(.expanded) .navtext {
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
}

/* Component Styles */
#navbar {
  background-color: var(--navbar-bg-light);
  backdrop-filter: blur(8px);
}

.dark-mode #navbar {
  background-color: var(--navbar-bg-dark);
}

.slider {
  background-color: var(--primary-light);
}

.dark-mode .slider {
  background-color: var(--primary-dark);
}

.slider:before {
  background-color: var(--purple-400);
}

.dark-mode .slider:before {
  background-color: var(--purple-700);
}

.morph-path {
  fill: var(--purple-800);
}

.dark-mode .morph-path {
  fill: var(--purple-300);
}

.navicon-path {
  fill: var(--primary-light);
}

.dark-mode .navicon-path {
  fill: var(--primary-dark);
}
