/*
 * Sandbox side-by-side demo spine (online video + reusable for F2F controller).
 * One divider rail with Client facing left and Therapist facing right.
 * z-index must sit above session .video-section (999+) so the seam stays visible.
 */
body.ip-side-by-side {
    --sbs-spine-w: 80px;
    padding-left: var(--sbs-spine-w);
    box-sizing: border-box;
}

/* Therapist dash shell breaks out with 100vw + negative margin, so body
   padding alone leaves Donate/Home under the spine — inset the shell. */
body.ip-side-by-side .td-app-shell {
    width: calc(100vw - var(--sbs-spine-w));
    max-width: calc(100vw - var(--sbs-spine-w));
    margin-left: calc(50% - 50vw + var(--sbs-spine-w));
    margin-right: calc(50% - 50vw);
}

body .ip-sbs-spine {
    position: fixed;
    z-index: 12000;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    pointer-events: none;
    background: rgba(8, 12, 22, 0.92);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Role colors (match CLIENT / THERAPIST spine) */
body.ip-side-by-side {
    --sbs-client: #38b2ac;
    --sbs-therapist: #ed8936;
}

/* Window chrome: inset frame + top strip (who owns this half) */
body.client.ip-side-by-side {
    box-shadow: inset 0 0 0 5px var(--sbs-client);
}
body.therapist.ip-side-by-side {
    box-shadow: inset 0 0 0 5px var(--sbs-therapist);
}

.sbs-window-chrome[hidden] {
    display: none !important;
}

.sbs-window-chrome {
    position: fixed;
    z-index: 11950;
    top: 0;
    left: var(--sbs-spine-w, 0);
    right: 0;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font: 700 12px/1 "Source Sans 3", "Segoe UI", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fff;
}

body.client.ip-side-by-side .sbs-window-chrome {
    background: linear-gradient(180deg, rgba(56, 178, 172, 0.95), rgba(56, 178, 172, 0.78));
}

body.therapist.ip-side-by-side .sbs-window-chrome {
    background: linear-gradient(180deg, rgba(237, 137, 54, 0.95), rgba(237, 137, 54, 0.78));
    left: var(--sbs-spine-w, 80px);
}

/* Role chips on main + PiP tiles */
.sbs-role-chip[hidden] {
    display: none !important;
}

body.ip-side-by-side .video-container {
    position: relative;
}

.sbs-role-chip {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 40;
    padding: 4px 9px;
    border-radius: 999px;
    font: 700 11px/1.2 "Source Sans 3", "Segoe UI", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

/* Clear the chrome strip so chips/labels aren't under the top bar */
body.ip-side-by-side .video-section {
    padding-top: 34px;
    box-sizing: border-box;
}

.sbs-role-chip--client {
    background: rgba(56, 178, 172, 0.92);
}

.sbs-role-chip--therapist {
    background: rgba(237, 137, 54, 0.92);
}

/* Keep chips readable on tiny PiPs; don't wait for hover */
body.ip-side-by-side .video-container.pip-video .sbs-role-chip {
    top: 6px;
    left: 6px;
    font-size: 10px;
    padding: 3px 7px;
}

body.ip-side-by-side .video-container.pip-video .video-label {
    opacity: 1 !important;
    visibility: visible !important;
}

/* PiP: outer ring (tiles float inset, so outer shadow is visible) */
body.client.ip-side-by-side .video-container.pip-video:has(#localVideo),
body.client.ip-side-by-side .video-container.pip-video:first-child {
    box-shadow: 0 0 0 4px var(--sbs-client), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

body.client.ip-side-by-side .video-container.pip-video:has(#remoteVideo),
body.client.ip-side-by-side .video-container.pip-video:last-child {
    box-shadow: 0 0 0 4px var(--sbs-therapist), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

body.therapist.ip-side-by-side .video-container.pip-video:has(#localVideo),
body.therapist.ip-side-by-side .video-container.pip-video:first-child {
    box-shadow: 0 0 0 4px var(--sbs-therapist), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

body.therapist.ip-side-by-side .video-container.pip-video:has(#remoteVideo),
body.therapist.ip-side-by-side .video-container.pip-video:last-child {
    box-shadow: 0 0 0 4px var(--sbs-client), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

/*
 * Main picture frame: border hugs the <video> once JS sizes it to the
 * stream aspect at max fit-in-area (see applySideBySideFullscreenVideoFit).
 * No container ::after — that wrapped letterbox + controls.
 */
body.ip-side-by-side .video-container.fullscreen-video {
    overflow: visible !important;
    background: transparent !important;
}

body.ip-side-by-side .video-container.fullscreen-video video {
    border-radius: 10px !important;
    box-sizing: border-box !important;
    border: 5px solid transparent !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) !important;
}

/* Client window main = therapist face → orange */
body.client.ip-side-by-side .video-container.fullscreen-video video {
    border-color: var(--sbs-therapist) !important;
}

/* Therapist window main = client face → teal */
body.therapist.ip-side-by-side .video-container.fullscreen-video video {
    border-color: var(--sbs-client) !important;
}

/* Animation PiP: keep CSS aligned with js/video-layout.js side-by-side offsets
   (inline !important left/bottom are also set there — that is the real fix). */
body.therapist.ip-side-by-side .emdr-canvas-container.therapist-animation-pip-visible {
    left: 100px !important; /* 80px spine + 20px gap */
    bottom: 88px !important; /* clear bottom media controls */
}

body .ip-sbs-spine[hidden] {
    display: none !important;
}

body .ip-sbs-spine__half {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

body .ip-sbs-spine__half--client {
    background: linear-gradient(90deg, rgba(56, 178, 172, 0.38), rgba(56, 178, 172, 0.08));
}

body .ip-sbs-spine__half--therapist {
    background: linear-gradient(90deg, rgba(237, 137, 54, 0.08), rgba(237, 137, 54, 0.38));
}

body .ip-sbs-spine__rule {
    flex: 0 0 4px;
    width: 4px;
    align-self: stretch;
    background: linear-gradient(
        180deg,
        #38b2ac 0%,
        #38b2ac 48%,
        #ed8936 52%,
        #ed8936 100%
    );
    box-shadow: 0 0 14px rgba(56, 178, 172, 0.35);
}

body .ip-sbs-spine__label {
    writing-mode: vertical-rl;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    line-height: 1;
    user-select: none;
}

body .ip-sbs-spine__label--client {
    color: #81e6d9;
    transform: rotate(180deg);
}

body .ip-sbs-spine__label--therapist {
    color: #f6ad55;
}

/* Real therapist dashboard used as the online side-by-side right half */
body.ip-side-by-side .sbs-dash-demo-note {
    display: block;
    margin: 10px 16px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(180, 120, 40, 0.12);
    border: 1px solid rgba(180, 120, 40, 0.28);
    color: #5a4018;
    font-size: 13px;
    font-weight: 550;
    line-height: 1.4;
}

body.ip-side-by-side .sbs-dash-demo-note[hidden] {
    display: none !important;
}

.sbs-dash-modal[hidden] {
    display: none !important;
}

.sbs-dash-modal {
    position: fixed;
    inset: 0;
    z-index: 13050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 24px 96px;
    background: rgba(15, 23, 42, 0.45);
}

.sbs-dash-modal-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.sbs-dash-modal-head {
    padding: 14px 18px;
    background: linear-gradient(135deg, #5b4dbd 0%, #764ba2 100%);
    color: #fff;
}

.sbs-dash-modal-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
}

.sbs-dash-modal-body {
    padding: 18px;
}

.sbs-dash-modal-body p {
    margin: 0 0 14px;
    color: #4a5568;
    font-size: 14px;
    line-height: 1.45;
}

.sbs-dash-modal-body .btn {
    width: 100%;
    appearance: none;
    border: none;
    border-radius: 6px;
    padding: 12px 18px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.sbs-dash-cta-pulse {
    animation: sbsDashCtaPulse 1.4s ease-in-out infinite;
}

@keyframes sbsDashCtaPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(102, 126, 234, 0); }
}

/* Guide: pulse Look who's waiting after the client half is open */
body.ip-side-by-side.sbs-guide-look-who #shmJoinSession.shm-cta--pulse,
body.ip-side-by-side.sbs-guide-look-who #shmJoinSessionArt:not(.is-dimmed) {
    animation: sbsDashCtaPulse 1.4s ease-in-out infinite;
}

body.ip-side-by-side .wr-reception-admit.sbs-dual-click-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    line-height: 1.25;
    padding-top: 11px;
    padding-bottom: 11px;
}

body.ip-side-by-side .wr-reception-admit .sbs-btn-sub {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}
