/* On-frame drawing (telestration) styles */

.video-stage {
    position: relative;
    width: 100%;
    /* Shrink-wrap the video so the canvas overlay tracks its box exactly */
    line-height: 0;
}

.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Display-only outside draw mode; AnnotationManager enables input */
    pointer-events: none;
}

.annotation-canvas.drawing {
    pointer-events: auto;
    touch-action: none;
    cursor: crosshair;
}

/* Inline entry field for the text tool, positioned at the tap point */
.text-entry {
    position: absolute;
    z-index: 5;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border: 1px solid var(--brand-teal);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 16px;   /* >=16px stops iOS Safari from zooming the page */
    max-width: 60%;
}

/* Hint chip for the 3-point angle tool */
.angle-hint {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.3rem 0.9rem;
    border-radius: 14px;
    font-size: 0.8rem;
    line-height: 1.4;
    pointer-events: none;
    white-space: nowrap;
}

/* Drawing toolbar */
.draw-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    width: 100%;
}

.draw-tools,
.draw-actions {
    display: flex;
    gap: 0.25rem;
}

.tool-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tool-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.tool-btn.active {
    background: var(--brand-blue);
}

.tool-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.draw-colors {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.color-swatch.active {
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 2px rgba(77, 232, 207, 0.35);
}


.save-indicator {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: auto;
    min-width: 3.5rem;
    text-align: right;
}

.draw-done-btn {
    background: linear-gradient(135deg, var(--brand-teal), var(--brand-blue));
    color: white;
    border: none;
    padding: 0.45rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Draw-mode button active state */
#drawModeBtn.active {
    background: var(--brand-blue);
}

/* Layers panel in the video-info section */
.layers-section {
    margin-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 0.75rem;
}

.layers-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.layers-count {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-size: 0.8rem;
}

.layers-chevron {
    transition: transform 0.2s;
}

.layers-toggle[aria-expanded="true"] .layers-chevron {
    transform: rotate(180deg);
}

.layers-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.layers-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
}

.layers-list input[type="checkbox"] {
    accent-color: var(--brand-teal);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.modal-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Fullscreen: keep toolbar visible above the bottom-anchored controls */
.video-container:fullscreen .draw-toolbar,
.video-container:-webkit-full-screen .draw-toolbar {
    position: absolute;
    bottom: 7.5rem;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
}

/* Mobile */
@media (max-width: 768px) {
    .draw-toolbar {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .save-indicator {
        margin-left: 0;
        min-width: 0;
    }
}
