/* --- General Setup & Variables --- */
:root {
    --primary-blue: #00334E;
    --accent-blue: #88C4D8;
    --accent-blue-hover: #7ab8cf;
    --light-gray-bg: #F8F9FA;
    --white: #FFFFFF;
    --border-color: #DEE2E6;
    --text-dark: #212529;
    --text-light: #6C757D;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 8px;
    --selection-bg: #eef7fb;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-gray-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* --- Loader & Progress Bar --- */
#loader {
    display: none;
    padding: 2rem;
    text-align: center;
}

/* Add these new styles for the progress bar */
.progress-bar-container {
    width: 80%;
    max-width: 400px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin: 1rem auto 0.5rem;
    overflow: hidden;
    display: none;
    /* Hidden by default */
}

.progress-bar {
    width: 0%;
    height: 10px;
    background-color: var(--primary-blue);
    border-radius: 4px;
    transition: width 0.3s ease-in-out;
}

.progress-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    height: 1.2rem;
    display: none;
    /* Hidden by default */
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-blue);
    animation: spin 1s ease infinite;
    margin: 0 auto 1rem;
}

/* --- Header & Main Content --- */
.header {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
}

.header-logo {
    font-weight: bold;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
}

.header-logo span {
    background-color: var(--white);
    color: var(--primary-blue);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.main-container {
    padding: 2rem;
    margin: 0 auto;
}

.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

h1,
h2 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

input[type="text"],
select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(136, 196, 216, 0.3);
}

textarea {
    width: 100%;
    height: 300px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(136, 196, 216, 0.3);
}

select {
    background-color: var(--white);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236C757D%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.3-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right .7em top 50%;
    background-size: .65em auto;
}

select:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
}

.card.disabled {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* --- Form Layout Styles --- */
.project-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
}

.checkbox-container label {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dark);
}

input[type="checkbox"] {
    width: 1.25em;
    height: 1.25em;
    margin-right: 0.5rem;
    accent-color: var(--primary-blue);
    flex-shrink: 0;
}

.language-detector {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    height: 1.2rem;
    transition: opacity 0.3s;
    opacity: 0;
}

#detected-language {
    font-weight: 600;
    color: var(--primary-blue);
}

.advanced-settings-column {
    border-left: 1px solid var(--border-color);
    padding-left: 2rem;
}

.advanced-settings-toggle {
    margin-bottom: 0.5rem;
}

#toggle-advanced-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 0.2s;
}

#toggle-advanced-btn:hover {
    color: var(--accent-blue);
}

.advanced-settings {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.advanced-settings.open {
    max-height: 500px;
}

.button-container {
    text-align: right;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

button {
    background-color: var(--accent-blue);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: var(--accent-blue-hover);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- Loader & Progress Bar --- */
#loader {
    display: none;
    padding: 2rem;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-blue);
    animation: spin 1s ease infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- Summary Container --- */
.summary-container {
    display: none;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-blue);
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s;
}

.summary-container h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.summary-container p {
    margin: 0;
    line-height: 1.7;
}

.summary-loading,
.summary-error {
    color: var(--text-light);
    font-style: italic;
}

/* --- Results --- */
.results-controls {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    gap: 1.5rem;
    flex-wrap: wrap;
}

.select-all-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.select-all-container label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-dark);
}

.export-controls-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#selection-counter {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.export-button {
    background-color: var(--primary-blue);
    color: white;
    padding: 0.5rem 1rem;
}

.export-button:hover {
    background-color: #004a70;
}

.export-button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

.analytics-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-grow: 1;
    justify-content: center;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-item span {
    color: var(--text-light);
}

.stat-item strong {
    color: var(--primary-blue);
    font-size: 1rem;
}

#list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

#list li {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
    background-color: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

#list li.selected {
    border-color: var(--primary-blue);
    background-color: var(--selection-bg);
    box-shadow: 0 0 0 2px var(--primary-blue);
}

