.upload-item {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--light-color);
    transition: all 0.2s ease-in-out;
}

.upload-item:hover {
    border-color: var(--primary-color);
}

.upload-item.active {
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: var(--box-shadow);
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.upload-number {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
}

.remove-upload {
    color: var(--danger-color);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.remove-upload:hover {
    color: #b02a37;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .upload-item {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .upload-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease-in-out;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-lg);
}

.video-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail .placeholder {
    color: var(--secondary-color);
    font-size: 3rem;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filters-section {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }
}

.video-container {
    position: relative;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-player {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
}

.video-player:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.speed-control.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.video-feedback {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.video-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Ties with .video-player above, so this must stay last in the file. */
@media (max-width: 768px) {
    .video-player {
        max-height: 50vh;
    }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.kpi-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--brand-navy), #24506b);
    color: white;
    border-radius: var(--border-radius);
}

.kpi-card-danger {
    background: linear-gradient(135deg, var(--brand-brick), #8a2c32);
}

.kpi-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.kpi-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-sub {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 0.4rem;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: normal;
}

.kpi-card-lift {
    border-top: 4px solid;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: bold;
}

/* Replaces Bootstrap's .table-light, which is fixed-light in both themes. */
.thead-themed th {
    background-color: var(--bs-tertiary-bg);
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
}

.image-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 576px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.upload-tips {
    border-left: 4px solid var(--primary-color);
}
.trim-container {
    background: var(--bs-dark-bg-subtle, #f8f9fa);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}
.trim-container .noUi-target {
    height: 8px;
    border: none;
    background: var(--bs-secondary-bg, #dee2e6);
    box-shadow: none;
}
.trim-container .noUi-connect {
    background: var(--primary-color, #0d6efd);
}
.trim-container .noUi-handle {
    width: 20px; height: 20px;
    border-radius: 50%;
    top: -7px; right: -10px;
    border: 2px solid var(--primary-color, #0d6efd);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    cursor: grab;
}
.trim-container .noUi-handle::before,
.trim-container .noUi-handle::after { display: none; }
.trim-meta { font-size: 0.8rem; }

.trends-chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

@media (max-width: 768px) {
    .trends-chart-container {
        height: 260px;
    }
}

.heatmap-grid { display: inline-grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 2px; }

.heatmap-cell,
.heatmap-legend-cell { width: 12px; height: 12px; border-radius: 2px; background: #E6EEF0; }
.heatmap-legend-cell { display: inline-block; }
.heatmap-cell[data-level="1"], .heatmap-legend-cell[data-level="1"] { background: #A7D4DD; }
.heatmap-cell[data-level="2"], .heatmap-legend-cell[data-level="2"] { background: #4FA9BD; }
.heatmap-cell[data-level="3"], .heatmap-legend-cell[data-level="3"] { background: #1E7F93; }
.heatmap-cell[data-level="4"], .heatmap-legend-cell[data-level="4"] { background: #1E2A45; }
.delta-chip { font-size: 0.8rem; padding: 0.2rem 0.5rem; border-radius: 999px; }

.video-overlay-wrap { position: relative; line-height: 0; }
.video-overlay-wrap .video-player { display: block; width: 100%; }
.video-overlay-canvas {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
}
.inline-editable {
    cursor: pointer;
    border-bottom: 1px dashed var(--bs-secondary-bg, #adb5bd);
    transition: background-color 0.15s;
}
.inline-editable:hover {
    background-color: var(--bs-primary-bg-subtle, #cfe2ff);
    border-bottom-color: var(--bs-primary, #0d6efd);
}
.inline-editable .inline-input {
    width: 100%;
    max-width: 180px;
    padding: 0 4px;
    border: 1px solid var(--bs-primary, #0d6efd);
    border-radius: 4px;
    font-size: inherit;
    outline: none;
}
.inline-editable .inline-saving {
    font-size: .75rem;
    color: var(--bs-secondary-color);
}
.kpi-editable {
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.kpi-editable:hover {
    box-shadow: 0 0 0 2px var(--bs-primary, #0d6efd);
    transform: translateY(-1px);
}

.analysis-graph-body {
    position: relative;
    height: 300px;
    padding: 0.75rem 1rem;
}
.analysis-graph-card[data-graph="rep_position_phases"] .analysis-graph-body,
.analysis-graph-card[data-graph="rep_velocity_phases"] .analysis-graph-body {
    height: 320px;
}
.analysis-graph-card[data-graph="movement_trajectory"] .analysis-graph-body {
    height: auto;
}
.analysis-graph-card[data-graph="velocity_over_time"] .analysis-graph-body {
    height: auto;
}
.analysis-graph-panels {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.analysis-graph-panel {
    position: relative;
    width: 100%;
}

.video-card .compare-check {
    display: none;
    font-size: 2.5rem;
    color: var(--brand-teal);
    opacity: 0;
    transition: opacity .15s;
}
.video-grid.compare-mode .video-card { cursor: pointer; }

.video-grid.compare-mode .video-card:not([data-analysis-status="analysed"]) {
    cursor: not-allowed;
    opacity: 0.5;
}
.video-grid.compare-mode .video-card .compare-check { display: block; opacity: .35; }
.video-grid.compare-mode .video-card.compare-selected {
    outline: 3px solid var(--brand-teal);
    outline-offset: 2px;
}
.video-grid.compare-mode .video-card.compare-selected .compare-check { opacity: 1; }

.compare-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    z-index: 1050;
}

.compare-video {
    width: 100%;
    max-height: 320px;
    background: #000;
    border-top-left-radius: var(--bs-card-border-radius, .375rem);
    border-top-right-radius: var(--bs-card-border-radius, .375rem);
    object-fit: contain;
}

.compare-chart-box { height: 340px; }
.compare-picker-menu {
    max-height: 320px;
    overflow-y: auto;
    min-width: 260px;
}
