/* Therapist practice session — isolated from live session; small overlay on shared session CSS */

body.practice-session-page {
    padding-top: 0;
    --practice-banner-offset: 60px;
    --practice-banner-offset-sandbox: 88px;
}

.practice-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: linear-gradient(90deg, #5b4dbd 0%, #764ba2 100%);
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.practice-mode-banner__detail {
    font-weight: 400;
    opacity: 0.92;
    font-size: 13px;
}

body.practice-session-page .session-startup-splash {
    top: var(--practice-banner-offset);
}

body.practice-session-page.sandbox-mode .practice-mode-banner {
    top: 28px;
}

body.practice-session-page.sandbox-mode .session-startup-splash {
    top: var(--practice-banner-offset-sandbox);
}

body.practice-session-page .media-controls {
    top: calc(var(--practice-banner-offset) + 56px) !important;
}

/* Live session gates video until getUserMedia; practice always shows layout */
body.practice-session-page .video-section {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Banner stack: sandbox (28px) + practice banner */
body.practice-session-page.therapist:not(:has(.video-section.fullscreen)) .video-section,
body.practice-session-page.therapist .video-section:not(.fullscreen) {
    top: var(--practice-banner-offset) !important;
}

body.practice-session-page.sandbox-mode.therapist:not(:has(.video-section.fullscreen)) .video-section,
body.practice-session-page.sandbox-mode.therapist .video-section:not(.fullscreen) {
    top: var(--practice-banner-offset-sandbox) !important;
}

body.practice-session-page.therapist .video-section.fullscreen {
    top: var(--practice-banner-offset) !important;
    height: calc(100vh - var(--practice-banner-offset)) !important;
}

body.practice-session-page.sandbox-mode.therapist .video-section.fullscreen {
    top: var(--practice-banner-offset-sandbox) !important;
    height: calc(100vh - var(--practice-banner-offset-sandbox)) !important;
}

/* Fullscreen-only coach line (hidden in BLS mode) */
body.practice-session-page .practice-fullscreen-start-hint {
    display: none;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 88px;
    z-index: 10040;
    max-width: min(640px, calc(100vw - 32px));
    margin: 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(20, 24, 32, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

body.practice-session-page .practice-fullscreen-start-hint__accent {
    font-weight: 700;
    color: #b8c9ff;
}

body.practice-session-page.therapist:has(.video-section.fullscreen) .practice-fullscreen-start-hint {
    display: block;
}

body.practice-session-page.therapist:not(:has(.video-section.fullscreen)) .practice-fullscreen-start-hint,
body.practice-session-page.therapist .video-section:not(.fullscreen) ~ .practice-fullscreen-start-hint {
    display: none !important;
}

/* After initializeTherapistView(), header + canvas live under .video-section */
body.practice-session-page.therapist .main-content.practice-main-collapsed,
body.practice-session-page.therapist .main-content[aria-hidden="true"] {
    display: none !important;
    pointer-events: none !important;
}

body.practice-session-page .nav-buttons {
    display: none !important;
}

body.practice-session-page .status-info {
    top: 48px;
    z-index: 10060;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px 10px;
    border-radius: 8px;
    right: 8px;
    left: auto;
    width: auto;
}

body.practice-session-page.sandbox-mode .status-info {
    top: 76px;
}

body.practice-session-page .video-section .video-container:last-child {
    position: relative !important;
}

body.practice-session-page .video-section .emdr-canvas-container {
    z-index: 1003 !important;
}

/* Keep BLS controls (incl. speed) interactive after header moves out of collapsed main-content */
body.practice-session-page .emdr-header,
body.practice-session-page .emdr-controls,
body.practice-session-page .emdr-controls .control-group,
body.practice-session-page #speedSlider,
body.practice-session-page #speedValue {
    pointer-events: auto !important;
}

body.practice-session-page .start-bls-btn {
    position: relative !important;
    overflow: visible !important;
    transform-origin: center center !important;
}

body.practice-session-page.practice-pre-bls.therapist.session-video-mode-prefer #bottomTherapistBLS,
body.practice-session-page.practice-pre-bls.therapist .video-section:not(.fullscreen) .start-bls-btn:not(.running),
body.practice-session-page.practice-pre-bls.therapist .video-section:not(.fullscreen) ~ * .start-bls-btn:not(.running) {
    animation: practiceStartBlsButtonPulse 1.45s ease-in-out infinite !important;
}

body.practice-session-page.practice-bls-running .start-bls-btn,
body.practice-session-page .start-bls-btn.running,
body.practice-session-page.practice-bls-running #bottomTherapistBLS {
    animation: none !important;
}

@keyframes practiceStartBlsButtonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 4px 15px rgba(52, 199, 89, 0.42),
            0 0 0 0 rgba(52, 199, 89, 0.30) !important;
    }
    50% {
        transform: scale(1.12);
        box-shadow:
            0 8px 24px rgba(52, 199, 89, 0.62),
            0 0 0 14px rgba(52, 199, 89, 0.18) !important;
    }
}

