/* ═══════════════════════════════════════════════════════════════
   Z\σ Playback — Exposure Lab module + time control parity
   Reuses dashboard primitives (.rmod-card, .rmod-pill-option, .dd).
   This file only provides:
     - Page layout
     - Page-scoped overrides for dropdowns / date picker
     - Loading panel + slider styling
     - Time chip + Playback Time display
     - Compact diagnostics
   ═══════════════════════════════════════════════════════════════ */

/* ── Page wrapper ──────────────────────────────────────────── */

.replay-page {
    /* Expose .rmod-card CSS variables on the page so .rmod-pill-option
       used outside .rmod-card (e.g. session bar buttons) resolves them */
    --zs-ctl-dark-bg: rgba(20, 30, 48, 0.58);
    --zs-ctl-dark-bg-hover: rgba(33, 49, 74, 0.76);
    --zs-ctl-dark-border: rgba(58, 78, 112, 0.42);
    --zs-ctl-dark-fg: rgba(182, 199, 221, 0.86);
    --zs-ctl-blue-bg: rgba(45, 108, 255, 0.86);
    --zs-ctl-blue-bg-hover: rgba(67, 124, 255, 0.94);
    --zs-ctl-blue-border: rgba(101, 152, 255, 0.54);
    --zs-ctl-green-bg: rgba(25, 245, 178, 0.84);
    --zs-ctl-green-bg-hover: rgba(46, 252, 190, 0.92);
    --zs-ctl-green-border: rgba(94, 255, 211, 0.42);
    --zs-ctl-green-fg: #04110d;

    padding: 14px 16px 28px;
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Top session bar ───────────────────────────────────────── */

.replay-session-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 6px 0;
    flex-wrap: wrap;
}

.replay-page-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.replay-page-title {
    font-size: 18px;
    font-weight: 700;
    color: rgba(232, 241, 255, 0.95);
    letter-spacing: 0.4px;
}
.replay-page-subtitle {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.2px;
}

.replay-session-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.replay-ctrl-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.replay-ctrl-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    user-select: none;
    min-height: 14px;
    line-height: 14px;
}
.replay-ctrl-label--inline {
    margin-right: 6px;
    align-self: center;
    min-height: 28px;
    line-height: 28px;
}

.replay-load-btn.rmod-pill-option {
    height: 28px;
    min-width: 120px;
    padding: 0 16px;
    font-size: 11px;
}
.replay-load-btn.rmod-pill-option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.replay-cancel-btn.rmod-pill-option {
    height: 28px;
    min-width: 82px;
    padding: 0 12px;
    font-size: 11px;
    color: rgba(255, 203, 135, 0.95);
    border-color: rgba(255, 179, 71, 0.36);
    background: rgba(255, 179, 71, 0.08);
}
.replay-cancel-btn.rmod-pill-option:hover {
    background: rgba(255, 179, 71, 0.16);
    border-color: rgba(255, 179, 71, 0.58);
}

/* ── Dropdown overrides — match .zs-module-card .dd dark style ── */

.replay-page .dd {
    height: 28px;
    z-index: 100;
}
.replay-page .dd .Select-control {
    background: rgba(16, 24, 38, 0.96) !important;
    border: 1px solid rgba(82, 102, 136, 0.82) !important;
    color: rgba(241, 246, 255, 0.97) !important;
    border-radius: 12px !important;
    height: 28px !important;
    min-height: 28px !important;
}
.replay-page .dd .Select-control:hover,
.replay-page .dd.is-open .Select-control {
    background: rgba(21, 31, 48, 0.98) !important;
    border-color: rgba(109, 129, 170, 0.88) !important;
}
.replay-page .dd.is-open .Select-control {
    border-color: rgba(45, 108, 255, 0.7) !important;
}
.replay-page .dd .Select-placeholder,
.replay-page .dd .Select-value-label,
.replay-page .dd .Select-input > input {
    color: rgba(241, 246, 255, 0.97) !important;
}

.replay-page .dd--narrow {
    min-width: 80px;
}
.replay-page .dd--wide {
    min-width: 160px;
}

