$bg-dark: #121212;
$bg-card: #1e1e1e;
$bg-input: #2d2d2d;
$bg-item: #2a2a2a;
$bg-item-hover: #333333;
$accent-blue: #4f46e5;
$accent-hover: #6366f1;
$text-primary: #f5f5f5;
$text-secondary: #a0a0a0;
$text-tertiary: #777777;
$border-color: rgba(255, 255, 255, 0.1);
$tooltip-bg: rgba(0, 0, 0, 0.85);
$shadow-color: rgba(0, 0, 0, 0.5);
$status-green: #22c55e;
$status-red: #ef4444;
$transition-default: all 0.2s ease;

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

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

// Container
.tools-popup-container {
  display: flex;
  flex-direction: column;
  min-height: 500px;
  max-height: 500px;
  width: 350px; // Match LLM popup width
  overflow: hidden;
  border-radius: 8px;
  background-color: $bg-card; // Match LLM popup background
  box-shadow: 0 10px 40px $shadow-color; // Match LLM popup shadow
  color: $text-primary;
  font-family: "Inter", sans-serif;
  border: 1px solid $border-color;
  animation: fadeIn 0.3s ease;
  position: relative;
}

.header {
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: 0px; // Match LLM popup header padding

  .list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;

    input {
      flex: 1;
      padding: 7px 14px;
      border-radius: 6px;
      background-color: $bg-input;
      color: $text-primary;
      font-size: 13px;
      border: 1px solid $border-color;
      transition: $transition-default;
      outline: none;

      &::placeholder {
        color: $text-tertiary;
      }

      &:focus {
        border-color: $accent-blue;
        box-shadow: 0 0 0 2px rgba($accent-blue, 0.15);
      }
    }

    .filter-button {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background-color: $bg-input;
      color: $text-secondary;
      border-radius: 6px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      transition: $transition-default;
      border: none;

      i {
        font-size: 14px;
        width: 14px;
        height: 14px;
        margin-bottom: 2px;
      }

      &:hover {
        background-color: lighten($bg-input, 5%);
        color: $text-primary;
      }
    }
  }
}

.menu-header {
  display: flex;
  justify-content: flex-start;
  padding: 0;
  margin-bottom: 8px; // Match LLM popup spacing
  border-bottom: 1px solid $border-color;
  gap: 10px;

  button {
    background: transparent;
    border: none;
    color: $text-secondary;
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;

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

    &.active {
      color: $accent-blue;
      border-bottom: 2px solid $accent-blue;
    }
  }
}

// Body Section - Match LLM popup structure
.body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

// Loading spinner
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
  width: 100%;
}

.dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: $accent-blue;
  animation: dot-animation 1.5s infinite ease-in-out;
}

.dot:nth-child(1) {
  animation-delay: 0s;
}

.dot:nth-child(2) {
  animation-delay: 0.3s;
}

.dot:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes dot-animation {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

// Empty State
.no-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: $text-secondary;

  p {
    margin-bottom: 1rem;
    font-size: 13px;
  }

  .create-tool-btn {
    background-color: $accent-blue;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: $transition-default;
    border: none;
    cursor: pointer;

    &:hover {
      background-color: $accent-hover;
      transform: translateY(-1px);
    }

    .plus-icon {
      font-size: 16px;
    }
  }
}

.tools-list {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

.python-tools {
  animation: fadeIn 0.3s ease;
}

.footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px;
  border-top: 1px solid $border-color;
  gap: 8px;
  .save-btn {
    background-color: $accent-blue;
    color: white;
    padding: 7px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: $transition-default;
    border: none;

    &:hover {
      background-color: $accent-hover;
    }

    &:active {
      transform: translateY(0px);
      box-shadow: none;
    }
  }
  .cancel-button {
    padding: 7px 14px;
    background-color: transparent;
    border: none;
    color: $text-secondary;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: $transition-default;

    &:hover {
      color: $text-primary;
      background-color: rgba(255, 255, 255, 0.1);
    }
  }
}
