/**
 * Transcribe AI - Complete Styles - Version 17.0
 * With Summary and Highlights Support
 */

/* ========================================
   Base & Upload UI Styles
   ======================================== */
#transcribe-ai-container, .transcribe-ai-viewer { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937; 
    border-radius: 2pc;
    background: #ffffffa1;
    line-height: 1.6; 
}
* { box-sizing: border-box; }

#upload-view { animation: fadeIn 0.3s ease; }

#drop-zone { 
    background: #f9fafb; 
    border: 2px dashed #d1d5db; 
    border-radius: 12px; 
    padding: 3rem; 
    text-align: center; 
    cursor: pointer; 
    transition: all 0.3s ease; 
}

#drop-zone:hover, #drop-zone.drag-over { 
    border-color: #3b82f6; 
    background: #eff6ff; 
}

.file-info-content { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    padding: 1rem; 
    background: white; 
    border: 1px solid #e5e7eb; 
    border-radius: 8px; 
}

.file-icon { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 48px; 
    height: 48px; 
    background: #eff6ff; 
    border-radius: 8px; 
    color: #3b82f6; 
}

.file-details { flex: 1; } 

.file-name { 
    font-weight: 600; 
    color: #111827; 
    margin: 0 0 0.25rem 0; 
}

.file-meta { 
    font-size: 0.875rem; 
    color: #6b7280; 
    margin: 0; 
}

.remove-file { 
    background: none; 
    border: none; 
    color: #6b7280; 
    cursor: pointer; 
    padding: 0.5rem; 
    border-radius: 4px; 
    transition: all 0.2s; 
}

.remove-file:hover { 
    background: #fee2e2; 
    color: #ef4444; 
}

.progress-bar-container { 
    height: 8px; 
    background: #e5e7eb; 
    border-radius: 999px; 
    overflow: hidden; 
}

.progress-bar { 
    height: 100%; 
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%); 
    border-radius: 999px; 
    transition: width 0.3s ease; 
}

.progress-text { 
    margin-top: 0.75rem; 
    font-size: 0.875rem; 
    color: #6b7280; 
    text-align: center; 
}

/* ========================================
   Transcript Viewer
   ======================================== */
.transcribe-ai-viewer-wrapper { 
    min-height: calc(100vh - 100px); 
    padding: 2rem 0; 
}

.transcribe-ai-viewer { 
    max-width: 1200px; 
    margin: 0 auto; 
    background: white; 
    border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 
    display: flex;
    flex-direction: column;
}

.viewer-header { 
    background: #1f2937; 
    color: white; 
    padding: 1rem 1.5rem; 
    flex-shrink: 0;
}

.header-content { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 1rem; 
}

.transcript-info h1 { 
    font-size: 1.25rem; 
    font-weight: 600; 
    margin: 0; 
}

.transcript-meta { 
    font-size: 0.875rem; 
    color: #9ca3af; 
    margin-top: 0.25rem; 
}

.btn-back { 
    display: inline-flex; 
    align-items: center; 
    gap: 0.5rem; 
    padding: 0.5rem 1rem; 
    background: rgba(255, 255, 255, 0.1); 
    color: white; 
    border-radius: 6px; 
    text-decoration: none; 
    transition: background 0.2s; 
}
.btn-back:hover { 
    background: rgba(255, 255, 255, 0.2); 
}

.sticky-container {
    position: sticky;
    top: 0;
    z-index: 100;
    /* This transition is important for when the shadow is added */
    transition: box-shadow 0.3s ease-in-out;
}

