/**
 * 선박 범례 스타일
 */
.ship-legend {
  position: absolute;
  right: 70px;
  bottom: 72px;
  z-index: 100;
  width: 160px;
  background: rgba(30, 35, 45, 0.95);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  font-size: 12px;
  color: #fff;

  // 헤더
  .legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    .legend-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;

      .connection-status {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #f44336;
        transition: background 0.3s ease;

        &.connected {
          background: #4caf50;
        }
      }
    }

    // 토글 스위치
    .toggle-switch {
      position: relative;
      display: inline-block;
      width: 36px;
      height: 20px;
      cursor: pointer;

      input {
        opacity: 0;
        width: 0;
        height: 0;

        &:checked + .slider {
          background-color: #2196f3;

          &:before {
            transform: translateX(16px);
          }
        }
      }

      .slider {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #555;
        border-radius: 20px;
        transition: 0.3s;

        &:before {
          content: '';
          position: absolute;
          height: 14px;
          width: 14px;
          left: 3px;
          bottom: 3px;
          background-color: #fff;
          border-radius: 50%;
          transition: 0.3s;
        }
      }
    }
  }

  // 범례 목록
  .legend-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;

    .legend-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 12px;
      transition: background 0.2s ease;

      &:hover {
        background: rgba(255, 255, 255, 0.1);
      }

      &.disabled {
        opacity: 0.4;

        .legend-icon img {
          filter: grayscale(100%);
        }
      }

      .legend-info {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;

        .legend-icon {
          width: 20px;
          height: 20px;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-shrink: 0;

          img {
            width: 16px;
            height: 16px;
            object-fit: contain;
          }
        }

        .legend-label {
          white-space: nowrap;
        }
      }

      .legend-count {
        font-weight: 500;
        color: rgba(255, 255, 255, 0.8);
        min-width: 30px;
        text-align: right;
      }
    }
  }

  // 푸터
  .legend-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;

    .total-count {
      color: #4fc3f7;
    }
  }
}

// 범례 숨김 상태 (선박 표시 Off 시)
.ship-legend.hidden {
  .legend-list {
    max-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .legend-footer {
    display: none;
  }
}
