/*
 * video-viewer.css  –  TerraLeap Video Viewer
 * All rules scoped under .tl-vid-* — cannot affect site CSS outside the viewer.
 * Mirror of pdf-viewer.css naming convention.
 */

/* ------------------------------------------------------------------ */
/*  Host container                                                      */
/* ------------------------------------------------------------------ */

.tl-vid-host-active {
    position: relative;
    display: block;
    box-sizing: border-box;
    background: #000;
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/*  Inner wrapper (toolbar + video stacked)                             */
/* ------------------------------------------------------------------ */

.tl-vid-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: #000;
}

/* ------------------------------------------------------------------ */
/*  Toolbar                                                             */
/* ------------------------------------------------------------------ */

.tl-vid-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 10px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    box-sizing: border-box;
    user-select: none;
    z-index: 2;
}

.tl-vid-tb-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tl-vid-tb-centre {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 4px;
}

.tl-vid-tb-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-width: 0;
}

/* ------------------------------------------------------------------ */
/*  Toolbar buttons                                                     */
/* ------------------------------------------------------------------ */

.tl-vid-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.tl-vid-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.tl-vid-btn:active {
    background: rgba(255,255,255,0.2);
}

.tl-vid-btn svg {
    display: block;
    pointer-events: none;
}

/* ------------------------------------------------------------------ */
/*  Scrubber (seek bar)                                                 */
/* ------------------------------------------------------------------ */

.tl-vid-scrubber {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #444;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    accent-color: #4a9eff;
}

.tl-vid-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    margin-top: -4.5px;
}

.tl-vid-scrubber::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #4a9eff;
    border: none;
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Volume slider                                                       */
/* ------------------------------------------------------------------ */

.tl-vid-vol-slider {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #555;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    accent-color: #4a9eff;
    flex-shrink: 0;
}

.tl-vid-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    margin-top: -3.5px;
}

.tl-vid-vol-slider::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #4a9eff;
    border: none;
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Speed select                                                        */
/* ------------------------------------------------------------------ */

.tl-vid-speed {
    height: 26px;
    padding: 0 4px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
}

.tl-vid-speed:hover {
    border-color: #666;
    color: #fff;
}

/* ------------------------------------------------------------------ */
/*  Time display                                                        */
/* ------------------------------------------------------------------ */

.tl-vid-time {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
}

/* ------------------------------------------------------------------ */
/*  Document title (right of toolbar)                                   */
/* ------------------------------------------------------------------ */

.tl-vid-title {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ------------------------------------------------------------------ */
/*  Video area                                                          */
/* ------------------------------------------------------------------ */

.tl-vid-video-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #000;
    overflow: hidden;
}

.tl-vid-element {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* Hide native controls — we provide our own toolbar */
.tl-vid-element::-webkit-media-controls {
    display: none !important;
}

/* ------------------------------------------------------------------ */
/*  Watermark canvas                                                    */
/* ------------------------------------------------------------------ */

.tl-vid-watermark {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

/* ------------------------------------------------------------------ */
/*  Loading spinner                                                     */
/* ------------------------------------------------------------------ */

.tl-vid-spinner {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0,0,0,0.5);
    z-index: 4;
}

.tl-vid-loading {
    display: flex !important;  /* scoped to .tl-vid-loading only */
}

.tl-vid-spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: tl-vid-spin 0.8s linear infinite;
}

.tl-vid-spinner-pct {
    font-size: 12px;
    color: #ccc;
    font-variant-numeric: tabular-nums;
}

@keyframes tl-vid-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/*  Bottom toolbar — border swapped, no bottom border                  */
/* ------------------------------------------------------------------ */

.tl-vid-toolbar-bottom {
    border-top: 1px solid #333;
    border-bottom: none;
}

/* ------------------------------------------------------------------ */
/*  Fullscreen adjustments                                              */
/* ------------------------------------------------------------------ */

.tl-vid-wrap:-webkit-full-screen { width: 100vw; height: 100vh; }
.tl-vid-wrap:-moz-full-screen    { width: 100vw; height: 100vh; }
.tl-vid-wrap:fullscreen          { width: 100vw; height: 100vh; }

/* ------------------------------------------------------------------ */
/*  Responsive: hide volume slider + title on narrow containers         */
/* ------------------------------------------------------------------ */

@media (max-width: 520px) {
    .tl-vid-vol-slider { display: none; }
    .tl-vid-title      { display: none; }
    .tl-vid-time       { min-width: auto; }
}
