@font-face {
  font-family: Nunito;
  src: URL("../fonts/Nunito-VariableFont_wght.ttf") format("truetype");
}
* {
  margin: 0;
  padding: 0;
  font-family: Nunito;
}

$sidebarColor1: #3b3f52;
$sidebarColor2: #3b3f52;

:root {
  color-scheme: light dark;
  --outlineColor: #d0d0d02f;
  --sidebarColor1: #{$sidebarColor1};
  --sidebarColor2: #{$sidebarColor2};

  --sidebarBackground: linear-gradient(
    var(--sidebarColor1),
    var(--sidebarColor2)
  );

  --sidebarFooterBackground: var(--sidebarColor2);
  --themeColorLight: #{saturate(lighten($sidebarColor1, 60%), 10%)};
  --themeColorDark: #{rgba(lighten($sidebarColor1, 15%), 0.7)};
  --onBackgroundColor: light-dark(black, white);
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
::selection {
  background-color: var(--themeColorDark);
}

#sidebar {
  width: 100% !important;
  position: fixed;
  top: 0;
  bottom: 0;
  background: var(--sidebarBackground);
  padding-left: 10px;
}

#sidebar::-webkit-scrollbar {
  width: 0px;
  height: 0px;
}

#sidebar-header {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 10px;
}

#sidebar-header button {
  border: none;
  background: transparent;
}

#sidebar-header button i {
  font-size: 15px;
  color: light-dark(var(--themeColorDark), var(--themeColorLight));
  opacity: 0.8;
  border-radius: 5px;
  margin-bottom: 2px;
  transition: 0.1s;
  &:hover {
    color: light-dark(var(--themeColorDark), var(--onBackgroundColor));
  }
}

#page-control {
  display: flex;
  margin: 10px;
  padding: 0 5px;
  width: 100%;
  flex-direction: row;
  justify-content: flex-end;
  gap: 12px;
  & button i {
    font-size: 16px;
    opacity: 0.8;
    &:hover {
      opacity: 1;
    }
  }
}

#action-buttons {
  display: flex;
  margin-right: auto;
  gap: 7px;
  & button i {
    opacity: 0.5;
    font-size: 15px;
    &:hover {
      opacity: 0.9;
    }
  }
}

.address-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 12px;
  width: 100%;
  border-radius: 14px;
  background: light-dark(
    #{rgba(saturate(lighten($sidebarColor1, 20%), 10%), 0.1)},
    #d1d1d113
  ) !important;
  transition: scale 0.1s;
  &:active {
    scale: 0.98;
  }
}

#sidebar-header input {
  border: none;
  width: 100%;
  font-size: 15px;
  text-decoration: none;
  background: none;
  outline: none;
}

#sidebar-content {
  display: block;
  overflow-y: scroll;
  height: 100%;
  padding-bottom: 225px;
}

#sidebar-content hr {
  border: 0;
  height: 1px;
  background: var(--outlineColor);
}

body {
  & #separator span {
    opacity: 0;
    position: absolute;
    margin-top: -6px;
    background: var(--sidebarColor1);
    right: 0;
    margin-right: -3px;
    padding-left: 8px;
    transition: 0.1s;
    color: light-dark(rgba(0, 0, 0, 0.7), rgba(255, 255, 255, 0.7));
  }
  & #separator span i {
    margin-right: 5px;
    transition: 0.1s;
  }
  &:hover #separator span {
    opacity: 1;
    margin-right: 0;
    &:hover {
      color: light-dark(black, white);
    }
    &:active i {
      transform: translateY(2px);
    }
  }
}

#sidebar-content ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin-top: 10px;
}

// Tab Style
#sidebar-content ul li {
  display: flex;
  position: relative;
  align-items: center;
  height: 38px;
  padding: 0px 10px;
  width: 100%;
  border-radius: 12px;
  transition: scale 0.2s;
  gap: 10px;
  &:hover {
    background: light-dark(#0000000e, #00000024);
  }
  &.active {
    background: light-dark(white, #ffffff1f);
    &:hover {
      background: light-dark(white, #ffffff2c);
    }
  }
  &:active {
    scale: 0.97;
  }
  // Favicon
  & img {
    width: 16px;
    pointer-events: none;
  }
  & i.fa-volume-high {
    font-size: 10px;
  }
}

.tab-title {
  width: 90%;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fa-globe {
  font-size: 16px;
}

// New Tab Button
#sidebar-content button#new-tab-button {
  padding: 10px;
  border-radius: 12px;
  border: none;
  display: block;
  font-size: 14px;
  background-color: transparent;
  margin-top: 10px;
  width: 100%;
  color: var(--themeColorLight);
  filter: grayscale(0.5);
  transition: scale 0.2s;
  &:hover {
    background-color: #ffffff21;
    color: light-dark(black, white);
  }
  &:active {
    scale: 0.97;
  }
  & i {
    margin: 0 2px;
    margin-right: 4px;
  }

  // Show command on hover
  & span {
    opacity: 0;
    position: relative;
    float: right;
  }
  &:hover span {
    opacity: 1;
  }
}

// Tab Close Button
#sidebar-content ul li button {
  display: none;
}

#sidebar-content ul li:hover button {
  display: block;
  background: transparent;
  margin-left: auto;
  border-radius: 7px;
  padding: 3px 8px;
  margin-right: 5px;
  border: 0;
  scale: 1.3;
  transform: translateX(5px);
  &:hover {
    background: rgba(0, 0, 0, 0.1);
  }
}