.video-placeholder {
    position: relative;
    width: 100%;
    height: 220px;
    background-color: #000;
    cursor: pointer;
    overflow: hidden;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-placeholder:hover img {
    transform: scale(1.05);
}

.play-icon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: background-color 0.3s ease;
}

.video-placeholder:hover .play-icon-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

.play-icon-overlay svg {
    width: 60px;
    height: 60px;
    color: rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.video-placeholder:hover .play-icon-overlay svg {
    transform: scale(1.1);
}

.video-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 220px;
    background-color: #2d3436;
    color: #b2bec3;
}

.video-unavailable svg {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
}

.video-unavailable span {
    font-size: 0.9rem;
    font-weight: 500;
}

.result-video {
    width: 100%;
    display: block;
    height: 220px;
    background-color: #000;
}

.result-content {
    padding: 1rem 1.25rem 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.text-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.text-container em {
    flex-grow: 1;
    font-style: normal;
    color: var(--text-dark);
}

.original-text-tooltip {
    flex-shrink: 0;
    color: var(--text-light);
    cursor: help;
}

.original-text-tooltip svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    opacity: 0.7;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.timestamp {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timestamp svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

/* Add these new styles for the card action buttons */
.card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    background: none;
}

.card-action-btn svg {
    width: 16px;
    height: 16px;
}

/* Edit Clip Button Style */
.edit-clip-btn {
    background: #fff3dc;
    color: var(--text-light);
}

.edit-clip-btn:hover {
    background-color: var(--light-gray-bg);
    color: var(--text-dark);
}

/* Include/Exclude Button Style */
.toggle-export-btn {
    color: #166534;
    /* Dark Green */
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.toggle-export-btn:hover {
    background-color: #dcfce7;
}

/* --- Logic for showing/hiding button content --- */
.toggle-export-btn .exclude-content {
    display: none;
}

li.selected .toggle-export-btn .include-content {
    display: none;
}

li.selected .toggle-export-btn .exclude-content {
    display: inline-flex;
    /* Use flex to keep alignment */
    align-items: center;
    gap: 0.5rem;
}

/* Style for the button when selected */
li.selected .toggle-export-btn {
    color: #991b1b;
    /* Dark Red */
    background-color: #fef2f2;
    border-color: #fecaca;
}

li.selected .toggle-export-btn:hover {
    background-color: #fee2e2;
}

.no-results {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    grid-column: 1 / -1;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Pagination Styles --- */
.pagination-container {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    gap: 0.5rem;
}

.pagination-container button {
    background-color: var(--white);
    color: var(--primary-blue);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.pagination-container button:hover:not(:disabled) {
    background-color: var(--selection-bg);
    border-color: var(--accent-blue);
}

.pagination-container button:active:not(:disabled) {
    transform: scale(0.97);
}

.pagination-container button.active {
    background-color: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
    cursor: default;
}

.pagination-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    width: 90%;
    max-width: 960px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    overflow: auto;
    flex-grow: 1;
}

#order-modal-body {
    grid-template-columns: 1fr;
}

.modal-video-column,
.modal-transcript-column {
    display: flex;
    flex-direction: column;
}

.modal-video-column video {
    max-width: 100%;
    border-radius: 6px;
    background: #000;
}

.timeline-container {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light-gray-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.timeline-duration {
    color: var(--text-light);
    font-weight: 500;
}

.timeline-track {
    position: relative;
    width: 100%;
    height: 40px;
    background: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.timeline-selected {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--accent-blue);
    opacity: 0.6;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 1;
}

.timeline-playhead {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--primary-blue);
    z-index: 3;
    pointer-events: none;
    transition: left 0.1s linear;
}

.timeline-chunks {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 0.5rem;
    min-height: 20px;
}

.timeline-chunk {
    height: 8px;
    background: #b0b0b0;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.timeline-chunk:hover {
    background: #888;
}

.timeline-chunk.selected {
    background: var(--accent-blue);
}

.timeline-chunk.active {
    background: var(--primary-blue);
    box-shadow: 0 0 4px rgba(0, 51, 78, 0.5);
}

.modal-duration-container {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.modal-transcript-column {
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.transcript-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--light-gray-bg);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.transcript-hint {
    font-size: 0.85rem;
    color: var(--text-dark);
    font-style: normal;
    line-height: 1.5;
    padding: 0.5rem;
    background: rgba(136, 196, 216, 0.1);
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
}

.transcript-hint strong {
    color: var(--primary-blue);
    font-weight: 600;
}

.transcript-paragraph {
    flex: 1;
    padding: 1rem;
    line-height: 2.4;
    font-size: 1rem;
    color: var(--text-dark);
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    white-space: normal;
    word-wrap: break-word;
}

.transcript-paragraph .word {
    display: inline;
    padding: 2px 4px;
    margin: 0 2px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}

.transcript-paragraph .word:hover {
    background: rgba(0, 51, 78, 0.1);
}

.transcript-paragraph .word.selected {
    background: var(--accent-blue) !important;
    color: white !important;
    font-weight: 500;
}

.transcript-paragraph .word.selected::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-blue);
}

.transcript-paragraph .word.editable-word {
    outline: none;
    min-width: 20px;
    display: inline-block;
}

.transcript-paragraph .word.editable-word:focus {
    background: rgba(0, 123, 255, 0.2) !important;
    border: 1px solid rgba(0, 123, 255, 0.5);
    border-radius: 3px;
    padding: 1px 3px;
}

.transcript-paragraph .word.editable-word.edited {
    background: rgba(255, 193, 7, 0.2) !important;
    border-bottom: 2px solid rgba(255, 193, 7, 0.8);
}

.transcript-paragraph .word.editable-word.edited.selected {
    background: var(--accent-blue) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.8);
}

