.terminal-filter-box-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  margin-right: 6px;
  z-index: 10;
  width: auto;
  height: 18px;
  transition: all 0.15s ease;

  &:hover,
  &.is-hovered {
    z-index: 10000;
  }

  &:last-child {
    margin-right: 0;
  }
}

.terminal-box {
  min-width: 30px;
  height: 18px;
  background: #E1E4EA;
  color: #212121;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.36px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-sizing: border-box;
  gap: 2px;
  position: relative;
  white-space: nowrap;

  &.hovered {
    border: 1px solid #FFA600;
  }

  &.active {
    border: 1px solid #FFA600;
    background: #E1E4EA;
    padding-right: 6px;
  }

  .terminal-abbr {
    flex-shrink: 0;
  }

  .chip-x {
    display: inline-block;
    width: 12px;
    height: 12px;
    line-height: 12px;
    text-align: center;
    border-radius: 50%;
    background: #B0B0B0;
    cursor: pointer;
    color: white;
    margin-left: 4px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 300;
    transition: all 0.1s ease;

    &:hover {
      background: #9A9A9A;
    }
  }
}

.terminal-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid #E1E4EA;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  min-width: 160px;
  width: max-content;
  max-width: 220px;
  padding: 4px;
  animation: slideInFromTop 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  white-space: nowrap;
  transform-origin: top center;

  /* Create an invisible bridge between box and dropdown for hover */
  &::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 10px;
    pointer-events: auto;
    z-index: 99999;
  }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.1s ease;

    &:hover {
      background-color: #F5F5F5;
    }

    &.active {
      background-color: #FFF8DD;
    }
  }

  .status-box {
    width: 30px;
    height: 18px;
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.36px;
    line-height: 1;
    flex-shrink: 0;
    box-sizing: border-box;

    &.unplanned {
      background: #E1E4EA;
      color: #212121;
    }

    &.planned {
      background: #FFA600;
      color: white;
    }

    &.done {
      background: #1E9F22;
      color: white;
    }

    &.all {
      background: linear-gradient(90deg, #E1E4EA 33%, #FFA600 33%, #FFA600 66%, #1E9F22 66%);
      color: #212121;
      font-size: 9px;
      font-weight: 700;
    }
  }

  .status-label {
    flex: 1;
    font-size: 13px;
    color: #212121;
  }

  .status-count {
    font-size: 12px;
    color: #666;
  }
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

