/**
 * Video Annotation Styles
 *
 * Styles for the video annotation interface using Peaks.js
 */

/* Container */
.video-annotation-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.5rem);
    padding: 1rem;
}

/* Video Preview Panel */
.video-preview-panel {
    position: relative;
    background: #000;
    border-radius: var(--radius, 0.5rem);
    overflow: hidden;
}

.video-preview-panel video {
    width: 100%;
    max-height: 400px;
    display: block;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.timecode-display {
    display: flex;
    gap: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
}

.frame-number {
    color: #4ECDC4;
}

.timecode {
    color: #FFD700;
}

/* Tracking Canvas Overlay */
.tracking-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Leave space for video controls at bottom (about 40px) */
    height: calc(100% - 45px);
    pointer-events: auto;  /* Enable drawing on canvas */
    z-index: 10;
    cursor: crosshair;
}

/* When no track is active, don't block video */
.tracking-overlay.no-active-track {
    pointer-events: none;
    cursor: default;
}

/* When tracking is not active, hide the overlay */
.tracking-overlay[style*="display: none"] {
    pointer-events: none;
}

/* Toolbar */
.video-annotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--muted, #f9fafb);
    border-radius: var(--radius, 0.5rem);
    border: 1px solid var(--border, #e5e7eb);
}

.video-annotation-toolbar > div {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Group labels */
.tool-group-label {
    font-size: 0.75rem;
    color: var(--muted-foreground, #6b7280);
    margin-right: 0.25rem;
}

/* Playback Group */
.playback-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.playback-btn,
.frame-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.playback-btn:hover,
.frame-btn:hover {
    background: var(--accent, #f3f4f6);
    border-color: var(--ring, #3b82f6);
}

.playback-btn:disabled,
.frame-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.time-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: var(--muted-foreground, #6b7280);
    margin-left: 0.5rem;
}

/* Frame Stepping Group */
.frame-stepping-group {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.25rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

/* Playback Rate */
.playback-rate-group {
    padding: 0 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

.playback-rate-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    font-size: 0.75rem;
    cursor: pointer;
}

/* Label Group */
.label-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

.label-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}

.label-btn:hover {
    background: var(--accent, #f3f4f6);
}

.label-btn.active {
    border-color: var(--label-color, #4ECDC4);
    background: color-mix(in srgb, var(--label-color, #4ECDC4) 15%, white);
    box-shadow: 0 0 0 1px var(--label-color, #4ECDC4);
}

.label-color-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Mode Controls (Keyframe, Frame Classify) */
.keyframe-group,
.frame-classify-group {
    padding: 0 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

.keyframe-btn,
.frame-classify-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}

.keyframe-btn:hover {
    background: #FFD700;
    border-color: #FFD700;
    color: #000;
}

.frame-classify-btn:hover {
    background: var(--accent, #f3f4f6);
    border-color: var(--ring, #3b82f6);
}

/* Zoom Group */
.zoom-group {
    display: flex;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

.zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.zoom-btn:hover {
    background: var(--accent, #f3f4f6);
}

/* Segment Group */
.segment-group {
    display: flex;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border, #e5e7eb);
}

.segment-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    background: var(--background, #fff);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}

.segment-btn:hover {
    background: var(--accent, #f3f4f6);
}

.segment-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.segment-btn.delete-btn:not(:disabled):hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
}

/* Count Group */
.count-group {
    margin-left: auto;
    padding-left: 0.5rem;
}

.segment-count {
    font-size: 0.75rem;
    color: var(--muted-foreground, #6b7280);
}

.count-value {
    font-weight: 600;
    color: var(--foreground, #111827);
}

/* Timeline Wrapper */
.timeline-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Timeline Container (Peaks.js zoomview) */
.timeline-container {
    background: var(--muted, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.5rem);
    overflow: hidden;
}

/* Overview Container (Peaks.js overview) */
.overview-container {
    background: var(--muted, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    overflow: hidden;
}

/* Annotation List */
.annotation-list-container {
    background: var(--muted, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.5rem);
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.annotation-list-container h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground, #111827);
}

.annotation-group {
    margin-bottom: 0.75rem;
}

.annotation-group h5 {
    margin: 0 0 0.25rem 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.annotation-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.annotation-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.375rem);
    cursor: pointer;
    transition: all 0.15s ease;
}

.annotation-item:hover {
    background: var(--accent, #f3f4f6);
}

.annotation-item.active {
    border-color: var(--ring, #3b82f6);
    box-shadow: 0 0 0 1px var(--ring, #3b82f6);
}

.annotation-color {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.annotation-label {
    font-weight: 500;
    font-size: 0.875rem;
}

.annotation-time {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: var(--muted-foreground, #6b7280);
}

.annotation-frames {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.625rem;
    color: var(--muted-foreground, #9ca3af);
}

.annotation-play,
.annotation-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: var(--radius, 0.25rem);
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.6;
    transition: all 0.15s ease;
}

.annotation-play:hover {
    opacity: 1;
    background: var(--accent, #f3f4f6);
}

.annotation-delete:hover {
    opacity: 1;
    background: #fee2e2;
    color: #dc2626;
}

.no-annotations {
    font-size: 0.875rem;
    color: var(--muted-foreground, #6b7280);
    text-align: center;
    padding: 1rem;
}

/* Segment Questions Panel */
.segment-questions-panel {
    background: var(--muted, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 0.5rem);
    padding: 0.75rem;
}

.segment-questions-panel h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Toast Notifications */
.video-annotation-toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    padding: 0.75rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: var(--radius, 0.5rem);
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.video-annotation-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Error Message */
.video-annotation-error {
    padding: 1rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--radius, 0.5rem);
    color: #dc2626;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-annotation-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .video-annotation-toolbar > div {
        justify-content: center;
        padding: 0.25rem 0;
        border-left: none !important;
        border-top: 1px solid var(--border, #e5e7eb);
    }

    .video-annotation-toolbar > div:first-child {
        border-top: none;
    }

    .count-group {
        margin-left: 0;
    }
}