.transcript-paragraph .word.editable-word.edited:hover::before {
    content: 'Edited - Double-click to edit again';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 4px;
}

#modal-transcript-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#modal-transcript-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 4px;
    position: relative;
    transition: background 0.2s ease;
}

#modal-transcript-list li:hover {
    background-color: var(--light-gray-bg);
}

#modal-transcript-list input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 4px;
}

#modal-transcript-list label {
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-dark);
}

.chunk-time {
    color: var(--text-light);
    font-family: monospace, sans-serif;
    margin-right: 0.5em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.modal-save-btn {
    background-color: var(--primary-blue);
    color: white;
    padding: 0.6rem 1.5rem;
}

.modal-save-btn:hover {
    background-color: #004a70;
}

/* Styles for new Export Modal */
.export-modal-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    overflow-y: auto;
}

.export-option-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background-color: #f9f9f9;
    transition: background-color 0.2s;
    color: black;
}

.export-option-btn:hover:not(:disabled) {
    background-color: #f0f0f0;
}

.export-option-btn:disabled {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}

.export-description {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0 0 0.5rem;
}

.modal-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    display: none;
    /* Initially hidden */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px;
}

.modal-loader-overlay.visible {
    display: flex;
}

#export-single-video-btn {
    margin-top: 20px;
}

/* Styles for Music Controls in Export Modal */
.export-group-box {
    border: 1px solid #e0e0e0;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.music-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #ccc;
    transition: opacity 0.3s;
}

.music-controls.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.file-input-label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
}

#music-file-input {
    display: none;
}

#music-file-name {
    font-style: italic;
    color: #555;
    margin-left: 10px;
}

.remove-btn {
    background: #fdecec;
    color: #c53030;
    border: 1px solid #f9bdbb;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 22px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-left: 5px;
    visibility: hidden;
    /* Hide by default */
}

.remove-btn.visible {
    visibility: visible;
}

#volume-slider {
    width: 100%;
}

.preview-btn {
    font-size: 0.9rem;
    padding: 6px 12px;
    background-color: #4595ff;
    border-radius: 5px;
    margin-top: 0.5rem;
    border: 1px solid #cbd5e0;
}