/* Date picker: match DDOI module control styling and anchored positioning */
.replay-page .replay-date-picker,
.replay-page .replay-date-picker .SingleDatePicker,
.replay-page .replay-date-picker .SingleDatePickerInput,
.replay-page .replay-date-picker .DateInput,
.replay-page .replay-date-picker .DateInput_input {
    flex: 0 0 auto;
    box-sizing: border-box;
}
.replay-page .replay-date-picker {
    --zs-ctl-height: 28px;
    --zs-ctl-radius: 14px;
    --zs-ctl-padding-x: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--zs-ctl-height);
}
.replay-page .replay-date-picker .SingleDatePicker {
    position: relative !important;
}
.replay-page .replay-date-picker .SingleDatePickerInput,
.replay-page .replay-date-picker .SingleDatePickerInput__withBorder {
    background: rgba(45, 108, 255, .70) !important;
    border: none !important;
    border-radius: var(--zs-ctl-radius) !important;
    height: var(--zs-ctl-height) !important;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
.replay-page .replay-date-picker .DateInput {
    background: transparent !important;
    width: 96px !important;
    display: flex;
    align-items: center;
}
.replay-page .replay-date-picker .DateInput_input,
.replay-page .replay-date-picker .DateInput_input_1 {
    background: transparent !important;
    color: #fff !important;
    border: none !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    width: 96px !important;
    min-width: 96px !important;
    height: var(--zs-ctl-height) !important;
    line-height: var(--zs-ctl-height) !important;
    padding: 0 var(--zs-ctl-padding-x) !important;
    text-align: center !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer !important;
    border-radius: var(--zs-ctl-radius) !important;
}
.replay-page .replay-date-picker .DateInput_fang,
.replay-page .replay-date-picker .SingleDatePickerInput_calendarIcon {
    display: none !important;
}
.replay-page .replay-date-picker .SingleDatePicker_picker {
    left: 0 !important;
    right: auto !important;
    top: 36px !important;
    z-index: 100000 !important;
}
@media (min-width: 900px) {
    .replay-page .replay-date-picker .SingleDatePicker_picker {
        left: auto !important;
        right: 0 !important;
    }
}

/* Date picker portal calendar — dark theme */
.SingleDatePicker_picker__portal,
.SingleDatePicker_picker {
    z-index: 99999 !important;
}
.SingleDatePicker_picker__portal {
    background: transparent !important;
}
.CalendarMonth_caption,
.CalendarMonthGrid,
.DayPicker__withBorder {
    background: rgba(16, 24, 38, 0.98) !important;
    color: rgba(232, 241, 255, 0.92) !important;
}
.CalendarMonth_caption {
    padding-top: 14px !important;
    padding-bottom: 38px !important;
}
.CalendarMonth_caption strong {
    color: rgba(232, 241, 255, 0.92) !important;
    font-weight: 600 !important;
}
.DayPicker__withBorder {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(82, 102, 136, 0.82) !important;
    border-radius: 12px !important;
}
.CalendarDay__default {
    background: rgba(16, 24, 38, 0.96) !important;
    border: 1px solid rgba(58, 78, 112, 0.30) !important;
    color: rgba(232, 241, 255, 0.85) !important;
}
.CalendarDay__default:hover {
    background: rgba(45, 108, 255, 0.20) !important;
    border-color: rgba(101, 152, 255, 0.5) !important;
    color: #fff !important;
}
.CalendarDay__selected,
.CalendarDay__selected:hover {
    background: rgba(45, 108, 255, 0.86) !important;
    border-color: rgba(101, 152, 255, 0.7) !important;
    color: #fff !important;
}
.CalendarDay__blocked_calendar,
.CalendarDay__blocked_calendar:hover,
.CalendarDay__blocked_out_of_range,
.CalendarDay__blocked_out_of_range:hover {
    background: rgba(11, 15, 20, 0.95) !important;
    color: rgba(155, 176, 204, 0.35) !important;
    border-color: rgba(58, 78, 112, 0.16) !important;
    cursor: not-allowed !important;
}
.CalendarDay__default:not(.CalendarDay__blocked_calendar):not(.CalendarDay__blocked_out_of_range) {
    box-shadow: inset 0 -2px 0 rgba(0, 229, 168, 0.22) !important;
}
.DayPickerNavigation_button__default {
    background: rgba(20, 30, 48, 0.6) !important;
    border: 1px solid rgba(82, 102, 136, 0.6) !important;
}
.DayPickerNavigation_button__default:hover {
    background: rgba(33, 49, 74, 0.8) !important;
    border-color: rgba(109, 129, 170, 0.88) !important;
}
.DayPickerNavigation_svg__horizontal {
    fill: rgba(232, 241, 255, 0.85) !important;
}
.DayPicker_weekHeader_li small {
    color: rgba(155, 176, 204, 0.65) !important;
    font-weight: 600;
}
.DayPickerKeyboardShortcuts_buttonReset {
    display: none !important;
}

/* ── Loading panel ─────────────────────────────────────────── */

.replay-loading-panel {
    padding: 12px 14px;
    border: 1px solid rgba(0, 229, 168, 0.35);
    border-radius: 12px;
    background: rgba(0, 229, 168, 0.04);
}
.replay-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.replay-progress-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--accent) 0%,
        rgba(0, 229, 168, 0.6) 50%,
        var(--accent) 100%
    );
    background-size: 200% 100%;
    animation: replay-progress-shimmer 1.6s linear infinite;
    transition: width 0.25s ease-out;
    border-radius: 3px;
}
@keyframes replay-progress-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.replay-progress-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}
.replay-progress-stage {
    color: rgba(232, 241, 255, 0.92);
    font-weight: 500;
}
.replay-progress-elapsed {
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
}