/* This class is now added by JavaScript when the user scrolls */
.sticky-container.is-sticky {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.sticky-container.scrolled {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
/* Ensure the audio player and control bar within the sticky container have a background
   to prevent content from showing through when the shadow is active. */
.sticky-container.is-sticky .audio-player-container {
    background: white;
}
.sticky-container.is-sticky .control-bar {
    background: #f9fafb; 
}

/* Remove all JavaScript-based sticky styles */
/* Add this new rule for the content area that follows the header */
#transcript-area-container {
    transition: padding-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Audio Player */
.audio-player-container { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    background: white; 
    padding: 1rem 1.5rem; 
    border-bottom: 1px solid #e5e7eb; 
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Control Bar */
.control-bar { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0.75rem 1.5rem; 
    background: #f9fafb; 
    border-bottom: 1px solid #e5e7eb; 
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When sticky, remove redundant borders */
.sticky-container.is-sticky .audio-player-container {
    border-bottom: 1px solid #f3f4f6;
}

.sticky-container.is-sticky .control-bar {
    background: #fafbfc;
    border-bottom: 1px solid #e5e7eb;
}

/* Placeholder to prevent content jump */
/* #sticky-placeholder {
    display: block;
    background: transparent;
}
*/

.player-controls { display: flex; align-items: center; gap: 0.5rem; }
.player-btn { background: none; border: none; color: #6b7280; cursor: pointer; padding: 0.5rem; border-radius: 50%; display: flex; transition: all 0.2s; }
.player-btn:hover { background: #f3f4f6; color: #111827; }
#playPauseBtn { background: #3b82f6; color: white; padding: 0.75rem; } 
#playPauseBtn:hover { background: #2563eb; }
.player-time { font-size: 0.875rem; color: #6b7280; min-width: 50px; text-align: center; }
.progress-slider { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; background: linear-gradient(to right, #3b82f6 0%, #3b82f6 var(--progress, 0%), #e5e7eb var(--progress, 0%), #e5e7eb 100%); border-radius: 999px; outline: none; cursor: pointer; transition: all 0.1s; }
.progress-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background: #3b82f6; border-radius: 50%; cursor: pointer; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transform: scale(0); transition: transform 0.2s; }
.progress-slider:hover::-webkit-slider-thumb { transform: scale(1); }
#speedBtn { font-size: 0.875rem; font-weight: 600; padding: 0.25rem 0.5rem; background: #f3f4f6; border-radius: 4px; }

/* Control Bar */
.control-bar { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0.75rem 1.5rem; 
    background: #f9fafb; 
    border-bottom: 1px solid #e5e7eb; 
    flex-shrink: 0;
}
/* Control Bar (ensure it's included after sticky container) */
.control-bar { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0.75rem 1.5rem; 
    background: #f9fafb; 
    border-bottom: 1px solid #e5e7eb; 
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.control-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.control-btn { 
    display: inline-flex; 
    align-items: center; 
    gap: 0.5rem; 
    padding: 0.5rem 0.75rem; 
    background: white; 
    border: 1px solid #d1d5db; 
    border-radius: 6px; 
    color: #374151; 
    font-size: 0.875rem; 
    font-weight: 500; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
}
.control-btn:hover { 
    background: #f3f4f6; 
    border-color: #9ca3af; 
    transform: translateY(-1px);
}
.control-btn:active {
    transform: translateY(0);
}
.control-btn.active { 
    background: #eff6ff; 
    border-color: #3b82f6; 
    color: #2563eb; 
}
.control-btn-danger { color: #dc2626; }
.control-btn-danger:hover { 
    background: #fee2e2; 
    border-color: #fecaca; 
}

/* Translation UI */
.translate-dropdown-container { position: relative; }
#translateDropdownBtn .dropdown-arrow { transition: transform 0.2s; }
#translate-language-list { display: none; position: absolute; top: calc(100% + 5px); left: 0; background: white; border: 1px solid #d1d5db; border-radius: 6px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 10; max-height: 250px; overflow-y: auto; width: max-content; min-width: 180px; }
#translate-language-list.open { display: block; }
#translate-language-list.open + #translateDropdownBtn .dropdown-arrow { transform: rotate(180deg); }
.translate-language-item { padding: 0.5rem 1rem; cursor: pointer; font-size: 0.875rem; color: #374151; transition: background-color 0.2s; white-space: nowrap; }
.translate-language-item:hover { background-color: #f3f4f6; }

/* Summary & Highlights Boxes */
#summaryBox, #highlightBox {
    display: none;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

#summaryContent {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.summary-section, .chapters-section {
    margin-bottom: 1.5rem;
}

.summary-section h4, .chapters-section h4 {
    margin: 0 0 0.75rem 0;
    color: #374151;
    font-weight: 600;
}

.summary-text {
    color: #4b5563;
    line-height: 1.7;
}

.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.chapter-item:hover {
    background: #e5e7eb;
}

.chapter-time {
    font-weight: 600;
    color: #3b82f6;
    min-width: 60px;
}

.chapter-title {
    color: #374151;
}

/* Highlights */
#highlightBox {
    padding: 1rem 1.5rem;
}

#highlightsList {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.highlights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.highlight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.highlight-item:hover {
    background: #f3f4f6;
}

.highlight-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.highlight-content {
    flex: 1;
    min-width: 0;
}

.highlight-text {
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.highlight-note-text {
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}

.delete-highlight {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.delete-highlight:hover {
    color: #ef4444;
}

/* Highlight Mode */
.transcript-content.highlight-mode {
    user-select: text;
    cursor: text;
}

.highlighted-text {
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: opacity 0.2s;
}

.highlighted-text:hover {
    opacity: 0.8;
}

/* Highlight popup improvements */
.highlight-popup {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    max-width: 90vw;
}
.highlight-colors {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-option.selected {
    border-color: #374151;
    transform: scale(1.1);
}

.highlight-note {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.save-highlight-btn {
    width: 100%;
    padding: 0.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.save-highlight-btn:hover {
    background: #2563eb;
}
/* Transcript Area */
#transcript-area-container {
    display: flex;
    overflow: hidden;
    height: 900px; /* Fixed height */
}
#original-content-wrapper { width: 100%; display: flex; flex-direction: column; transition: width 0.3s ease-in-out; }
#original-content-wrapper,
#translation-content-wrapper {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#transcript-content,
#translation-content {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    max-height: 850px; /* Adjust based on header heights */
}

.transcript-header, .translation-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.transcript-header h3, .translation-header h3 {
    flex-grow: 1;
    margin: 13px;
    font-size: 1rem;
    font-weight: 600;
}
#closeTranslationBtn {
    flex-shrink: 0;
}
.transcript-header {
    display: none;
}

#transcript-content, #translation-content { padding: 1.5rem; flex-grow: 1; }
#transcript-area-container.translation-active #original-content-wrapper { width: 50%; border-right: 1px solid #e5e7eb; }
#transcript-area-container.translation-active .transcript-header { display: flex; }
#translation-content-wrapper { width: 50%; display: none; flex-direction: column; }
#transcript-area-container.translation-active #translation-content-wrapper { display: flex; }

/* Editable Title & Speaker */
#transcript-title { cursor: pointer; color: #ffffff; transition: background-color 0.2s; padding: 0.25rem 0.5rem; border-radius: 4px; margin: -0.25rem -0.5rem; }
#transcript-title:hover { background-color: rgba(255, 255, 255, 0.1); }
#transcript-title.editing-title { background-color: white; color: #1f2937; outline: 2px solid #3b82f6; }
.speaker-label { cursor: pointer; padding: 2px 6px; border-radius: 4px; margin: -2px -6px; transition: background-color 0.2s; }
.speaker-label:hover { background-color: #f3f4f6; }
.speaker-label.editing-speaker { background-color: #eff6ff; outline: 2px solid #3b82f6; color: #1f2937; }

/* Utterance Styles */
.utterance-row { padding: 1rem 0; border-bottom: 1px solid #f3f4f6; transition: background 0.2s; }
.utterance-row.active { 
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 5px;
    padding: 1rem;
}
.utterance-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.speaker-info { display: flex; align-items: center; gap: 0.75rem; }
.speaker-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.875rem; }
.speaker-label { font-weight: 600; color: #374151; }
.utterance-timestamp { font-size: 0.875rem; color: #6b7280; }
.utterance-text { color: #1f2937; line-height: 1.7; margin: 0; }
.utterance-text .word { cursor: pointer; transition: background-color 0.2s; border-radius: 3px; padding: 1px 2px; margin: 0 -2px; }
.utterance-text .word:hover { background-color: #dbeafe; }
/* Active word highlighting - works for both regular words and highlighted words */
/* Active word highlighting - show on individual words */
.utterance-row.active .utterance-text .word.active-word {
    outline: 2px solid #ef4444 !important;
    outline-offset: 2px;
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-radius: 3px;
    transition: outline 0.1s, background-color 0.1s;
    position: relative;
    z-index: 1;
}

/* When a highlighted mark contains the active word */
.utterance-row.active mark.word-based-highlight.active-word {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    transition: outline 0.1s, box-shadow 0.1s;
}

.utterance-text:not([contenteditable="true"]) {
    cursor: pointer;
}
	
#transcript-content.editing .utterance-text { padding: 0.5rem; background: #f9fafb; border: 1px solid #d1d5db; border-radius: 6px; outline: none; }
#transcript-content.editing .utterance-text:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
#transcript-content.hide-timestamps .utterance-timestamp { display: none; }


#transcript-content.editing .utterance-text {
    padding: 0.5rem;
    background: #f9fafb;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#transcript-content.editing .utterance-text:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}


/* Visual indicator for edited utterances */
.utterance-row .utterance-text:not([contenteditable="true"]) {
    position: relative;
}

.utterance-row[data-edited="true"] .utterance-text::after {
    content: "✓ Edited";
    position: absolute;
    top: -8px;
    right: -8px;
    background: #10b981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* FIX #32: Better Performance for Long Transcripts */
.utterance-row {
    contain: layout style paint;
    will-change: auto;
}

.utterance-row.active {
    will-change: background-color;
}


/* Optimize word highlighting */
.word {
    display: inline;
    will-change: auto;
}

.word.active-word {
    will-change: background-color;
}


/* Search */
#searchBox { 
    padding: 0.75rem 1.5rem; 
    border-bottom: 1px solid #e5e7eb; 
    background: #f9fafb; 
    display:none; 
}

.search-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#searchInput { 
    flex: 1;
    padding: 0.5rem 1rem; 
    border: 1px solid #d1d5db; 
    border-radius: 6px; 
}

.search-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.search-nav button {
    background: white;
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
}

.search-nav button:hover {
    background: #f3f4f6;
    color: #111827;
}

#searchCounter {
    font-size: 0.875rem;
    color: #6b7280;
    padding: 0 0.5rem;
    min-width: 60px;
    text-align: center;
}

/* FIX: Search Highlighting Is Flawed */
mark.search-highlight {
    background: #fef9c3; /* A pleasant yellow */
    color: #713f12;      /* Darker text for readability */
    padding: 1px 3px;
    border-radius: 3px;
    box-shadow: 0 0 5px rgba(234, 179, 8, 0.3);
}

mark.search-highlight.current {
    background: #facc15; /* A stronger yellow for the current match */
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.6);
}


.flash-highlight {
    animation: flashHighlight 2s ease;
}

@keyframes flashHighlight {
    0%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Modal, Notification, Loading */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 12px; max-width: 500px; width: 90%; animation: fadeIn 0.2s ease-out; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid #e5e7eb; }
.modal-header h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #9ca3af; line-height: 1; }
.modal-close:hover { color: #1f2937; }
.modal-body { padding: 1.5rem; }

.notification { position: fixed; bottom: 20px; right: 20px; padding: 1rem 1.5rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 2000; display: flex; align-items: center; gap: 1rem; transform: translateX(calc(100% + 20px)); transition: transform 0.3s ease; }
.notification.show { transform: translateX(0); }
.notification-success { background: #10b981; color: white; }
.notification-error { background: #ef4444; color: white; }
.notification-info { background: #3b82f6; color: white; }
.notification-warning { background: #f59e0b; color: white; }
.notification-close { background: none; border: none; color: inherit; font-size: 1.25rem; cursor: pointer; opacity: 0.7; }

#loadingOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.9); display: flex; align-items: center; justify-content: center; z-index: 3000; }
.spinner { width: 40px; height: 40px; border: 4px solid #e5e7eb; border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; }
.loading-state, .error-message { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; color: #6b7280; text-align: center; }
.error-message { color: #b91c1c; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ENHANCED EXPORT MODAL STYLES ===== */
.modal-export-enhanced { max-width: 600px; }
.export-section { margin-bottom: 1.5rem; }
.export-section:last-child { margin-bottom: 0; }
.export-section h4 { margin: 0 0 1rem 0; font-size: 1rem; font-weight: 600; color: #374151; }
.export-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.75rem; }

.export-option {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.25rem;
    padding: 1rem 0.5rem; background: #f9fafb; border: 2px solid #e5e7eb;
    border-radius: 8px; cursor: pointer; transition: all 0.2s ease-in-out; position: relative;
}
.export-option:hover { background: #eff6ff; border-color: #93c5fd; }
.export-option.selected { background: #dbeafe; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3); }
.export-option .material-symbols-outlined { font-size: 1.75rem; color: #6b7280; }
.export-option.selected .material-symbols-outlined { color: #2563eb; }
.export-option span:nth-of-type(2) { font-weight: 500; font-size: 0.9rem; color: #111827; }
.export-option small { font-size: 0.75rem; color: #6b7280; }

.export-settings { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem; }
.export-checkbox, .export-radio { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; cursor: pointer; }
.export-checkbox input[type="checkbox"], .export-radio input[type="radio"] { width: 16px; height: 16px; cursor: pointer; accent-color: #3b82f6; flex-shrink: 0; }
.export-checkbox span, .export-radio span { font-size: 0.9rem; color: #374151; }

.export-radio-group { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.export-radio-group > label:first-child { font-weight: 600; display: block; margin-bottom: 0.75rem; }

.export-actions { display: flex; justify-content: flex-end; padding-top: 1.5rem; margin-top: 1.5rem; border-top: 1px solid #e5e7eb; }
#confirmExportBtn {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.5rem;
    background: #3b82f6; color: white; border: none; border-radius: 6px;
    font-size: 1rem; font-weight: 500; cursor: pointer; transition: background 0.2s;
}
#confirmExportBtn:hover { background: #2563eb; }

/* ========================================
   Enhanced Mobile Responsive & Accessibility
   ======================================== */

/* Smooth scroll for the entire page */
html {
    scroll-behavior: smooth;
}

@media (max-width: 768px) and (orientation: landscape) {
    .transcribe-ai-viewer {
        height: 100vh;
    }
    
    .audio-player-container {
        padding: 0.5rem 1rem;
    }
    
    .control-bar {
        padding: 0.5rem 1rem;
        flex-wrap: nowrap;
    }
    
    .control-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
}
@media (max-width: 768px) {
    .transcribe-ai-viewer-wrapper { 
        padding: 0; 
    } 
    .transcribe-ai-viewer { 
        border-radius: 0; 
        height: 100vh; 
        max-height: 100vh;
    }
    
    /* Sticky container adjustments for mobile */
    .sticky-container.is-sticky {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .sticky-container.is-sticky .control-bar {
        padding: 0.5rem 1rem;
    }
    
    .sticky-container.is-sticky .control-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .sticky-container.is-sticky .control-btn .material-symbols-outlined {
        font-size: 1.25rem;
    }
    
    .sticky-container.is-sticky .control-btn span:not(.material-symbols-outlined) {
        display: none; /* Hide text labels on mobile when sticky */
    }
    
    .header-content { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 0.5rem;
    }
    .transcript-info h1 {
        font-size: 1rem;
    }
    .audio-player-container { 
        flex-wrap: wrap; 
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    .player-controls { 
        order: 2; 
        width: 100%; 
        justify-content: center; 
        margin-top: 0.5rem; 
        gap: 0.75rem;
    }
    .progress-slider { 
        order: 1; 
        width: 100%; 
        margin: 0.5rem 0;
    } 
    .player-time {
        font-size: 0.75rem;
        min-width: 40px;
    }
    .control-bar { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 0.5rem; 
        padding: 0.5rem 1rem;
    }
    .control-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    .control-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    .notification { 
        bottom: 10px; 
        right: 10px; 
        left: 10px; 
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    /* Enhanced mobile translation view */
    #transcript-area-container.translation-active { 
        flex-direction: column; 
        height: auto;
    }
    #transcript-area-container.translation-active #original-content-wrapper,
    #transcript-area-container.translation-active #translation-content-wrapper { 
        width: 100%; 
        min-height: 300px;
        max-height: 40vh;
    }
    #transcript-area-container.translation-active #original-content-wrapper { 
        border-right: none; 
        border-bottom: 1px solid #e5e7eb; 
    }
    
    /* Mobile transcript content */
    #transcript-content, #translation-content {
        padding: 1rem;
        font-size: 0.9rem;
    }
    .utterance-row {
        padding: 0.75rem 0;
    }
    .utterance-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    .speaker-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    .utterance-timestamp {
        font-size: 0.75rem;
    }
    .utterance-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Mobile export modal */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-export-enhanced {
        max-width: none;
    }
    .export-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .export-option {
        padding: 0.75rem 0.5rem;
    }
    .export-option .material-symbols-outlined {
        font-size: 1.5rem;
    }
    
   #searchBox {
        position: fixed;
        top: auto;
        bottom: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        background: white;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1001;
    }
     #searchBox .find-container {
        flex-wrap: wrap;
    }
    
    #searchInput {
        font-size: 16px; /* Prevents iOS zoom */
        min-width: 200px;
    }
    /* Mobile translation dropdown */
    #translate-language-list {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90vw;
        max-width: 320px;
        max-height: 70vh;
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    }
    
    /* Mobile summary and highlights */
    #summaryContent, #highlightsList {
        max-height: 250px;
    }
    
    .highlight-popup {
        position: fixed !important;
        left: 50% !important;
        transform: translateX(-50%);
        bottom: 100px;
        top: auto !important;
    }
}

@media (max-width: 480px) {
    .transcribe-ai-viewer-wrapper {
        padding: 0;
    }
    .header-content {
        padding: 0;
    }
    .transcript-info h1 {
        font-size: 0.9rem;
    }
    .control-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    .control-btn .material-symbols-outlined {
        font-size: 1rem;
    }
    .export-options {
        grid-template-columns: 1fr;
    }
    .modal-body {
        padding: 1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .control-btn {
        border-width: 2px;
    }
    .utterance-row.active {
        background: #ffeb3b;
        color: #000;
    }
    .notification {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) { 
    *, *::before, *::after { 
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important; 
    } 
    .modal-content {
        animation: none;
    }
}

/* Focus styles for accessibility */
.control-btn:focus,
.player-btn:focus,
.export-option:focus,
button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- NEW STYLES FOR TIMESTAMPS DROPDOWN AND SENTENCE TIMESTAMPS --- */

.control-dropdown-container {
    position: relative;
}

.control-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
    min-width: 150px;
    padding: 0.25rem 0;
}

.control-dropdown-menu.open {
    display: block;
}

.control-dropdown-container .dropdown-arrow {
    transition: transform 0.2s;
}

.control-dropdown-menu.open + #timestampsBtn .dropdown-arrow,
.translate-language-list.open + #translateDropdownBtn .dropdown-arrow {
    transform: rotate(180deg);
}

.timestamps-option {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.timestamps-option:hover {
    background-color: #f3f4f6;
}

/* Styles for Sentence-level Timestamps */
.sentence-timestamp {
    display: none !important;
    font-size: 0;
    height: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    left: -9999px;
}

/* Control Classes */
#transcript-content.show-sentence-timestamps .sentence-timestamp {
    display: inline !important;
    position: static;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-right: 0.25rem;
    font-weight: normal;
    height: auto;
    width: auto;
    overflow: visible;
}

#transcript-content.hide-utterance-timestamps .utterance-timestamp {
    display: none; /* Hide utterance timestamps when class is present */
}
/* Update search highlight styles */
mark.search-highlight {
    background: #fef08a;
    padding: 2px 4px;
    border-radius: 3px;
    color: inherit;
}

mark.search-highlight.current {
    background: #fbbf24;
    outline: 2px solid #f59e0b;
}

#transcript-content.editing .sentence-timestamp,
#transcript-content.editing .utterance-timestamp {
    display: none !important;
}
#transcript-content.editing .sentence-timestamp {
    display: none !important;
}
/* Add a line break for better readability in sentence mode */
#transcript-content.show-sentence-timestamps .sentence-timestamp {
    display: block;
    margin-bottom: 0.25rem;
}


/* Find and Replace */
#searchBox .search-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#searchBox .find-container,
#searchBox .replace-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

#searchBox .find-container input,
#searchBox .replace-container input {
    flex: 1;
}

#replaceAllBtn {
    padding: 0.5rem 1rem;
    white-space: nowrap;
}

#searchBox {
    padding: 0.75rem;
    display: none;
}

#searchBox.open {
    display: block;
}

#searchBox .find-container,
#searchBox .replace-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

#searchBox .replace-container {
    margin-top: 0.5rem;
}

#searchBox input {
    flex-grow: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}
#searchBox input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

#searchBox .search-nav {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0; /* <-- ADD THIS LINE */
}

#searchBox .search-nav span {
    font-size: 0.75rem;
    color: #6b7280;
    padding: 0 0.5rem;
    border-right: 1px solid #d1d5db;
}

#searchBox .search-nav button {
    background: #f9fafb;
    border: none;
    padding: 0.25rem 0.35rem;
    cursor: pointer;
    color: #6b7280;
    display: flex;
}
#searchBox .search-nav button:hover {
    background: #f3f4f6;
}
#searchBox .search-nav button:nth-of-type(2) {
     border-right: 1px solid #d1d5db;
}

.search-options-wrapper {
    position: relative;
    flex-shrink: 0; /* <-- ADD THIS LINE */
}
.search-options-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-options-btn:hover {
    background-color: #f3f4f6;
}

#searchOptionsMenu {
    right: 0;
    left: auto;
    width: max-content;
}

.search-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.search-option:hover {
    background-color: #f3f4f6;
}

#replaceAllBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
#replaceAllBtn:hover {
    background: #2563eb;
}
/* Fix for sticky header & removed overflow:hidden */
.transcribe-ai-viewer .viewer-header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.transcribe-ai-viewer #transcript-area-container {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