.preview-btn:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Styles for new Logo Controls in Export Modal */
.logo-controls {
    margin-top: 1rem;
}

.logo-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1rem;
}

/* The 3x3 Position Grid */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 90px;
    height: 90px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.position-grid input[type="radio"] {
    display: none;
    /* Hide the actual radio buttons */
}

.position-grid label {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: #f0f0f0;
    transition: background-color 0.2s;
}

.position-grid label:hover {
    background-color: #e0e0e0;
}

/* Style for the selected position */
.position-grid input[type="radio"]:checked+label {
    background-color: #3b82f6;
    box-shadow: inset 0 0 0 2px white;
}

#logo-file-input {
    display: none;
}

#logo-file-name {
    font-style: italic;
    color: #555;
    margin: 0 10px;
}

/* --- Styles for Reel Order Modal --- */
/* --- Styles for Reel Order Modal (ENHANCED v2) --- */
#reel-order-btn {
    background-color: #4a5568;
}

#reel-order-btn:hover:not(:disabled) {
    background-color: #2d3748;
}

/* 1. Make the modal wider to accommodate the grid */
#order-modal .modal-content {
    max-width: 100%;
    max-height: 95vh;
    height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#order-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-description {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
    /* Center the helper text */
}

.order-list {
    list-style: none;
    padding: 1rem;
    margin: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background-color: var(--light-gray-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;

    /* Grid layout - more cards per row with smaller cards */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    row-gap: 1rem;
}

/* 2. Enhanced Card Styling - Smaller cards */
.order-list li {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 6px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    transition: all 0.2s ease;
    min-height: 160px;
    max-height: 180px;
    height: auto;
    cursor: grab;
    user-select: none;
}

.order-list li:active {
    cursor: grabbing;
}

.order-list li:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.order-empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.order-empty-message p {
    margin: 0;
    font-size: 1rem;
}

/* Drag handle */
.order-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.2rem 0;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    cursor: grab;
    flex-shrink: 0;
    pointer-events: none; /* Allow drag to work through handle */
}

.order-drag-handle svg {
    pointer-events: none;
}

.order-drag-handle:active {
    cursor: grabbing;
}

.order-position-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-blue);
    background: rgba(136, 196, 216, 0.15);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
}

.order-list-thumbnail {
    width: 100%;
    max-height: 90px !important;
    height: 90px !important;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    border: 1px solid var(--border-color);
}

.order-list-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    overflow: hidden;
    margin-bottom: 0.3rem;
    min-height: 0;
}

.order-list-text {
    font-size: 0.65rem;
    color: var(--text-dark);
    line-height: 1.2;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.order-list-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.order-list-duration {
    font-size: 0.7rem;
    color: var(--text-light);
    background: rgba(136, 196, 216, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.order-list-remove-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    width: 100%;
    height: 24px;
    margin-top: auto;
    font-size: 0.65rem;
    pointer-events: auto; /* Ensure remove button is clickable */
    z-index: 10;
    position: relative;
}

.order-list-remove-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    transform: scale(1.05);
}

.order-list-remove-btn:active {
    transform: scale(0.95);
}

/* Drag and drop visual feedback */
.order-list li.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing !important;
}

.order-list li.drag-over-top {
    border-top: 3px solid var(--accent-blue);
}

.order-list li.drag-over-bottom {
    border-bottom: 3px solid var(--accent-blue);
}

/* Responsive design for order list - smaller cards */
@media (max-width: 1600px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 1200px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: 0.75rem;
    }

    .order-list li {
        min-height: 180px;
        padding: 0.4rem;
    }
    
    .order-list-thumbnail {
        max-height: 100px !important;
        height: 100px !important;
    }

    .order-list-thumbnail {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

.stop-button {
    background-color: #c0392b;
    /* A distinct red color */
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 0.5rem;
}

.stop-button:hover {
    background-color: #e74c3c;
}

.search-etr-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-blue);
    padding: 0.5rem 1rem;
    background: rgba(136, 196, 216, 0.15);
    border-radius: 6px;
    border: 2px solid var(--accent-blue);
    white-space: nowrap;
    display: none;
}

