/* =========================================================================
   66666 - bin-preview.css: Preview Source Switch (Timeline / Media Bin)
   Styles for the switch, the Media Bin preview area, the zoom buttons and
   the video control bar on the main preview window. Uses the app's existing
   colour variables.
   ========================================================================= */

/* --- The Timeline | Media Bin switch --- */
.preview-source-switch {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(15, 15, 20, 0.78);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.preview-source-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 6px 12px;
    min-height: 26px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.preview-source-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.preview-source-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- Media Bin preview area (sits on top of the preview canvas) --- */
.bin-preview-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    flex-direction: column;
    background: #0b0b0f;
}

.bin-preview-caption {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    max-width: calc(100% - 230px);
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(15, 15, 20, 0.7);
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.bin-preview-caption:empty {
    display: none;
}

.bin-preview-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    padding: 46px 12px 12px;
}

.bin-preview-hint {
    max-width: 320px;
    margin: auto;
    padding: 0 24px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    color: var(--text-muted);
}

/* --- Zoomable picture (images and videos) --- */
.bin-zoom-viewport {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    background: #000;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.bin-zoom-viewport.is-zoomed {
    cursor: grab;
}

.bin-zoom-viewport.dragging {
    cursor: grabbing;
}

.bin-zoom-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    transform-origin: 50% 50%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/* --- + / - zoom buttons (shown after a left-click on the picture) --- */
.bin-zoom-controls {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(15, 15, 20, 0.82);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.bin-zoom-controls.visible {
    display: inline-flex;
}

.bin-zoom-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.bin-zoom-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #ffffff;
}

.bin-zoom-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.bin-zoom-readout {
    min-width: 50px;
    height: 32px;
    padding: 0 6px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.bin-zoom-readout:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

/* --- Video control bar (replaces the browser's own controls) --- */
.bin-video-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: rgba(15, 15, 20, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.bin-vbtn {
    width: 30px;
    height: 30px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.15s ease;
}

.bin-vbtn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.bin-vseek {
    flex: 1;
    min-width: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.bin-vtime {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- Audio preview --- */
.bin-preview-audio {
    width: 100%;
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.bin-preview-audio-art {
    width: 220px;
    max-width: 60%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.bin-preview-audio audio {
    width: 100%;
}

/* --- Narrow phone screens --- */
@media (max-width: 520px) {
    .preview-source-switch {
        top: 6px;
        left: 6px;
    }

    .preview-source-btn {
        font-size: 10px;
        padding: 5px 9px;
        min-height: 24px;
    }

    .bin-preview-caption {
        top: 8px;
        right: 8px;
        max-width: calc(100% - 180px);
        font-size: 10px;
    }

    .bin-preview-stage {
        padding: 38px 8px 8px;
        gap: 6px;
    }

    .bin-zoom-controls {
        right: 6px;
        bottom: 6px;
    }

    .bin-video-bar {
        gap: 6px;
        padding: 3px 6px;
    }

    .bin-vtime {
        font-size: 10px;
    }
}