/* ============================================
   SUPERCUT AND MARKER VIDEO EDITOR — STYLES
   Extracted from editor.html
   ============================================ */

/* CSS Variables for Theme Support */
:root {
    --primary-color: #4db8ff;
    --secondary-color: #1976D2;
    --secondary-dark: #0d47a1;
    --success-color: #4CAF50;
    --danger-color: #ef5350;
    --warning-color: #FF9800;
    --info-color: #00BCD4;
    
    /* Light mode colors */
    --main-bg: #ffffff;
    --light-bg: #f5f5f5;
    --timeline-bg: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
    --hover-bg: #f0f0f0;
    --border-color: #ccc;
    --text-color: #333;
    --text-muted: #666;
    --input-bg: #ffffff;
    --transcript-tab-bg: #f5f5f5;
    
    /* Marker colors */
    --marker-red: rgba(220, 53, 69, 0.4);
    --marker-red-border: rgba(220, 53, 69, 0.7);
    --marker-blue: rgba(33, 150, 243, 0.5);
    --marker-blue-border: rgba(33, 150, 243, 0.9);
    
    /* Common styles */
    --border-radius: 8px;
    --transition-speed: 0.2s;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --main-bg: #1e1e1e;
        --light-bg: #2a2a2a;
        --timeline-bg: linear-gradient(to bottom, #3a3a3a, #2a2a2a);
        --hover-bg: #3a3a3a;
        --border-color: #444;
        --text-color: #e0e0e0;
        --text-muted: #999;
        --input-bg: #2a2a2a;
        --transcript-tab-bg: #2a2a2a;
    }
}

/* Global Styles */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-bg);
    margin: 0;
    padding: 10px;
    color: var(--text-color);
}

.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    background-color: var(--main-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.container { max-width: 100%; }

.video-container {
    background: var(--main-bg);
    border-radius: var(--border-radius);
    padding: 0;
}

/* ============================================
   VIDEO PLAYER
   ============================================ */
.video-wrapper {
    position: relative;
    width: 100%;
    background: black;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

#my_video { width: 100%; height: auto; display: block; }

.subtitle-display {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 16px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 4px;
}

.subtitle-display.hidden { display: none !important; }

/* Hide the native video timeline/seek bar */
video::-webkit-media-controls-timeline { display: none !important; }
video::-moz-media-controls-timeline { display: none !important; }
video::-webkit-media-controls-current-time-display,
video::-webkit-media-controls-time-remaining-display { display: none !important; }

/* ============================================
   MAIN TIMELINE
   ============================================ */
.main-timeline-container {
    position: relative;
    margin: 20px 0;
    height: 45px;
    width: 100%;
    background: var(--timeline-bg);
    border-radius: var(--border-radius);
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--border-color);
}

.main-timeline-track {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 20px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.main-timeline-selection {
    position: absolute;
    top: 20px;
    height: 20px;
    background: rgba(77, 184, 255, 0.4) !important;
    border-radius: var(--border-radius);
    pointer-events: none;
    z-index: 2;
}

.main-timeline-playhead {
    position: absolute;
    top: 5px;
    width: 3px;
    height: 40px;
    background: var(--primary-color);
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 3;
    pointer-events: auto;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(77, 184, 255, 0.6);
}

.main-timeline-playhead::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; 
    height: 0; 
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--primary-color);
}

/* ============================================
   TIME INFO DISPLAYS
   ============================================ */
.time-info {
    display: flex;
    gap: 15px;
    font-family: monospace;
    font-size: 14px;
    margin: 5px 0;
    flex-wrap: wrap;
    color: var(--text-color);
}

/* ============================================
   DROP ZONE
   ============================================ */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-speed) ease-in-out;
    margin-bottom: 20px;
    width: 100%;
    background: var(--light-bg);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(77, 184, 255, 0.1);
    box-shadow: 0 0 20px rgba(77, 184, 255, 0.3);
}

.drop-zone p { margin: 0; color: var(--text-muted); }

/* ============================================
   TRANSCRIPT / SUBTITLE
   ============================================ */