.stop-button-loader {
    margin-top: 1.5rem;
    background-color: #c0392b;
    /* Red */
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.stop-button-loader:hover {
    background-color: #e74c3c;
}

.stop-button-loader:active {
    transform: scale(0.98);
}

/* 
  This class will be added to the form via JS 
  to control which buttons are visible.
*/
#search-form.is-searching #search-button,
#search-form.is-searching #tutorial-btn {
    display: none;
}

#search-button {
    display: flex;
    align-items: center;
    width: 205px;
    justify-content: center;
    gap: 10px;

}

#search-form.is-searching #stop-search-button {
    display: inline-flex;
    /* Use inline-flex to show it */
}

/* --- 4. Improved Drag & Drop Visuals --- */

/* Drag and drop visual feedback */
.order-list li.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-blue) !important;
}

.order-list li.drag-over-top {
    border-top: 3px solid var(--accent-blue);
    padding-top: 0.75rem;
}

.order-list li.drag-over-bottom {
    border-bottom: 3px solid var(--accent-blue);
    padding-bottom: 0.75rem;
}

/* Add these new styles for Intro/Outro controls */
.intro-outro-controls {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-upload-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-upload-group label {
    flex-shrink: 0;
    margin-bottom: 0;
    width: 80px;
    /* Align the buttons */
}

.file-upload-group input[type="file"] {
    display: none;
}

.file-upload-group .export-option-btn.small-btn {
    width: auto;
    /* Allow button to size to content */
    padding: 6px 12px;
    font-size: 0.9rem;
    flex-grow: 0;
}

.file-upload-group span {
    font-style: italic;
    color: #555;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .form-layout-grid {
        grid-template-columns: 1fr;
    }

    .advanced-settings-column {
        border-left: none;
        padding-left: 0;
        margin-top: 1rem;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
    }
}

@media (max-width: 992px) {
    #list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 820px) {
    .results-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-container {
        justify-content: space-around;
        padding: 0.5rem 0;
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        margin-top: 0.75rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 768px) {
    .project-selection-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    #list {
        grid-template-columns: 1fr;
    }
}

#modal-transcript-list .chunk-text[contenteditable="true"] {
    cursor: text;
    background-color: #f0f8ff;
    /* Light alice blue for edit mode */
    padding: 2px 4px;
    border-radius: 4px;
    outline: none;
    border: 1px solid transparent;
    transition: all 0.2s;
}

#modal-transcript-list .chunk-text[contenteditable="true"]:focus {
    background-color: #e6f3ff;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(136, 196, 216, 0.3);
}

/* ============================
   Reel Generator — Tutorial Guide Styles
   Scope: ONLY inside the tutorial modal
   ============================ */

#tutorial-modal .modal-content {
    /* subtle glassy card look */
    background: radial-gradient(1200px 600px at 10% -10%, rgba(0, 51, 78, 0.06), transparent 60%),
        radial-gradient(1000px 600px at 110% 110%, rgba(136, 196, 216, 0.10), transparent 60%),
        #ffffff;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

#tutorial-modal .modal-close-btn {
    border-radius: 10px;
}

#tutorial-modal .modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* --- Body layout & rhythm --- */
#tutorial-modal-body {
    padding: 1rem 0 .5rem;
    display: block;
    /* override grid from base modal */
    max-width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

.secondary-button {
    background-color: #56bfb4;
}

#tutorial-modal-body h3 {
    margin: .25rem 0 1rem;
    font-size: 1.25rem;
    letter-spacing: .2px;
    color: #0b2a3d;
    position: relative;
}

#tutorial-modal-body h3::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin-top: .35rem;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-blue), transparent);
}