// Space Info
div#space-info {
  margin-top: 10px;
  width: 100%;
  display: flex;
  display: none;
}

// Space Name
div#space-info input {
  margin-left: 4px;
  font-size: 13px;
  color: var(--themeColorLight);
  font-weight: 700;
  opacity: 0.7;
}

.footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebarFooterBackground);
  padding: 18px;
  z-index: 1;
}

.footer button {
  border: none;
  background: none;
  color: var(--onBackgroundColor);
  font-size: 20px;
  transition: 0.2s;
}

.floating-div {
  align-items: center;
  gap: 7px;
  position: absolute;
  top: auto;
  bottom: 70px;
  margin: auto !important;
  width: calc(100% - 9px);
  left: 8px;
  padding: 10px;
  background-color: #0000003c;
  backdrop-filter: blur(16px);
  border: none;
  border-radius: 10px;
  color: white;
  animation: divspawn 0.2s;
  & button {
    margin: 0 auto;
    width: 100%;
    padding: 5px;
    padding-left: 10px;
    border-radius: 5px;
    border: none;
    font-size: 14px;
    min-height: 40px;
    color: white;
    background-color: transparent;
    cursor: pointer;
    font-family: Nunito;
    font-weight: 500;
    &:hover {
      background-color: var(--themeColorDark);
      cursor: pointer;
    }
    & i {
      margin-right: 5px;
    }
  }
}

// Favorites
div#favorites {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 8px;
  &:empty {
    height: 7px;
    margin-top: -4px;
    position: relative;
    transform: translateY(20px);
    transition: 0.2s;
    &:-moz-drag-over {
      margin-top: 8px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 18px;
      text-align: center;
      padding: 10px;
      border: 2px solid var(--outlineColor);
      border-style: dashed;
      height: auto;
      transform: translateY(0px);
      &::after {
        content: "Quickly access your most viewed websites by dragging them here";
      }
    }
  }
}
div#favorites button {
  background: light-dark(
    #{rgba(saturate(lighten($sidebarColor1, 20%), 10%), 0.1)},
    #d1d1d113
  ) !important;
  border-radius: 12px !important;
  height: 45px;
  width: 100%;
  display: inline;
  text-align: center;
  padding: 10px !important;
  transition: background 0.1s, scale 0.2s;
  animation: favoritespawn 0.2s;
  &:hover {
    background: light-dark(
      #{rgba(saturate(lighten($sidebarColor1, 20%), 10%), 0.15)},
      #c0c0c023
    ) !important;
  }
  &:active {
    scale: 0.97;
  }
  &.active {
    background: light-dark(white, #c7c7c743) !important;
  }
  // Favicon
  & img {
    width: 17px;
    position: relative;
    top: 10%;
    pointer-events: none;
  }
}

a {
  color: var(--themeColorLight) !important;
}

@media (prefers-color-scheme: light) {
  :root {
    --sidebarColor1: #{lighten($sidebarColor1, 60%)};
    --sidebarColor2: #{lighten($sidebarColor2, 60%)};

    --themeColorLight: #{saturate(darken($sidebarColor1, 60%), 10%)};
    --themeColorDark: #{saturate(lighten($sidebarColor1, 15%), 10%)};
    --outlineColor: #3232322f;
  }
  #sidebar-content ul li.active {
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.211);
  }
  div#favorites button.active {
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.211);
  }
  #action-buttons button i {
    opacity: 0.3;
  }
  #sidebar-content ul li.active:hover button:hover {
    background: rgba(0, 0, 0, 0.2);
  }
  button#new-tab-button:hover {
    background: rgba(0, 0, 0, 0.07) !important;
  }
}

@keyframes divspawn {
  from {
    opacity: 0;
    scale: 0.93;
    margin-bottom: -10px;
    margin-left: -6px;
  }
}
@keyframes favoritespawn {
  from {
    scale: 0.97;
  }
}
