/* Blur Video Area Tool Styles (Timeline Edition) */

/* === Timeline Slider === */
.timeline-container {
    width: 100%;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.timeline-wrapper {
    position: relative;
    width: 100%;
    height: 60px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
}

.timeline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #dc3545;
    pointer-events: none;
    z-index: 10;
}

.timeline-playhead::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    border: 2px solid #fff;
}

[data-bs-theme="dark"] .timeline-wrapper {
    background: #2b3035;
}

[data-bs-theme="dark"] .timeline-header {
    color: #adb5bd;
}

/* === Canvas & Video Player === */
.blur-canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0;
}

.blur-selection-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.blur-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    pointer-events: auto;
}

.video-canvas-wrapper {
    position: relative;
}

/* === Blur Regions List === */
.blur-regions-list {
    min-height: 100px;
}

.blur-region-item {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.blur-region-item:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blur-region-item.active {
    background: #e7f3ff;
    border-color: #0d6efd;
}

.region-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.region-item-name {
    font-weight: 600;
    font-size: 16px;
    color: #212529;
}

.region-item-details {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.region-item-details .badge {
    font-size: 12px;
    font-weight: 500;
}

/* === Keyframes List === */
.keyframes-list {
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.keyframe-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.keyframe-item:last-child {
    margin-bottom: 0;
}

.keyframe-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.keyframe-info strong {
    font-size: 14px;
    color: #212529;
}

.keyframe-info .text-muted {
    font-size: 12px;
}

/* === Video Preview === */
.video-preview-wrapper {
    position: relative;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-preview {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* === Range Slider (hacker-typer-screen style) === */
#blurIntensity {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

#blurIntensity::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#blurIntensity::-webkit-slider-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#blurIntensity::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#blurIntensity::-moz-range-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#blurIntensity::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(to right,
        #052c65 0%,
        #052c65 var(--value, 28.57%),
        transparent var(--value, 28.57%)),
        repeating-linear-gradient(
            45deg,
            #e9ecef,
            #e9ecef 5px,
            #d3d6d9 5px,
            #d3d6d9 10px
        );
    border-radius: 4px;
}

#blurIntensity::-moz-range-track {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
}

#blurIntensity::-moz-range-progress {
    height: 8px;
    background: #052c65;
    border-radius: 4px;
}

/* Dark mode slider */
[data-bs-theme="dark"] #blurIntensity {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] #blurIntensity::-webkit-slider-runnable-track {
    background: linear-gradient(to right,
        #6ea8fe 0%,
        #6ea8fe var(--value, 28.57%),
        transparent var(--value, 28.57%)),
        repeating-linear-gradient(
            45deg,
            #343a40,
            #343a40 5px,
            #495057 5px,
            #495057 10px
        );
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-track {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] #blurIntensity::-moz-range-progress {
    background: #6ea8fe;
}

/* === Badge Styling === */
#blurIntensityValue {
    font-size: 14px;
    padding: 6px 12px;
    min-width: 50px;
    text-align: center;
}

#regionsCount {
    font-size: 13px;
    padding: 4px 10px;
}

/* === Dark Mode === */
[data-bs-theme="dark"] .blur-canvas-container {
    background-color: #1a1a1a;
}

[data-bs-theme="dark"] .video-preview-wrapper {
    background-color: #1a1a1a;
}

[data-bs-theme="dark"] .blur-region-item {
    background: #2b3035;
    border-color: #495057;
}

[data-bs-theme="dark"] .blur-region-item:hover {
    border-color: #6c757d;
}

[data-bs-theme="dark"] .blur-region-item.active {
    background: #1a3a52;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .region-item-name {
    color: #f8f9fa;
}

[data-bs-theme="dark"] .keyframes-list {
    background: #2b3035;
}

[data-bs-theme="dark"] .keyframe-item {
    background: #1a1d20;
    border-color: #495057;
}

[data-bs-theme="dark"] .keyframe-info strong {
    color: #f8f9fa;
}

/* === Responsive === */
@media (max-width: 768px) {
    .blur-canvas-container {
        margin-bottom: 1rem;
    }

    .blur-selection-canvas,
    .blur-overlay-canvas {
        max-height: 400px;
        object-fit: contain;
    }

    .region-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .region-item-actions {
        width: 100%;
    }

    .keyframe-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .keyframe-item .btn {
        width: 100%;
    }
}

/* === Loading State === */
.blur-canvas-container.loading {
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.blur-canvas-container.loading::after {
    content: "Loading video preview...";
    color: #6c757d;
    font-size: 14px;
}

/* === Animation === */
.blur-region-item,
.keyframe-item {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Scrollbar Styling === */
.keyframes-list::-webkit-scrollbar {
    width: 8px;
}

.keyframes-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.keyframes-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.keyframes-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-bs-theme="dark"] .keyframes-list::-webkit-scrollbar-track {
    background: #1a1d20;
}

[data-bs-theme="dark"] .keyframes-list::-webkit-scrollbar-thumb {
    background: #495057;
}

[data-bs-theme="dark"] .keyframes-list::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* === AI Detection Styles === */
.face-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
}

.face-checkbox-item {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.face-checkbox-item:last-child {
    margin-bottom: 0;
}

.face-checkbox-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.face-checkbox-item .form-check-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

[data-bs-theme="dark"] .face-checkbox-list {
    background: #2b3035;
}

[data-bs-theme="dark"] .face-checkbox-item {
    background: #1a1d20;
    border-color: #495057;
}

[data-bs-theme="dark"] .face-checkbox-item:hover {
    border-color: #0d6efd;
}

/* === AI Progress === */
#aiProgress .progress {
    height: 8px;
    border-radius: 4px;
}

/* === AI Card Styling === */
#aiDetectionCard .card-header {
    border-bottom: none;
}

#aiDetectionCard .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* === Detected Faces List === */
.detected-faces-list {
    border-top: 1px solid #dee2e6;
    padding-top: 16px;
    margin-top: 8px;
}

[data-bs-theme="dark"] .detected-faces-list {
    border-color: #495057;
}

/* === AI Badge Styles === */
.blur-region-item .badge.bg-primary {
    font-size: 10px;
    padding: 3px 6px;
}

/* === Preview Blur Toggle === */
.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
}

.form-switch .form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

/* === AI Generated Region === */
.blur-region-item.ai-generated {
    border-left: 3px solid #198754;
}

/* === Mobile Responsive for AI === */
@media (max-width: 768px) {
    #aiDetectionCard .row.g-2 > div {
        margin-bottom: 8px;
    }

    .face-checkbox-list {
        max-height: 150px;
    }

    .detected-faces-list .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .detected-faces-list .btn {
        flex: 1 1 auto;
        min-width: 100px;
    }

    #createRegionsFromFacesBtn {
        width: 100%;
        margin-top: 8px;
    }
}