#tutorial-modal-body p {
    margin: .25rem 0 .9rem;
    color: var(--text-dark);
}

/* --- Links & emphasis --- */
#tutorial-modal-body a {
    color: var(--primary-blue);
    text-underline-offset: 3px;
}

#tutorial-modal-body strong {
    color: #0b2a3d;
}

/* --- Code & kbd --- */
#tutorial-modal-body code {
    background: #f3f7fa;
    color: #0b2a3d;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #e6eef3;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .9em;
}

#tutorial-modal-body kbd {
    background: #1f2937;
    color: #fff;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    font-size: .85em;
}

/* --- Ordered steps (Quick Start) --- */
#tutorial-modal-body ol {
    counter-reset: step;
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

#tutorial-modal-body ol>li {
    counter-increment: step;
    position: relative;
    background: #ffffff;
    border: 1px solid #e9eef2;
    border-radius: 10px;
    padding: .85rem .95rem .85rem 3.25rem;
    margin: .6rem 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

#tutorial-modal-body ol>li::before {
    content: counter(step);
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-weight: 700;
    color: #083044;
    border-radius: 50%;
    background: conic-gradient(from 180deg, var(--accent-blue) 0 75%, #cfe7f1 75% 100%);
    box-shadow: 0 0 0 4px #eef6f9;
}

#tutorial-modal-body ol>li:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border-color: #dbe7ee;
}

/* --- Example list --- */
#tutorial-modal-body ul {
    margin: .25rem 0 1.1rem;
    padding-left: 1.1rem;
}

#tutorial-modal-body ul>li {
    margin: .35rem 0;
}

#tutorial-modal-body ul>li::marker {
    color: var(--accent-blue);
}

/* --- Definition list (settings) --- */
#tutorial-modal-body dl {
    margin: 1.1rem 0 1.2rem;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: .35rem 1.1rem;
    align-items: start;
}

#tutorial-modal-body dt {
    font-weight: 700;
    color: #0f344a;
}

#tutorial-modal-body dd {
    margin: 0 0 .65rem;
    color: var(--text-dark);
    background: #fbfdff;
    border: 1px dashed #dfe9f0;
    border-radius: 8px;
    padding: .65rem .75rem;
}

/* --- Callouts (optional utility classes you can use in the guide) --- */
#tutorial-modal-body .callout {
    border-radius: 12px;
    padding: .9rem 1rem;
    margin: 1rem 0;
    border: 1px solid transparent;
}

#tutorial-modal-body .callout.info {
    background: linear-gradient(0deg, #f3fbff, #f9fdff);
    border-color: #d6eef7;
}

#tutorial-modal-body .callout.success {
    background: #f4fbf6;
    border-color: #cfeedd;
}

#tutorial-modal-body .callout.warn {
    background: #fff8f2;
    border-color: #ffe1c7;
}

#tutorial-modal-body .callout strong {
    color: #0b2a3d;
}

/* --- Badges/Pills (optional) --- */
#tutorial-modal-body .pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .2px;
    background: #eef7fb;
    color: #0b2a3d;
    border: 1px solid #d7e8f0;
}

/* --- Subtle fade-in animation --- */
#tutorial-modal-body>* {
    animation: guideFade .35s ease forwards;
    opacity: 0;
    transform: translateY(4px);
}

#tutorial-modal-body>*:nth-child(1) {
    animation-delay: .02s;
}

#tutorial-modal-body>*:nth-child(2) {
    animation-delay: .05s;
}

#tutorial-modal-body>*:nth-child(3) {
    animation-delay: .08s;
}

#tutorial-modal-body>*:nth-child(4) {
    animation-delay: .11s;
}

@keyframes guideFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    background-color: #fffbeb;
    /* Light yellow */
    color: #92400e;
    /* Dark yellow/brown text */
    border: 1px solid #fde68a;
    /* Yellow border */
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
}