body.practice-session-page.therapist:has(.video-section.fullscreen) .emdr-header .emdr-controls .control-group:has(#speedSlider),
body.practice-session-page.therapist:has(.video-section.fullscreen) .emdr-header .emdr-controls .control-group:has(#speedValue) {
    display: none !important;
}

body.practice-session-page .practice-hide-live-only,
body.practice-session-page #connectionStatusOverlay,
body.practice-session-page #waitingRoomIndicator,
body.practice-session-page .therapist-connection-strip,
body.practice-session-page #bottomToggleChat,
body.practice-session-page .client-only {
    display: none !important;
}

/* Placeholder “client” tile — static image, no WebRTC */
.practice-client-tile video#remoteVideo {
    opacity: 0;
    pointer-events: none;
}

/* Default fake client (replace file to customize: images/practice-client-custom.jpg) */
.practice-client-placeholder {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: #2d3748;
    background-image: url('../images/practice-client-avatar.svg');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* Optional custom photo: add class practice-client-placeholder--custom via JS if file exists */
.practice-client-placeholder.practice-client-placeholder--custom {
    background-image: url('../images/practice-client-custom.jpg');
    background-size: cover;
}

.practice-client-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45) 0%, transparent 40%);
}

.practice-client-placeholder__label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.practice-client-placeholder__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 4px 8px;
    border-radius: 4px;
    background: #5b4dbd;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Single client-view preview panel — top-left overlay (separate from therapist workspace) */
