/*마커별 Player+평가 UI*/

/* ── player-wrapper: player + survey 가로 배치 ──────────────── */
.player-wrapper {
  display: flex;
  align-items: stretch;
  max-height: 90vh;
}

/* ── player modal-box ───────────────────────────────────────── */
.modal-box {
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 90vw; max-width: 1088px;
  max-height: 90vh; overflow-y: auto;
  transition: border-radius 0.3s ease;
}
.player-wrapper:has(.survey-panel--open) .modal-box {
  border-radius: 8px 0 0 8px;
}

/* ── player 모달 헤더 ────────────────────────────────────────── */
.player-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}
.player-header-info { display: flex; align-items: center; gap: 10px; }
.player-loc-class {
  font-size: 0.95rem; font-weight: 400; color: #fff;
  border-radius: 4px; padding: 2px 10px;
}
.player-key { font-size: 1rem; font-weight: 700; color: #222; }

/* ── player 모달 내 미디어 영역 ──────────────────────────────── */
.media-section { display: flex; flex-direction: column; gap: 10px; }

.video-wrapper { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 4px; overflow: hidden; }
.video-wrapper video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* 로딩 스피너: 재생 준비될 때까지 검은 화면 위에 표시, 준비되면 player.js가 hidden 클래스 부여 */
.video-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
  transition: opacity 0.2s ease;
}
.video-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 통합 재생 컨트롤: video(무음)+audio를 하나의 UI로 제어 ────── */
.unified-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
}
.btn-play-pause {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: #1a73e8; color: #fff;
  font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.btn-play-pause:hover { background: #1558b0; }
.btn-play-pause:disabled { background: #aaa; cursor: default; }
.progress-bar-wrapper {
  flex: 1; height: 6px; border-radius: 3px; background: #e0e0e0;
  cursor: pointer; position: relative;
}
/* 버퍼링된(로드된) 구간: 유튜브처럼 재생바 뒤에 회색으로 표시 */
.progress-bar-buffered {
  position: absolute; inset: 0; height: 100%; width: 0%;
  border-radius: 3px; background: #b0b0b0;
}
.progress-bar-fill {
  position: relative; height: 100%; width: 0%; border-radius: 3px; background: #1a73e8;
}
.time-display { flex-shrink: 0; font-size: 0.78rem; color: #666; min-width: 78px; text-align: right; }

/* ── 메타정보 + 평가 버튼 ────────────────────────────────────── */
.meta-and-action { position: relative; margin-top: 14px; padding-bottom: 36px; }
.meta-detail-section { display: flex; flex-direction: column; gap: 6px; }
.detail-row      { display: flex; gap: 12px; font-size: 0.85rem; }
.dr-label        { color: #888; min-width: 40px; flex-shrink: 0; }
.dr-val          { color: #222; font-weight: 500; }

.btn-survey {
  position: absolute; bottom: 0; right: 0;
  padding: 7px 16px; background: #7f8c8d; color: #fff;
  border: none; border-radius: 4px; font-size: 0.88rem; cursor: pointer;
}
.btn-survey:hover         { filter: brightness(0.9); }
.btn-survey.disabled-look { opacity: 0.5; cursor: default; }

/* ══════════════════════════════════════════════════════════════
   설문 패널: 오른쪽에서 슬라이드 인 (width = modal-box의 ~0.6배)
   ══════════════════════════════════════════════════════════════ */
.survey-panel {
  background: #fff;
  border-radius: 0 8px 8px 0;
  border-left: 1px solid #eee;
  width: 0;
  max-height: 90vh;
  overflow: hidden;
  overflow-y: auto;
  transition: width 0.3s ease, padding 0.3s ease;
  padding: 0;
  flex-shrink: 0;
}
.survey-panel--open {
  width: min(653px, 60vw);
  padding: 24px;
}

/* ══════════════════════════════════════════════════════════════
   모바일(768px 이하): survey 패널이 오른쪽이 아닌 아래쪽으로 슬라이드
   player-wrapper를 세로 배치로 전환하고 survey-panel은 height로 확장
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .player-wrapper {
    flex-direction: column;
    max-height: 95vh;
    width: 95vw;
  }
  .modal-box {
    width: 100%;
    max-width: none;
    border-radius: 8px;
  }
  .player-wrapper:has(.survey-panel--open) .modal-box {
    border-radius: 8px 8px 0 0;
  }

  .survey-panel {
    width: 100%;
    height: 0;
    border-left: none;
    border-top: 1px solid #eee;
    border-radius: 0 0 8px 8px;
    transition: height 0.3s ease, padding 0.3s ease;
  }
  .survey-panel--open {
    width: 100%;
    height: min(70vh, 560px);
    padding: 20px;
  }
}

/* ── 설문 패널 헤더 ──────────────────────────────────────────── */
.survey-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; white-space: nowrap;
}
.survey-header h3 { font-size: 1rem; }
.btn-close-survey { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #666; }
.btn-close-survey:hover { color: #000; }

.survey-scale-hint { font-size: 0.78rem; color: #888; margin-bottom: 12px; white-space: nowrap; }

/* ── 설문 매트릭스 테이블 (Google Forms 스타일) ───────────────── */
.survey-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.survey-table thead th {
  text-align: center; font-weight: 600; color: #555;
  padding: 6px 12px;
}
.survey-table thead th:first-child { text-align: left; width: 25%; }

.survey-row:nth-child(even) { background: #fafafa; }
.survey-row td {
  padding: 12px 12px; text-align: center; vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}
.survey-row td:first-child { width: 25%; }
.row-label {
  text-align: left; font-size: 0.82rem; color: #333;
  padding-left: 4px; white-space: nowrap;
}
.row-label-en { font-size: 0.72rem; color: #999; }

.survey-row--divider { border-top: 2px solid #ddd; }

/* accent-color만으로는 Windows Chrome 등에서 테두리가 시스템 기본(검정)으로 남는 경우가 있어
   네이티브 렌더링을 끄고 원형을 직접 그려 테두리색까지 완전히 포인트 컬러로 통일 */
.survey-table input[type=radio] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0; cursor: pointer;
  border: 2px solid #bbb; border-radius: 50%;
  outline: none;
  transition: border-color 0.15s ease;
}
.survey-table input[type=radio]:checked {
  border-color: #75B3BD;
  background: #75B3BD;
  box-shadow: inset 0 0 0 3px #fff;
}
.survey-table input[type=radio]:focus-visible {
  outline: 2px solid #75B3BD;    /* 키보드 접근성을 위해 포인트 색상으로 대체 */
  outline-offset: 2px;
}
/* 제출 완료 후 읽기전용 상태: 선택 여부와 무관하게 회색으로 표시 */
.survey-table input[type=radio]:disabled {
  cursor: not-allowed;
  border-color: #ccc;
}
.survey-table input[type=radio]:disabled:checked {
  border-color: #aaa;
  background: #aaa;
}

/* ── 제출 버튼 ───────────────────────────────────────────────── */
.btn-submit {
  width: 100%; margin-top: 14px; padding: 9px;
  background: #75B3BD; color: #fff;
  border: none; border-radius: 4px; font-size: 0.95rem;
  cursor: pointer; white-space: nowrap;
}
.btn-submit:disabled { background: #aaa; cursor: not-allowed; }
.btn-submit:not(:disabled):hover { background: #5f9aa4; }

/* ── 수정하기 버튼: 오른쪽 정렬된 작은 버튼, "평가하기"(.btn-survey)와 동일 색상 ── */
.btn-edit {
  display: block; margin: 14px 0 0 auto; padding: 6px 14px;
  background: #7f8c8d; color: #fff;
  border: none; border-radius: 4px; font-size: 0.82rem;
  cursor: pointer; white-space: nowrap;
}
.btn-edit:hover { filter: brightness(0.9); }