/* ── Empty-state guidance ──────────────────────────────────── */

.replay-empty-guidance {
    padding: 12px 14px;
    border: 1px dashed rgba(155, 176, 204, 0.25);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 229, 168, 0.03), rgba(0, 0, 0, 0));
}
.replay-empty-line {
    color: rgba(232, 241, 255, 0.92);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}
.replay-empty-sub {
    color: var(--muted);
    font-size: 11px;
}

/* ── Module card (Exposure Lab + time control) ─────────────── */

.replay-module-card.rmod-card {
    /* Allow dropdown menus to escape the card */
    overflow: visible;
}

.replay-module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px 6px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 19, 23, 0.4);
}

.replay-chart-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.replay-chart-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(232, 241, 255, 0.95);
    letter-spacing: 0.3px;
    line-height: 1.2;
}
.replay-chart-subtitle {
    font-size: 11px;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-feature-settings: "tnum";
    line-height: 1.3;
}
.replay-spot-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 24px;
    margin-top: 4px;
}
.replay-spot-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid rgba(45, 108, 255, 0.26);
    border-radius: 999px;
    background: rgba(45, 108, 255, 0.08);
}
.replay-spot-chip--empty {
    opacity: 0.58;
}
.replay-spot-label {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.replay-spot-value {
    color: rgba(232, 241, 255, 0.94);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 700;
}

.replay-chart-toolbar {
    flex-shrink: 0;
    gap: 4px;
}

/* Module / pill control row */
.replay-module-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 19, 23, 0.25);
    flex-wrap: wrap;
}

.replay-pill-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.replay-chart-wrap {
    padding: 0 6px 6px !important;
    min-height: 0;
}
.replay-chart-wrap .nsewdrag {
    cursor: grab !important;
}
.replay-chart-wrap .nsewdrag:active {
    cursor: grabbing !important;
}

/* ── Time row (inside the same module card) ────────────────── */

.replay-time-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--line);
    background: rgba(16, 19, 23, 0.3);
}

.replay-slider-wrap {
    flex: 1;
    min-width: 0;
    min-height: 54px;
}

