/**
 * 항적 조회 뷰어 스타일
 * 참조: mda-react-front TrackQueryViewer.scss
 * 위치: 화면 하단 중앙 고정, 드래그 이동 가능
 */

.track-query-viewer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  width: 520px;
  background: rgba(22, 27, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 900;
  color: #ddd;
  font-size: 12px;
  backdrop-filter: blur(8px);

  // === Header ===
  &__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: grab;
    user-select: none;

    &:active {
      cursor: grabbing;
    }
  }

  &__header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  &__header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
  }

  &__ship-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
  }

  &__badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;

    &--id {
      background: rgba(255, 255, 255, 0.08);
      color: #aab;
    }

    &--kind {
      background: rgba(79, 195, 247, 0.15);
      color: #4fc3f7;
    }

    &--signal {
      background: rgba(129, 199, 132, 0.15);
      color: #81c784;
    }

    &--integrated {
      background: rgba(255, 183, 77, 0.15);
      color: #ffb74d;
    }
  }

  &__loading-badge {
    padding: 1px 6px;
    background: #4fc3f7;
    border-radius: 3px;
    font-size: 10px;
    color: #fff;
    font-weight: 600;
    animation: tqv-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
  }

  &__close-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.15s;

    &:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
      border-color: rgba(255, 255, 255, 0.2);
    }
  }

  // === Body ===
  &__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
  }

  // === Error / Loading / Empty ===
  &__error {
    padding: 6px 10px;
    background: rgba(255, 68, 68, 0.12);
    border: 1px solid rgba(255, 68, 68, 0.25);
    border-radius: 4px;
    color: #ff6b6b;
    font-size: 12px;
  }

  &__loading {
    text-align: center;
    padding: 20px 0;
    color: #8b95a5;
    font-size: 12px;
  }

  &__empty {
    text-align: center;
    padding: 20px 0;
    color: #8b95a5;
    font-size: 12px;
  }

  // === Progress Section ===
  &__progress-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  &__time-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }

  &__time-start,
  &__time-end {
    font-size: 11px;
    color: #7a8494;
    flex-shrink: 0;
  }

  &__time-current {
    font-size: 13px;
    font-weight: 600;
    color: #4fc3f7;
    font-variant-numeric: tabular-nums;
  }

  &__progress-bar {
    position: relative;
    height: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
  }

  &__progress-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background: #2a2d3a;
    border-radius: 3px;
  }

  &__progress-fill {
    position: absolute;
    left: 0;
    height: 6px;
    background: #4fc3f7;
    border-radius: 3px;
    transition: width 0.05s ease-out;
  }

  &__progress-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #4fc3f7;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: left 0.05s ease-out;

    &:hover {
      transform: translate(-50%, -50%) scale(1.15);
    }
  }

  // === Options ===
  &__options {
    display: flex;
    gap: 16px;
    padding-top: 2px;
  }

  &__option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #8b95a5;
    cursor: pointer;
    user-select: none;

    input[type='checkbox'] {
      accent-color: #4fc3f7;
      width: 13px;
      height: 13px;
    }

    &:hover {
      color: #bcc;
    }
  }

  // === Time Form ===
  &__time-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
  }

  &__form-label {
    font-size: 11px;
    color: #7a8494;
    white-space: nowrap;
    flex-shrink: 0;
  }

  &__time-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
  }

  &__time-separator {
    color: #5a6374;
    font-size: 12px;
    flex-shrink: 0;
  }

  &__datetime-input {
    flex: 1;
    min-width: 0;
    padding: 3px 6px;
    background: #1a1d28;
    border: 1px solid #333a4a;
    border-radius: 4px;
    color: #ccc;
    font-size: 11px;
    outline: none;
    font-family: inherit;

    &:focus {
      border-color: #4fc3f7;
    }

    &::-webkit-calendar-picker-indicator {
      filter: invert(0.6);
    }
  }

  &__query-btn {
    padding: 4px 14px;
    height: 26px;
    background: #4fc3f7;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;

    &:hover {
      background: #3cb0e0;
    }

    &:disabled {
      background: #3a4050;
      color: #6a7080;
      cursor: not-allowed;
    }
  }

  // === Equipment Filter ===
  &__equipment-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
  }

  &__filter-title {
    font-size: 11px;
    color: #7a8494;
    white-space: nowrap;
    flex-shrink: 0;
  }

  &__filter-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }

  &__filter-btn {
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: #8b95a5;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;

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

  &__equipment-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }

  &__equipment-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid #555;
    border-radius: 4px;
    color: #666;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;

    &.active {
      color: #fff;
      border-color: transparent;
    }

    &.no-data {
      opacity: 0.3;
      cursor: not-allowed;
    }

    &:not(.no-data):hover {
      opacity: 0.85;
      transform: scale(1.05);
    }
  }

  // === Stats ===
  &__stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #7a8494;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
  }

  // === Vessel List ===
  &__vessel-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 120px;
    overflow-y: auto;
  }

  &__vessel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;

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

    &.disabled {
      opacity: 0.35;
    }
  }

  &__vessel-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
  }

  &__vessel-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ccc;
  }

  &__vessel-kind {
    color: #7a8494;
    font-size: 11px;
    flex-shrink: 0;
  }

  &__vessel-points {
    color: #5a6374;
    font-size: 11px;
    flex-shrink: 0;
  }
}

@keyframes tqv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