.export-warning.visible {
    opacity: 1;
    max-height: 100px;
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.export-warning svg {
    flex-shrink: 0;
}

/* --- Toast Notification Styles --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background-color: #2d3748;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    transition: transform 0.4s ease-in-out;
    opacity: 0;
    font-size: 0.9rem;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    flex-shrink: 0;
}

/* --- Logo Preview Styles --- */
.logo-preview-container {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-gray-bg);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    display: none;
}

.logo-preview-container.visible {
    opacity: 1;
    display: flex;
    transform: scale(1);
}

#logo-preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* --- Styles for Reel Order Modal --- */
#reel-order-btn {
    background-color: #4a5568;
}

#reel-order-btn:hover:not(:disabled) {
    background-color: #2d3748;
}

/* Duplicate removed - using main order-list styles above */

/* Style for each grid item */
.order-list li {
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: grab;
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Maintain a consistent shape */
    overflow: hidden;
    min-height: 270px;
}

.order-list li:active {
    cursor: grabbing;
}

.order-list-thumbnail {
    width: 100%;
    height: 55%;
    /* Thumbnail takes up the top portion */
    object-fit: cover;
    pointer-events: none;
    /* Prevent image from being dragged instead of li */
    border-bottom: 1px solid var(--border-color);
}

.order-list-item-content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.order-list-text {
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Show max 2 lines of text */
    -webkit-box-orient: vertical;
    pointer-events: none;
    margin-bottom: 0.5rem;
}

.order-list-actions {
    margin-top: auto;
    /* Push actions to the bottom */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-list-remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    /* border-radius: 50%; */
    display: flex;
    transition: background-color 0.2s, color 0.2s;
}

.order-list-remove-btn:hover {
    background-color: #fef2f2;
    color: #ef4444;
}

/* Responsive design for order list - maintain 7-8 cards per row */
@media (max-width: 1600px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    }
}

@media (max-width: 1200px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

@media (max-width: 768px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: 1rem;
    }

    .order-list li {
        min-height: 260px;
        padding: 0.5rem;
    }

    .order-list-thumbnail {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .order-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* --- Drag & Drop Styles for GRID --- */

/* Style for the item being dragged */
.order-list li.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* A placeholder element to show where the item will drop */
.drag-placeholder {
    background-color: rgba(136, 196, 216, 0.2);
    border: 2px dashed var(--accent-blue);
    border-radius: 8px;
    min-height: 100px;
    /* Ensure it's visible */
}

/* --- NEW Export Modal Styles (v2) --- */
.export-modal-body {
    display: block;
    /* Override grid from base modal */
    overflow-y: auto;
    padding: 1.5rem;
}

#export-modal .modal-content {
    max-width: 1000px;
    /* Wider modal */
}

.export-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* --- Column 1: Main Actions --- */
.export-main-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.export-action-card {
    background-color: var(--light-gray-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s ease-in-out;
}

.export-action-card .card-icon {
    width: 48px;
    height: 48px;
    background-color: var(--accent-blue);
    color: var(--primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.export-action-card .card-icon svg {
    width: 28px;
    height: 28px;
}

.export-action-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-blue);
}

.export-action-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    flex-grow: 1;
    margin: 0.5rem 0 1.5rem 0;
}

.primary-export-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    background-color: var(--primary-blue);
    color: var(--white);
}

.primary-export-btn:hover:not(:disabled) {
    background-color: #004a70;
}

.primary-export-btn:disabled {
    background-color: #a0a0a0;
}

.merge-toggle {
    cursor: pointer;
}

.merge-toggle h3 {
    margin: 0;
    font-size: 1.2rem;
}

/* --- Column 2: Enhancements --- */
.export-enhancements {
    border-left: 1px solid var(--border-color);
    padding-left: 2rem;
}

.export-enhancements h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--primary-blue);
}

/* Add these new Accordion styles */
.enhancement-accordion {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    background-color: #fff;
}

.enhancement-accordion summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    /* Remove default marker */
    color: var(--text-dark);
}

