/* 録画再生画面（/recordings/playback）専用スタイル。
   scoped CSS のキャッシュ取りこぼしを避けるためグローバルに定義する。
   クラス名は pb- 接頭辞で限定しているため他画面に影響しない。 */

/* ── リアルタイムステータス（再生連動） ───────────────────────────────── */
.pb-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px 20px;
}

.pb-status-item {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default, #eceff1);
}

.pb-status-label {
    font-size: 11px;
    color: var(--mud-palette-text-secondary, #9e9e9e);
    line-height: 1.4;
}

.pb-status-value {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    min-height: 1.6em;
}

/* ── タイムライン ─────────────────────────────────────────────────────── */
/* 固定幅のスクロール枠。解像度(ズーム)を上げてトラックが枠を超えると横スクロールになる。 */
.pb-timeline-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* pb-track の幅 = 24時間軸（インラインで zoom×100% を指定）。時刻ラベル・録画帯・
   シークバーはすべてこの幅に対する left/width(%) で配置するため、左右パディングは付けない。 */
.pb-track {
    position: relative;
    box-sizing: border-box;
    min-width: 100%;
    background: #1e1e1e;
    border-radius: 6px;
    padding: 22px 0 12px 0;
    user-select: none;
    cursor: pointer;
}

.pb-hours {
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    height: 14px;
}

.pb-hour {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: #9e9e9e;
    white-space: nowrap;
}

/* 目盛り線。ラベル位置（major）は長め・中間（minor）は短めの縦線をラベル帯の下端に引く。
   ラベル・線とも解像度（ズーム）に応じた間隔で playbackSync.js が動的に生成する。 */
.pb-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 4px;
    background: rgba(158, 158, 158, 0.5);
    pointer-events: none;
}

.pb-tick-major {
    height: 6px;
    background: rgba(207, 207, 207, 0.75);
}

.pb-cam {
    margin: 8px 0;
}

.pb-cam-name {
    font-size: 10px;
    color: #cfcfcf;
    margin: 0 0 2px 4px;
    line-height: 1.2;
}

/* カメラごとの録画帯。上段=通常録画（赤）/ 下段=イベント録画（黄）の 2 段構成。
   段をクリックすると再生対象の種別が切り替わる（同一時刻の二重再生を防ぐため排他再生）。 */
.pb-cam-bar {
    position: relative;
    height: 14px;
    background: #2c2c2c;
    border-radius: 3px;
    overflow: hidden;
}

.pb-cam-bar + .pb-cam-bar {
    margin-top: 3px;
}

/* 段の左端に置く種別ラベル。絶対配置にして 24 時間軸の %(left/width) 配置を崩さない。 */
.pb-kind-label {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 2;
}

/* 選択中の段は白枠で強調し、非選択の段は減光する（ホバーでクリック可能なことを示す）。 */
.pb-row-selected {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.pb-row-unselected {
    opacity: 0.35;
}

.pb-row-unselected:hover {
    opacity: 0.7;
}

.pb-range {
    position: absolute;
    top: 0;
    height: 100%;
    min-width: 1px;
    border-radius: 2px;
}

.pb-normal {
    background: #e53935;
}

.pb-evt {
    background: #fdd835;
}

.pb-seek-handle {
    position: absolute;
    top: 18px;
    bottom: 8px;
    left: 0;
    width: 2px;
    background: #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    cursor: ew-resize;
    z-index: 5;
}

.pb-seek-handle::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

/* 凡例 */
.pb-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 2px;
}

/* ── 映像（ドライブレコーダー風のタイムスタンプ） ─────────────────────── */
.pb-video-wrap {
    position: relative;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.pb-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

/* 各カメラ映像の左下に再生位置の実時刻を重ねる。値は playbackSync.js が更新する。 */
.pb-video-stamp {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    letter-spacing: 0.5px;
    line-height: 1.5;
    pointer-events: none;
    z-index: 2;
}

/* ── 地図（走行軌跡・現在地・HUD） ─────────────────────────────────────── */
.pb-map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 360px;
}

.pb-map {
    width: 100%;
    height: 100%;
    min-height: 360px;
    border: 0;
    border-radius: 8px;
}

/* 再生位置の HUD（速度・方位・時刻・座標・精度）。地図左上の黒パネル。値は playbackSync.js が更新する。 */
.pb-track-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    z-index: 5;
    pointer-events: none;
    min-width: 150px;
}

.pb-track-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.pb-track-sub {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    font-family: Consolas, "Courier New", monospace;
}

.pb-heading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 400;
}

/* 進行方向の矢印。playbackSync.js が rotate(方位) を設定する。 */
.pb-heading-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    color: #40c4ff;
    transform-origin: 50% 50%;
}

/* 追従 ON/OFF ボタン（地図右上。全画面ボタンの下）。 */
.pb-follow-btn {
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