body.practice-session-page .practice-client-view-preview {
    --practice-client-preview-green: #34c759;
    display: block;
    position: fixed;
    top: calc(var(--practice-banner-offset) + 8px);
    left: 12px;
    bottom: auto;
    right: auto;
    transform: none;
    z-index: 10045;
    width: min(280px, calc(100vw - 24px));
    padding: 10px 12px 12px;
    border-radius: 10px;
    background: rgba(20, 24, 32, 0.94);
    border: 6px solid var(--practice-client-preview-green);
    box-shadow:
        0 0 0 1px rgba(52, 199, 89, 0.35),
        0 0 18px rgba(52, 199, 89, 0.22),
        0 10px 28px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

body.practice-session-page.sandbox-mode .practice-client-view-preview {
    top: calc(var(--practice-banner-offset-sandbox) + 8px);
}

/* BLS settings rail tab (shared with live session) — stay above practice banner */
body.practice-session-page .bls-rail-collapse-tab {
    z-index: 10055;
}

/* Collapsed rail: floated self PiP is video only — never the BLS control stack */
body.practice-session-page.bls-rail-collapse-enabled.bls-rail-ui-active.bls-rail-collapsed
    .video-container.bls-rail-floated-pip .emdr-header,
body.practice-session-page.bls-rail-collapse-enabled.bls-rail-ui-active.bls-rail-collapsed
    .video-container.bls-rail-floated-pip .emdr-controls {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    max-height: 0 !important;
    overflow: hidden !important;
}

body.practice-session-page.bls-rail-collapse-enabled.bls-rail-ui-active.bls-rail-collapsed
    .video-container.bls-rail-floated-pip .pip-media-stack {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* When BLS rail is open, nudge client-view preview so it does not cover the red close tab */
body.practice-session-page.bls-rail-ui-active:not(.bls-rail-collapsed) .practice-client-view-preview {
    left: 48px;
}

body.practice-session-page .practice-client-view-preview__video-layer,
body.practice-session-page .practice-client-view-preview__bls-layer {
    position: absolute;
    inset: 0;
}

body.practice-session-page .practice-client-view-preview--video .practice-client-view-preview__bls-layer {
    display: none;
}

body.practice-session-page .practice-client-view-preview--bls .practice-client-view-preview__video-layer {
    display: none;
}

body.practice-session-page .practice-client-view-preview--bls .practice-client-view-preview__bls-layer {
    display: block;
}

.practice-client-view-preview__title {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--practice-client-preview-green, #34c759);
    letter-spacing: 0.02em;
}

.practice-client-view-preview__title strong {
    color: var(--practice-client-preview-green, #34c759);
    font-weight: 800;
}

.practice-client-view-preview__subtitle {
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.82);
}

.practice-client-view-preview__subtitle strong {
    color: #b8c9ff;
    font-weight: 700;
}

.practice-client-view-preview__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 168px;
    border-radius: 8px;
    overflow: hidden;
    background: #0f1419;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.practice-client-view-preview__bls-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #0f1419;
}

.practice-client-view-preview__bls-pips {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.practice-client-view-preview__therapist {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: #1a202c;
}

.practice-client-view-preview__therapist-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
}

/* Video-call PiP — top-right like live client fullscreen */
.practice-client-view-preview__pip--call {
    position: absolute !important;
    top: 10% !important;
    right: 6% !important;
    left: auto !important;
    bottom: auto !important;
    width: 32% !important;
    min-height: 0 !important;
    max-height: 38% !important;
    min-width: 0 !important;
    max-width: none !important;
    aspect-ratio: 4 / 3;
    z-index: 3;
    opacity: 1 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* BLS corner videos — bottom corners on client animation screen */
.practice-client-view-preview__pip--bls {
    position: absolute !important;
    bottom: 5% !important;
    top: auto !important;
    width: 28% !important;
    min-height: 0 !important;
    max-height: 32% !important;
    min-width: 0 !important;
    aspect-ratio: 4 / 3;
    z-index: 3;
    opacity: 1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

/* Match live client BLS: self (You) bottom-left, therapist bottom-right */
.practice-client-view-preview__pip--bls.practice-pip-hint--client {
    left: 5% !important;
    right: auto !important;
}

.practice-client-view-preview__pip--bls.practice-pip-hint--therapist {
    right: 5% !important;
    left: auto !important;
}

.practice-client-view-preview__pip--bls video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.practice-client-view-preview__pip .practice-pip-hint__label {
    font-size: 7px;
}

/* Therapist main canvas: no duplicate client-preview overlays */
body.practice-session-page .emdr-canvas-container .practice-animation-client-preview-hint,
body.practice-session-page .emdr-canvas-container .practice-animation-pip-hints,
body.practice-session-page .emdr-canvas-container .therapist-client-view-pip-hints {
    display: none !important;
}

@media (max-width: 640px) {
    body.practice-session-page .practice-client-view-preview {
        left: 8px;
        right: auto;
        width: min(260px, calc(100vw - 16px));
        top: calc(var(--practice-banner-offset) + 8px);
        transform: none;
    }

    body.practice-session-page.sandbox-mode .practice-client-view-preview {
        top: calc(var(--practice-banner-offset-sandbox) + 8px);
    }
}

body.practice-session-page .practice-pip-hint {
    flex-direction: column;
    gap: 2px;
    padding: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background-color: #1a202c;
    /* 2× live-session hint height (34→68, 74→148) for easier rehearsal */
    min-height: 68px !important;
    max-height: 148px !important;
    aspect-ratio: 4 / 3;
    height: auto !important;
}

body.practice-session-page .practice-pip-hint--client {
    background-image: url('../images/practice-client-avatar.svg');
    background-position: center top;
    background-size: cover;
    background-repeat: no-repeat;
}

body.practice-session-page .practice-pip-hint--therapist {
    background-image: url('../images/practice-therapist-pip-thumb.svg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

body.practice-session-page .practice-pip-hint__label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 4px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    text-shadow: none;
    line-height: 1.2;
}

/* Fullscreen: large fake client tile uses avatar (not scenery) */
body.practice-session-page.therapist .video-section.fullscreen .practice-client-placeholder {
    background-size: contain;
    background-color: #1a202c;
}