.enhancement-accordion summary::-webkit-details-marker {
    display: none;
    /* Hide for Safari */
}

.enhancement-accordion summary:hover {
    background-color: var(--light-gray-bg);
}

.enhancement-accordion summary svg {
    width: 20px;
    height: 20px;
    color: var(--primary-blue);
    transition: transform 0.2s;
}

.enhancement-accordion[open]>summary svg {
    transform: rotate(45deg);
}

.accordion-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid var(--border-color);
}

.accordion-content .form-group {
    margin-top: 1rem;
}

.accordion-content .export-option-btn {
    width: 100px;
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Add these styles for the final subtitle checkbox */
.enhancement-final-touch {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.enhancement-final-touch strong {
    color: var(--primary-blue);
}

/* in style.css */

/* --- Style for the "Browse Library" Button --- */
.music-upload-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0.5rem;
}

#music-upload-btn {
    width: 100%;
}

.secondary-export-btn {
    background-color: #eef7fb;
    color: var(--primary-blue);
    border: 1px solid var(--accent-blue);
    font-weight: 600;
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
}

.secondary-export-btn:hover {
    background-color: #e1f1f9;
    border-color: var(--primary-blue);
}


/* --- Modern Tunes Library Modal Styles --- */
.tunes-modal-content {
    max-width: 650px;
    /* A bit wider */
}

#tunes-modal-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    max-height: 65vh;
}

#tunes-now-playing {
    padding: 0.5rem 1.5rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.9rem;
    background-color: var(--light-gray-bg);
}

#tunes-now-playing span {
    font-weight: 600;
    color: var(--primary-blue);
}

.tunes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.tunes-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease, border-left-color 0.3s ease;
    border-left: 4px solid transparent;
}

.tunes-list li:hover {
    background-color: var(--light-gray-bg);
}

.tunes-list li.is-playing {
    background-color: #eef7fb;
    border-left-color: var(--primary-blue);
}

.tune-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-gray-bg);
    color: var(--primary-blue);
    border: 1px solid var(--border-color);
    transition: background-color 0.2s, box-shadow 0.2s;
}

.tune-play-btn:hover {
    background-color: #e6e6e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tune-play-btn .icon-pause {
    display: none;
}

li.is-playing .tune-play-btn .icon-pause {
    display: block;
}

li.is-playing .tune-play-btn .icon-play {
    display: none;
}

.tune-info h4 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
}

.tune-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-light);
}

.tune-select-btn {
    padding: 8px 20px;
    font-size: 0.9rem;
    background-color: var(--primary-blue);
}

.tune-select-btn:disabled {
    background-color: var(--accent-blue);
    cursor: wait;
}

.tunes-loader,
.tunes-error {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1rem;
}

.tunes-error {
    color: #c0392b;
}

.tune-play-btn {
    /* make sure the icon has a visible color */
    color: #111;
    /* change as needed */
    background: #f3f4f6;
    /* light gray */
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* show play by default, hide pause */
.tune-play-btn .icon-pause {
    display: none;
}

.tune-play-btn .icon-play {
    display: inline;
}

/* when playing, swap visibility */
.tune-play-btn.is-playing .icon-pause {
    display: inline;
}

.tune-play-btn.is-playing .icon-play {
    display: none;
}

/* --- Preview Reel Button Styles --- */
.export-preview-section {
    text-align: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-color);
}

#preview-reel-btn {
    width: auto;
    padding: 10px 24px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

#preview-reel-btn:disabled {
    background-color: #d1d5db;
    border-color: #9ca3af;
    cursor: not-allowed;
}

/* --- Preview Modal Styles --- */
#preview-modal .modal-content {
    max-width: 800px;
    /* A good size for a video player */
}

#preview-modal-body {
    display: flex;
    /* Override grid */
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.preview-loader-container {
    text-align: center;
    color: var(--text-light);
}

#preview-video-player {
    max-width: 400px;
}