/**
 * 경비함정 선택 드롭다운 스타일
 */
.patrol-ship-selector {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 32rem;
  max-height: 50rem;
  background-color: rgba(var(--secondary6-rgb), 0.95);
  border-radius: 0.8rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  flex-direction: column;

  // 헤더
  .selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(var(--white-rgb), 0.1);
    flex-shrink: 0;

    .selector-title {
      color: var(--white);
      font-size: 1.4rem;
      font-weight: var(--fw-bold);
    }

    .close-btn {
      width: 2.4rem;
      height: 2.4rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      background: transparent;
      color: rgba(var(--white-rgb), 0.6);
      font-size: 2rem;
      cursor: pointer;
      border-radius: 0.4rem;
      transition: all 0.15s ease;

      &:hover {
        color: var(--white);
        background-color: rgba(var(--white-rgb), 0.1);
      }
    }
  }

  // 검색 영역
  .selector-search {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid rgba(var(--white-rgb), 0.1);
    flex-shrink: 0;

    .search-input-wrapper {
      position: relative;
      width: 100%;
    }

    .search-input {
      width: 100%;
      height: 3.2rem;
      padding: 0 3rem 0 1rem;
      border: 1px solid rgba(var(--white-rgb), 0.2);
      border-radius: 0.4rem;
      background-color: rgba(var(--white-rgb), 0.05);
      color: var(--white);
      font-size: 1.3rem;
      outline: none;
      transition: all 0.15s ease;

      &::placeholder {
        color: rgba(var(--white-rgb), 0.4);
      }

      &:focus {
        border-color: var(--primary1);
        background-color: rgba(var(--white-rgb), 0.1);
      }
    }

    .search-clear-btn {
      position: absolute;
      top: 50%;
      right: 0.6rem;
      transform: translateY(-50%);
      width: 2rem;
      height: 2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      background: transparent;
      color: rgba(var(--white-rgb), 0.5);
      font-size: 1.6rem;
      cursor: pointer;
      border-radius: 0.3rem;

      &:hover {
        color: var(--white);
        background-color: rgba(var(--white-rgb), 0.1);
      }
    }
  }

  // 반경 설정
  .selector-radius {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid rgba(var(--white-rgb), 0.1);
    flex-shrink: 0;

    .radius-label {
      color: rgba(var(--white-rgb), 0.7);
      font-size: 1.2rem;
      flex-shrink: 0;
    }

    .radius-options {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .radius-btn {
      min-width: 3.6rem;
      height: 2.6rem;
      padding: 0 0.6rem;
      border: 1px solid rgba(var(--white-rgb), 0.2);
      border-radius: 0.4rem;
      background-color: transparent;
      color: rgba(var(--white-rgb), 0.7);
      font-size: 1.2rem;
      cursor: pointer;
      transition: all 0.15s ease;

      &:hover {
        border-color: rgba(var(--white-rgb), 0.4);
        color: var(--white);
      }

      &.active {
        border-color: var(--primary1);
        background-color: var(--primary1);
        color: var(--white);
      }
    }

    .radius-unit {
      color: rgba(var(--white-rgb), 0.5);
      font-size: 1.1rem;
      margin-left: 0.3rem;
    }
  }

  // 함정 목록 영역
  .selector-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 10rem;
    max-height: 28rem;

    // 스크롤바 스타일
    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-track {
      background: transparent;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(var(--white-rgb), 0.3);
      border-radius: 3px;

      &:hover {
        background: rgba(var(--white-rgb), 0.5);
      }
    }
  }

  .no-ships {
    padding: 3rem 1.2rem;
    text-align: center;
    color: rgba(var(--white-rgb), 0.5);
    font-size: 1.3rem;
  }

  .ship-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    display: flex;
    flex-direction: column;

    // TopBar li 스타일 상속 초기화
    li {
      height: auto;
      padding: 0;
    }
  }

  .ship-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem !important; // TopBar li:first-child, li:last-child 오버라이드
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    height: auto !important; // TopBar li height: 100% 오버라이드

    &:hover {
      background-color: rgba(var(--primary1-rgb), 0.3);
    }

    .ship-name {
      color: var(--white);
      font-size: 1.3rem;
      font-weight: var(--fw-bold);
      flex: 1;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .ship-id {
      color: rgba(var(--white-rgb), 0.5);
      font-size: 1.1rem;
      margin-left: 1rem;
      flex-shrink: 0;
    }
  }

  // 푸터
  .selector-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid rgba(var(--white-rgb), 0.1);
    flex-shrink: 0;

    .ship-count {
      color: rgba(var(--white-rgb), 0.6);
      font-size: 1.2rem;
    }
  }
}