/* Slider (rc-slider overrides) */
.replay-page .rc-slider {
    margin: 10px 0 30px;
    min-height: 28px;
}
.replay-page .rc-slider-rail {
    background: var(--line) !important;
    height: 4px !important;
}
.replay-page .rc-slider-track {
    background: var(--accent) !important;
    height: 4px !important;
}
.replay-page .rc-slider-handle {
    border: 2px solid var(--accent) !important;
    background: #0b0f14 !important;
    width: 16px !important;
    height: 16px !important;
    margin-top: -6px !important;
    opacity: 1 !important;
}
.replay-page .rc-slider-handle:active,
.replay-page .rc-slider-handle:focus,
.replay-page .rc-slider-handle-click-focused {
    box-shadow: 0 0 0 4px rgba(0, 229, 168, 0.20) !important;
    border-color: var(--accent) !important;
}
.replay-page .rc-slider-tooltip-inner {
    background: rgba(20, 30, 48, 0.98) !important;
    border: 1px solid rgba(0, 229, 168, 0.45) !important;
    color: var(--accent) !important;
    font-family: "IBM Plex Mono", monospace !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 4px !important;
    padding: 3px 8px !important;
    min-width: 90px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
}
.replay-page .rc-slider-tooltip-arrow {
    border-top-color: rgba(0, 229, 168, 0.45) !important;
}
.replay-page .rc-slider-mark-text {
    color: rgba(155, 176, 204, 0.65) !important;
    font-size: 10px !important;
    font-family: "IBM Plex Mono", monospace !important;
}
.replay-page .rc-slider-dot {
    border-color: rgba(58, 78, 112, 0.42) !important;
    background: rgba(20, 30, 48, 0.58) !important;
    width: 6px !important;
    height: 6px !important;
    margin-left: -3px !important;
    bottom: -3px !important;
}
.replay-page .rc-slider-dot-active {
    border-color: var(--accent) !important;
}
.replay-page .rc-slider-disabled {
    background: transparent !important;
    cursor: not-allowed;
}
.replay-page .rc-slider-disabled .rc-slider-rail {
    background: rgba(58, 78, 112, 0.28) !important;
}
.replay-page .rc-slider-disabled .rc-slider-track {
    background: rgba(155, 176, 204, 0.18) !important;
}
.replay-page .rc-slider-disabled .rc-slider-handle {
    border-color: rgba(155, 176, 204, 0.45) !important;
    background: rgba(16, 24, 38, 0.96) !important;
}

/* Time chip */
.replay-time-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 5px 12px;
    border: 1px solid rgba(0, 229, 168, 0.30);
    border-radius: 12px;
    background: rgba(0, 229, 168, 0.06);
    min-width: 130px;
    flex-shrink: 0;
}
.replay-time-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.7px;
    text-transform: uppercase;
}
.replay-time-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    font-family: "IBM Plex Mono", monospace;
    font-feature-settings: "tnum";
    letter-spacing: 0.3px;
}

/* Playback controls */
.replay-playback-controls {
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}

.replay-play-btn.rmod-pill-option {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    font-size: 13px;
    color: var(--accent);
    background: rgba(20, 30, 48, 0.58);
    border-color: rgba(58, 78, 112, 0.42);
}
.replay-play-btn.rmod-pill-option:hover {
    background: rgba(33, 49, 74, 0.76);
    color: var(--accent);
    border-color: rgba(0, 229, 168, 0.5);
}

/* ── Diagnostics (compact, collapsible) ────────────────────── */

.replay-diagnostics {
    background: rgba(16, 19, 23, 0.24);
    border: 1px solid rgba(155, 176, 204, 0.12);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    opacity: 0.72;
}
.replay-diagnostics[open] {
    background: rgba(16, 19, 23, 0.46);
    opacity: 1;
}
.replay-diag-summary {
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    padding: 6px 10px;
    user-select: none;
    list-style: none;
}
.replay-diag-summary::-webkit-details-marker {
    display: none;
}
.replay-diag-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s;
}
.replay-diagnostics[open] .replay-diag-summary::before {
    transform: rotate(90deg);
}
.replay-diag-summary:hover {
    color: rgba(232, 241, 255, 0.85);
}
.replay-diag-body {
    padding: 6px 10px 10px;
    border-top: 1px solid rgba(155, 176, 204, 0.12);
}
.replay-diag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: baseline;
    margin-bottom: 8px;
}
.replay-diag-label {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.replay-diag-value {
    color: rgba(232, 241, 255, 0.92);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    margin-right: 8px;
}
.replay-diag-raw {
    color: rgba(155, 176, 204, 0.7);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    margin-right: 8px;
}
.replay-diag-section {
    margin-top: 8px;
}
.replay-diag-section-label {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
    font-weight: 600;
}
.replay-diag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.replay-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}
.replay-chip--ok {
    background: rgba(0, 229, 168, 0.10);
    border: 1px solid rgba(0, 229, 168, 0.30);
    color: var(--accent);
}
.replay-chip--off {
    background: rgba(155, 176, 204, 0.06);
    border: 1px solid rgba(155, 176, 204, 0.20);
    color: var(--muted);
}
.replay-diag-unavail-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.replay-diag-unavail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}
.replay-diag-unavail-cols {
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    opacity: 0.8;
}
.replay-diag-empty {
    color: var(--muted);
    font-size: 10px;
    font-style: italic;
}

.replay-page .dash-spinner {
    margin: 40px auto;
}