.subtitle-list {
    height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 10px;
    resize: vertical;
    border-radius: 4px;
    background-color: var(--light-bg);
    width: 100%;
    color: var(--text-color);
}

.subtitle-item {
    padding: 5px;
    cursor: pointer;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    color: var(--text-color);
}

.subtitle-item:hover { background-color: var(--hover-bg); }

.subtitle-item.active, .transcript-segment.active {
    background-color: rgba(77, 184, 255, 0.2);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.time-stamp {
    color: var(--text-muted);
    font-size: 12px;
    margin-right: 10px;
    display: inline-block;
    font-weight: 600;
}

.transcript-segment {
    margin-bottom: 8px;
    padding: 5px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    color: var(--text-color);
}

.transcript-word {
    cursor: pointer;
    padding: 2px 0;
    margin: 0 1px;
    display: inline-block;
    color: var(--text-color);
}

.transcript-word:hover {
    background-color: var(--hover-bg);
    border-radius: 3px;
}

.video-subtitle-word {
    padding: 0 2px;
    border-radius: 3px;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.word-active {
    background-color: #ffa726;
    color: black;
    font-weight: bold;
    border-radius: 3px;
}

.search-match {
    background-color: rgba(255, 167, 38, 0.3);
    border-radius: 3px;
    color: #ffa726;
}

.current-match {
    background-color: rgba(255, 167, 38, 0.5) !important;
    font-weight: bold;
    border-radius: 3px;
    box-shadow: 0 0 3px rgba(255, 167, 38, 0.5);
    color: white;
}

.search-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    width: 100%;
}

.search-options {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 5px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    margin-top: -10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.search-box {
    flex: 1 1 auto;
    min-width: 150px;
    width: 100%;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: none;
    z-index: 10;
}

.search-clear-btn:hover { color: #ef5350; }

.search-navigation {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================
   MARKERS
   ============================================ */
.marker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color var(--transition-speed);
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
}

.marker-item.active {
    background: rgba(77, 184, 255, 0.1);
    border-left: 3px solid var(--primary-color);
}

.marker-label { 
    cursor: pointer; 
    flex: 1;
    overflow-wrap: break-word;
    word-break: break-word;
    color: var(--text-color);
}

.marker-actions { display: flex; gap: 5px; flex-wrap: nowrap; }

.marker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.marker-comment {
    padding: 8px;
    background-color: var(--hover-bg);
    border-radius: 4px;
    margin-top: 5px;
    max-height: 60px;
    overflow-y: auto;
    font-size: 0.9rem;
    width: 100%;
    border-left: 3px solid var(--border-color);
    color: var(--text-muted);
}

.edit-marker {
    background-color: #42a5f5;
    border-color: #42a5f5;
    color: white;
}

.edit-marker:hover { background-color: #64b5f6; }

.marker-edit-form {
    padding: 10px;
    background-color: var(--light-bg);
    border-radius: 4px;
    margin-top: 5px;
    border-left: 3px solid var(--primary-color);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-control, .form-select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(77, 184, 255, 0.25);
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.form-control:active, .form-control:focus-visible { color: var(--text-color); }

.form-control::placeholder { color: #999; opacity: 1; }
.form-control::-webkit-input-placeholder { color: #999; opacity: 1; }
.form-control::-moz-placeholder { color: #999; opacity: 1; }
.form-control:-ms-input-placeholder { color: #999; opacity: 1; }

.form-label { color: var(--text-muted); font-weight: 500; }

.input-group { width: 100%; }
.input-group > .form-control, .input-group > .btn { min-height: 38px; }

.input-group-text {
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.create-marker-from-subtitle {
    font-size: 14px;
    padding: 2px 6px;
    color: #fff;
    background-color: var(--secondary-color);
    border: none;
    border-radius: var(--border-radius);
    margin-left: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 30px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-marker-from-subtitle:hover { background-color: var(--secondary-dark); }
.create-marker-from-subtitle.float-end { float: right !important; }

.info-text { color: var(--text-muted); font-style: italic; }

/* ============================================
   TABS
   ============================================ */
.nav-tabs {
    width: 100%;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--light-bg);
    color: var(--text-muted);
}

.nav-tabs .nav-link:hover { background-color: var(--hover-bg); color: var(--text-color); }

.nav-tabs .nav-link.active {
    color: var(--text-color);
    background-color: var(--main-bg);
    border-color: var(--border-color) var(--border-color) var(--main-bg);
    font-weight: 500;
}

.nav-tabs .nav-link#transcript-tab { background-color: var(--transcript-tab-bg); color: var(--text-muted); }
.nav-tabs .nav-link#transcript-tab.active { background-color: var(--main-bg); color: var(--text-color); }
.nav-tabs .nav-link#transcript-tab:hover:not(.active) { background-color: var(--hover-bg); }

.tab-content {
    width: 100%;
    background-color: var(--main-bg);
    padding: 15px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.tab-pane { width: 100%; }

h2 { color: var(--text-color); text-align: center; margin-bottom: 30px; font-weight: 600; }
h5 { color: var(--text-muted); font-weight: 500; }

/* ============================================
   TIMELINE MARKER REGIONS
   ============================================ */
.timeline-marker-region {
    position: absolute;
    top: 18px;
    height: 24px;
    background-color: rgba(239, 83, 80, 0.3);
    border: 1px solid rgba(239, 83, 80, 0.5);
    border-radius: 2px;
    pointer-events: all;
    cursor: pointer;
    z-index: 1;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.timeline-marker-region:hover {
    background-color: rgba(239, 83, 80, 0.4);
    border-color: rgba(239, 83, 80, 0.7);
    z-index: 2;
}

.timeline-marker-region.active {
    background-color: rgba(239, 83, 80, 0.5);
    border-color: rgba(239, 83, 80, 0.8);
    border-width: 2px;
    box-shadow: 0 0 4px rgba(239, 83, 80, 0.4);
}

.timeline-marker-region.silent {
    background-color: rgba(255, 100, 0, 0.25);
    border: 1px solid rgba(255, 0, 0, 0.5);
}

.timeline-marker-region.silent:hover {
    background-color: rgba(255, 100, 0, 0.35);
    border-color: rgba(255, 0, 0, 0.7);
}

.timeline-marker-region.silent.active {
    background-color: rgba(255, 100, 0, 0.45);
    border-color: rgba(255, 0, 0, 0.8);
    border-width: 2px;
    box-shadow: 0 0 4px rgba(255, 0, 0, 0.4);
}

.marker-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

@keyframes markerPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 83, 80, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 83, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 83, 80, 0); }
}

.timeline-marker-region.pulse { animation: markerPulse 0.5s ease-out; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-success { background-color: var(--success-color); border-color: var(--success-color); }
.btn-danger { background-color: var(--danger-color); border-color: var(--danger-color); }
.btn-warning { background-color: var(--warning-color); border-color: var(--warning-color); }
.btn-info { background-color: var(--info-color); border-color: var(--info-color); }

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border-color);
    background-color: transparent;
}
.btn-outline-secondary:hover { background-color: var(--hover-bg); color: var(--text-color); }

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}
.btn-outline-primary:hover { background-color: var(--primary-color); color: white; }

.btn-outline-success {
    color: var(--success-color);
    border-color: var(--success-color);
    background-color: transparent;
}
.btn-outline-success:hover { background-color: var(--success-color); color: white; }

.btn-outline-danger {
    color: var(--danger-color);
    border-color: var(--danger-color);
    background-color: transparent;
}
.btn-outline-danger:hover { background-color: var(--danger-color); color: white; }

/* ============================================
   REGION NAVIGATION
   ============================================ */
.region-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allows wrapping if screen gets too narrow */
    gap: 10px;
    margin: 15px 0;
    padding: 12px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

/* Prevent all buttons in this section from stretching globally */
.region-navigation .btn {
    flex: 0 0 auto; 
    width: auto;
    min-width: 44px; /* Ensures minimum touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.region-nav-info { color: var(--text-muted); font-weight: 500; }
}

/* ============================================
   DURATION INPUT GROUP
   ============================================ */
.custom-duration-group { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.duration-row { display: flex; align-items: center; gap: 5px; }
.duration-separator { display: flex; align-items: center; }

/* ============================================
   TOGGLE BUTTONS
   ============================================ */
#toggle-subtitles { font-size: 12px; padding: 2px 8px; line-height: 1.4; }
#toggle-subtitles.active { background-color: var(--danger-color); border-color: var(--danger-color); color: white; }

#play-regions.active { background-color: var(--danger-color); border-color: var(--danger-color); color: white; }

#edit-active-marker { display: inline-flex; align-items: center; gap: 4px; }
#edit-active-marker:disabled { opacity: 0.5; cursor: not-allowed; }
#delete-active-marker { display: inline-flex; align-items: center; gap: 4px; }
#delete-active-marker:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   MARKER SEARCH ACTIONS BAR
   ============================================ */
.marker-search-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 10px;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.marker-match-counter { font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.marker-search-buttons { display: flex; gap: 6px; flex-shrink: 0; }
.marker-search-buttons .btn { font-size: 12px; padding: 3px 10px; }

/* ============================================
   jQuery UI RANGE SLIDER — IN/OUT POINT CONTROL
   ============================================ */
#time-slider {
    margin: 12px 0;
}

.ui-slider {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    height: 60px;
}

.ui-slider .ui-slider-range {
    background: var(--marker-blue);
    border: 1px solid var(--marker-blue-border);
    border-radius: var(--border-radius);
}

/* Red range when an existing marker is being edited */
.ui-slider.editing-marker .ui-slider-range {
    background: var(--marker-red);
    border: 1px solid var(--marker-red-border);
}

/* Saved marker overlays inside the slider — mirrors .timeline-marker-region */
.ui-slider .slider-marker-overlay {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: rgba(239, 83, 80, 0.25);
    border: 1px solid rgba(239, 83, 80, 0.5);
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
}

.ui-slider .slider-marker-overlay.active {
    background-color: rgba(239, 83, 80, 0.45);
    border-color: rgba(239, 83, 80, 0.8);
    border-width: 2px;
    box-shadow: 0 0 4px rgba(239, 83, 80, 0.4);
}

.ui-slider .ui-slider-handle {
    background: var(--main-bg);
    border: 2px solid var(--primary-color);
    border-radius: 0%;
    width: 10px;
    height: 60px;
    top: 0px;
    cursor: ew-resize;
    outline: none;
}

/* IN handle (first) = green */
.ui-slider .ui-slider-handle:first-of-type {
    border-color: var(--success-color);
    background: var(--main-bg);
}

.ui-slider .ui-slider-handle:first-of-type:hover,
.ui-slider .ui-slider-handle:first-of-type:focus {
    border-color: var(--success-color);
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

/* OUT handle (last) = red */
.ui-slider .ui-slider-handle:last-of-type {
    border-color: var(--danger-color);
    background: var(--main-bg);
}

.ui-slider .ui-slider-handle:last-of-type:hover,
.ui-slider .ui-slider-handle:last-of-type:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 6px rgba(239, 83, 80, 0.5);
}

/* ============================================
   WAVEFORM SECTION
   ============================================ */
#waveform-container {
    position: relative;
    width: 100%;
    height: 128px;
    background: var(--light-bg);
    border-radius: 5px;
}

#waveform-scroll-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--light-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--hover-bg);
}

#waveform-scroll-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(77, 184, 255, 0.4);
    transform: translateY(-1px);
}

#waveform-scroll-container::before {
    content: "Click anywhere to seek";
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(26, 26, 26, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

#waveform-scroll-container:hover::before { opacity: 1; }

#waveform-scroll-container::-webkit-scrollbar { height: 8px; }
#waveform-scroll-container::-webkit-scrollbar-track { background: var(--light-bg); border-radius: 4px; }
#waveform-scroll-container::-webkit-scrollbar-thumb { background-color: var(--primary-color); border-radius: 4px; }

#waveform { width: 100%; min-height: 128px; position: relative; }
#waveform canvas { cursor: pointer !important; transition: opacity 0.1s ease; }
#waveform canvas:hover { opacity: 0.9; }
#waveform canvas:active { opacity: 0.8; }

#waveform-message {
    display: none;
    margin: 10px 0;
    padding: 12px;
    background-color: var(--light-bg);
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    border-left: 4px solid var(--secondary-color);
    color: var(--text-color);
}

#loading-indicator {
    display: none;
    color: var(--primary-color);
    margin: 10px 0;
    text-align: center;
    font-weight: 500;
}

/* ============================================
   WAVESURFER REGIONS
   ============================================ */
.wavesurfer-region { cursor: move !important; }
.wavesurfer-region[data-id*="wavesurfer"] { border: 1px solid rgba(239, 83, 80, 0.4) !important; }
.wavesurfer-region:hover { opacity: 0.8 !important; }

.wavesurfer-handle {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border: 2px solid rgba(239, 83, 80, 0.6) !important;
    width: 8px !important;
    cursor: ew-resize !important;
}
.wavesurfer-handle:hover {
    background-color: rgba(239, 83, 80, 0.8) !important;
    border-color: rgba(239, 83, 80, 1) !important;
}

.wavesurfer-region.wavesurfer-marker-region {
    background: rgba(239, 83, 80, 0.2) !important;
    border-left: 2px solid rgba(239, 83, 80, 0.6);
    border-right: 2px solid rgba(239, 83, 80, 0.6);
}

.wavesurfer-region.wavesurfer-marker-active {
    background: rgba(239, 83, 80, 0.4) !important;
    border-left: 2px solid rgba(239, 83, 80, 0.8);
    border-right: 2px solid rgba(239, 83, 80, 0.8);
    box-shadow: 0 0 5px rgba(239, 83, 80, 0.5);
}

.wavesurfer-region.wavesurfer-selection-region {
    background: rgba(77, 184, 255, 0.2) !important;
    border-left: 2px solid rgba(77, 184, 255, 0.6);
    border-right: 2px solid rgba(77, 184, 255, 0.6);
}

.wavesurfer-region::after {
    content: attr(data-label);
    position: absolute;
    top: -20px;
    left: 0;
    background: var(--light-bg);
    color: var(--text-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.wavesurfer-region:hover::after { opacity: 1; }
.wavesurfer-region.wavesurfer-drag { opacity: 0.6 !important; cursor: grabbing !important; }
.wavesurfer-region.wavesurfer-selection-region { z-index: 3 !important; }
.wavesurfer-region.wavesurfer-marker-region { z-index: 2 !important; }

/* Editing marker visual feedback */
.wavesurfer-region.editing-marker {
    cursor: grab !important;
    box-shadow: 0 0 8px rgba(77, 184, 255, 0.5);
    z-index: 5 !important;
}
.wavesurfer-region.editing-marker:active { cursor: grabbing !important; }
.wavesurfer-region.editing-marker .wavesurfer-handle {
    animation: editPulse 1s infinite;
    background-color: var(--primary-color) !important;
}

.marker-item.editing {
    background: linear-gradient(90deg, rgba(77, 184, 255, 0.1) 0%, var(--light-bg) 100%);
    border-left: 4px solid var(--primary-color);
}

@keyframes editPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    background-color: var(--light-bg) !important;
    border: 1px solid var(--border-color) !important;
}
.modal-header { border-bottom: 1px solid var(--border-color) !important; }
.modal-footer { border-top: 1px solid var(--border-color) !important; }
.modal-title { color: var(--text-color) !important; }
.modal-body { color: var(--text-color) !important; }

/* ============================================
   SCROLLBARS
   ============================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--light-bg); border-radius: 5px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   SILENCE DETECTION PANEL
   ============================================ */
.silence-detection-panel {
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.silence-detection-panel .card-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 8px 8px 0 0;
    padding: 12px 20px;
}

.silence-detection-panel .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.silence-detection-panel .card-body { padding: 20px; }

.silence-detection-panel .input-group {
    border-radius: 6px;
    overflow: hidden;
}

.silence-detection-panel .input-group .btn-outline-secondary {
    border: none;
    background: var(--light-bg);
    color: var(--text-color);
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 36px;
}

.silence-detection-panel .input-group .btn-outline-secondary:hover {
    background: var(--danger-color);
    color: white;
}

.silence-detection-panel input[type="number"] {
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    background: var(--light-bg);
    color: var(--text-color);
}

.silence-detection-panel input[type="number"]::-webkit-inner-spin-button,
.silence-detection-panel input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.silence-detection-panel input[type="number"] { -moz-appearance: textfield; }

#detect-silence {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    color: white;
}
#detect-silence:hover { box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4); }
#detect-silence:disabled { background: #6c757d; cursor: not-allowed; }

#clear-all-silence {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    font-weight: 600;
}
#clear-all-silence:hover:not(:disabled) { box-shadow: 0 6px 12px rgba(245, 87, 108, 0.4); }

#load-all-silence {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    font-weight: 600;
}
#load-all-silence:hover:not(:disabled) { box-shadow: 0 6px 12px rgba(79, 172, 254, 0.4); }

#detection-status {
    border-left: 4px solid #0dcaf0;
}
#detection-status.alert-success { border-left-color: #28a745; }
#detection-status.alert-danger { border-left-color: #dc3545; }

.silence-nav-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
/* Mid-range: 576px to 992px (Prevents stretching) */
@media (max-width: 992px) {
    .region-navigation {
        padding: 10px;
        gap: 8px;
    }
    
    /* Ensure Bootstrap's 'ms-2' or 'mx-2' doesn't break centering */
    .region-navigation .btn {
        margin: 0 !important; 
    }

    /* Hide the vertical rule to save horizontal space */
    .region-navigation .vr {
        display: none !important;
    }
}   
   
@media (max-width: 768px) {
    .timeline-marker-region { top: 14px; height: 22px; }
    .wavesurfer-handle { width: 12px !important; height: 100%; }
    .region-navigation {
        display: grid;
        grid-template-columns: 1fr auto auto auto auto 1fr;
        gap: 8px;
        padding: 10px;
    }
    
    /* Remove margins that cause lopsided spacing in a grid */
    .region-navigation .ms-2, 
    .region-navigation .mx-2 {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }	
}

/* ============================================
   RESPONSIVE — SMALL MOBILE
   ============================================ */
@media (max-width: 576px) {
    .region-navigation {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    /* Top Row: Navigation text buttons */
    #prev-marker-btn { grid-column: 1 / span 2; width: 100%; }
    #next-marker-btn { grid-column: 3 / span 2; width: 100%; }

    /* Bottom Row: Action icon buttons */
    #jump-to-in, #jump-to-out, 
    #edit-active-marker, #delete-active-marker {
        grid-row: 2;
        width: 100%;
        height: 44px;
        padding: 0;
    }
}

/* ============================================
   RESPONSIVE — EXTRA SMALL MOBILE
   ============================================ */
@media (max-width: 480px) {
    body { padding: 5px; }
    .main-wrapper { padding: 15px; border-radius: 10px; }
    .subtitle-display { font-size: 14px; padding: 5px; bottom: 50px; }
    .d-flex { flex-direction: column; }
    .d-flex.flex-wrap { flex-direction: row; }
    .d-flex > * { width: 100%; margin-bottom: 5px; }
    .search-navigation, .marker-actions, .time-info { flex-direction: row; width: 100%; }
    .btn, .form-control { min-height: 44px; }
    .frame-step { width: auto; min-width: 36px; }
    .marker-header { flex-direction: column; align-items: flex-start; }
    .marker-item { flex-direction: column; align-items: flex-start; }
    .marker-actions { margin-top: 8px; width: 100%; justify-content: space-between; }
    .btn-group { gap: 5px; }
    .btn-group .btn { flex: 1 1 calc(50% - 5px); }
    .marker-subtitle { font-size: 0.85rem; padding: 5px; }
    .marker-edit-form textarea { font-size: 0.85rem; }
    .tick-label { font-size: 7px; padding: 0px 1px; }
    .marker-search-actions { flex-direction: column; align-items: stretch; gap: 6px; }
    .marker-match-counter { text-align: center; }
    .marker-search-buttons { justify-content: center; }
    .silence-detection-panel .card-body { padding: 10px; }
    #detect-silence, #clear-all-silence, #load-all-silence {
        width: 100%; margin-bottom: 5px; padding: 8px 16px; font-size: 0.9rem;
    }
}
