@use 'colors' as *;

$icon-size: 36px;
$dropdown-height: 400px;
$primary-color: #0066cc;
$text-color: #333333;
$bg-color: #ffffff;
$border-color: #e0e0e0;
$shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
$transition-speed: 0.3s;

.settings-icons-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
}

.log-icon-wrapper {
  .log-icon {
    border-radius: 50%;
    background-color: $light-1;
    box-shadow: $shadow;
    width: $icon-size;
    height: $icon-size;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform $transition-speed ease;
    padding: 0;

    &.opened {
      background-color: $light-3;
    }

    &:hover {
      transform: scale(1.1);
    }

    img {
      width: 20px;
      height: 20px;
    }
  }
}

.settings-container {
  position: relative;
  z-index: 1000;
}

.settings-icon-wrapper {
  z-index: 1001;
  .settings-icon {
    border-radius: 50%;
    background-color: $light-1;
    box-shadow: $shadow;
    width: $icon-size;
    height: $icon-size;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform $transition-speed ease;
    padding: 0;

    &.opened {
      background-color: $light-3;
    }

    &:hover {
      transform: rotate(30deg);
    }

    img {
      width: 20px;
      height: 20px;
    }
  }
}

.settings-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: $dropdown-height;
  background-color: $light-3;
  box-shadow: $shadow;
  transform: translateY(-100%);
  transition: transform $transition-speed ease;
  overflow-y: auto;
  color: $light-2;
  z-index: 99;

  &.active {
    transform: translateY(0);
  }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid $border-color;

  h3 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 600;
  }

  .close-settings {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: $text-color;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;

    &:hover {
      background-color: rgba(0, 0, 0, 0.05);
    }
  }
}

.settings-content {
  padding: 16px 24px;
  h4 {
    margin: 0 0 12px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: $light-2;
  }
}

.settings-section {
  margin-bottom: 24px;

}

.setting-option {
  margin-bottom: 12px;

  .pill-toggle {
    display: flex;
    width: 100%;
    max-width: 240px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid $border-color;
    background-color: #f5f5f5;
    position: relative;
  }

  .pill-btn {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color $transition-speed ease;
    font-weight: 500;

    &.active {
      color: white;
    }

    &:focus {
      outline: none;
    }
  }

  .pill-toggle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background-color: $light-20;
    border-radius: 4px;
    transition: transform $transition-speed ease;
    z-index: 0;
  }

  .pill-btn.pill-right.active ~ .pill-toggle::after,
  .pill-toggle:has(.pill-right.active)::after {
    transform: translateX(100%);
  }

  label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95em;
    margin-bottom: 10px;
    margin-top: 20px;

    input {
      margin-right: 8px;
    }

    input[type="checkbox"], input[type="radio"] {
      accent-color: $primary-color;
    }
  }
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 0;
  border-top: 1px solid $border-color;
  margin-top: 16px;
}

.settings-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color $transition-speed ease;
  margin-left: 12px;
}

.settings-btn-save {
  background-color: $primary-color;
  border: 1px solid $primary-color;
  color: white;

  &:hover {
    background-color: darken($primary-color, 10%);
  }
}

.settings-btn-reset {
  background-color: transparent;
  border: 1px solid $border-color;
  color: $text-color;

  &:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
}

@media (min-width: 768px) {
  .settings-dropdown {
    width: 290px;
    right: 0;
    left: auto;
    border-bottom-left-radius: 4px;
    height: auto;
    max-height: 80vh;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-100%);
  }
}
