@use 'sass:color';

// Variables
$panel-bg: #1a1a1a;
$text-primary: rgba(255, 255, 255, 0.95);
$text-secondary: rgba(255, 255, 255, 0.6);
$text-muted: rgba(255, 255, 255, 0.4);
$border-color: rgba(255, 255, 255, 0.08);
$hover-bg: rgba(255, 255, 255, 0.08);
$active-color: #4a90e2;
$active-bg: rgba(74, 144, 226, 0.15);
$transition-fast: 150ms ease;
$transition-normal: 200ms ease;

.quick-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.3);
  animation: fadeIn $transition-normal;
  cursor: pointer;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.quick-settings-panel {
  position: absolute;
  top: 52px;
  right: 60px;
  width: 340px;
  background: $panel-bg;
  border: 1px solid $border-color;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  cursor: default;
}

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

// Pointer arrow
.pointer {
  position: absolute;
  top: -8px;
  right: 18px;
  width: 16px;
  height: 16px;
  background: $panel-bg;
  border-left: 1px solid $border-color;
  border-top: 1px solid $border-color;
  transform: rotate(45deg);
  border-radius: 3px 0 0 0;
}

.panel-body {
  padding: 16px;
}

.control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;

  &:not(:last-child) {
    border-bottom: 1px solid $border-color;
  }

  > label {
    color: $text-primary;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
  }
}

.control-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-label {
  font-size: 12px;
  color: $text-secondary;
  min-width: 60px;
  text-align: right;
}

// Toggle switch
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: background 300ms ease;
  padding: 0;

  &.active {
    background: $active-color;

    .slider {
      transform: translateX(18px);
    }
  }

  .slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 300ms ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  &:hover {
    background: rgba(255, 255, 255, 0.2);

    &.active {
      background: color.adjust($active-color, $lightness: 5%);
    }
  }
}

// Button group
.button-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid $border-color;
}

.option-btn {
  width: 32px;
  height: 28px;
  background: transparent;
  color: $text-secondary;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all $transition-fast;

  &:hover {
    background: $hover-bg;
    color: $text-primary;
  }

  &.active {
    background: $active-color;
    color: white;
  }

  &.text-btn {
    width: auto;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 500;

    &.small {
      padding: 0 6px;
      font-size: 10px;
    }
  }

  &.color-btn {
    padding: 4px;

    &.active {
      background: transparent;
      box-shadow: 0 0 0 2px $active-color;
    }
  }

  .color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
}

.text-btns {
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .quick-settings-panel {
    right: 16px;
    left: 16px;
    width: auto;
    top: 56px;
  }

  .pointer {
    right: 30px;
  }
}
