/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #3498db;
}

/* Main Layout */
.main {
    padding: 2rem 0;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Section Styles */
.video-section,
.lyrics-section,
.style-section,
.generation-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.subsection-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #34495e;
}

/* Video Player Styles */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

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

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    transition: opacity 0.3s ease;
}

.video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.upload-prompt {
    text-align: center;
}

.upload-icon {
    margin-bottom: 1rem;
    color: #3498db;
}

/* Video Controls */
.video-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-mode-selector {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.upload-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.dual-upload {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    width: 100%;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 250px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #3498db;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.upload-btn:hover {
    background-color: #2980b9;
}

.file-input {
    display: none;
}

.file-name {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.audio-replacement-section {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.audio-replacement-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #34495e;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
}

.replacement-audio-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.upload-btn.secondary {
    background-color: #95a5a6;
}

.upload-btn.secondary:hover {
    background-color: #7f8c8d;
}

.custom-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-btn {
    background: #34495e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover:not(:disabled) {
    background-color: #2c3e50;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.time-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: #34495e;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 80px;
}

/* Lyrics Editor Styles */
.lyrics-editor {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-label {
    display: block;
    font-weight: 500;
    color: #34495e;
}

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

.action-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #34495e;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
}

.action-btn span {
    font-size: 1rem;
}

.export-btn:hover {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #4caf50;
}

.import-btn:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #2196f3;
}

.lyrics-textarea {
    width: 100%;
    min-height: 150px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.lyrics-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.lyrics-preview {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
}

.lyrics-line {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
    position: relative;
}

.lyrics-line:last-child {
    border-bottom: none;
}

.lyrics-line.current {
    background-color: #e3f2fd;
    font-weight: 500;
    border-left: 4px solid #3498db;
    padding-left: 0.5rem;
}

.lyrics-line.highlighted {
    background-color: #3498db;
    color: white;
}

.lyrics-line.has-timestamp {
    background-color: #f0f9ff;
    border-left: 4px solid #27ae60;
}

.lyrics-line.has-timestamp .line-timestamp {
    color: #27ae60;
    font-weight: 600;
}

.lyrics-line.timestamp-recording {
    animation: timestampRecording 0.5s ease-out;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.lyrics-line.timestamp-recorded {
    animation: timestampRecorded 1s ease-out;
    background-color: #d4edda;
    border-left: 4px solid #28a745;
}

.lyrics-line.timestamp-undo {
    animation: timestampUndo 1s ease-out;
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
}

@keyframes timestampRecording {
    0% {
        background-color: #e3f2fd;
        transform: scale(1);
    }
    50% {
        background-color: #fff3cd;
        transform: scale(1.02);
    }
    100% {
        background-color: #fff3cd;
        transform: scale(1);
    }
}

@keyframes timestampRecorded {
    0% {
        background-color: #fff3cd;
        transform: scale(1);
    }
    50% {
        background-color: #d4edda;
        transform: scale(1.02);
    }
    100% {
        background-color: #f0f9ff;
        transform: scale(1);
    }
}

@keyframes timestampUndo {
    0% {
        background-color: #f0f9ff;
        transform: scale(1);
    }
    25% {
        background-color: #f8d7da;
        transform: scale(1.02);
    }
    50% {
        background-color: #f8d7da;
        transform: translateX(-5px);
    }
    75% {
        background-color: #f8d7da;
        transform: translateX(3px);
    }
    100% {
        background-color: #f8f9fa;
        transform: translateX(0);
    }
}

/* Keyboard Hints */
.keyboard-hints {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.hint {
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

kbd {
    background-color: #e9ecef;
    border: 1px solid #adb5bd;
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: #495057;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* Timestamp Controls */
.timestamp-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timestamp-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    align-items: center;
}

.timestamp-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: #e9ecef;
    color: #6c757d;
    transition: all 0.3s ease;
}

.timestamp-status.recording {
    background-color: #fff3cd;
    color: #856404;
    animation: pulse 1s infinite;
}

.timestamp-status.recorded {
    background-color: #d4edda;
    color: #155724;
}

.timestamp-status.undo-success {
    background-color: #d1ecf1;
    color: #0c5460;
}

.timestamp-status.undo-error {
    background-color: #f8d7da;
    color: #721c24;
}

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

.timestamp-btn,
.undo-btn {
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timestamp-btn:hover:not(:disabled) {
    background-color: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.undo-btn {
    background-color: #e74c3c;
    position: relative;
    overflow: hidden;
}

.undo-btn:hover:not(:disabled) {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.undo-btn.undo-active {
    animation: undoButtonPulse 0.5s ease-out;
}

@keyframes undoButtonPulse {
    0% {
        transform: scale(1);
        background-color: #e74c3c;
    }
    50% {
        transform: scale(1.05);
        background-color: #c0392b;
    }
    100% {
        transform: scale(1);
        background-color: #e74c3c;
    }
}

.timestamp-btn:disabled,
.undo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.1rem;
}

.timestamp-btn.recording {
    background-color: #ffc107;
    animation: buttonPulse 0.5s ease-out;
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Subtitle Download Section */
.subtitle-download-section {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.download-subtitle-btn {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.download-subtitle-btn:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.download-subtitle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Style Configuration */
.style-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.style-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-family: inherit;
}

.custom-styles {
    display: none; /* Hidden by default when "default" preset is selected */
    flex-direction: column;
    gap: 1rem;
}

.visualization-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.style-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.style-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.control-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.control-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Font family select - larger for better preview */
#fontFamily {
    font-size: 1rem;
    padding: 0.6rem;
    min-height: 40px;
}

#fontFamily option {
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* Color input wrapper and preview */
.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-input {
    width: 60px;
    height: 40px;
    padding: 0.25rem;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.color-input:hover {
    border-color: #3498db;
}

.color-preview {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.style-preview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.preview-background-toggle {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    transition: color 0.2s;
}

.radio-label:hover {
    color: #3498db;
}

.radio-label input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.radio-label span {
    user-select: none;
}

.style-preview-box {
    padding: 0;
    border-radius: 8px;
    border: 2px solid #ddd;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

/* White background (default) */
.style-preview-box[data-bg="white"] {
    background: #ffffff;
    border-color: #ddd;
}

/* Black background */
.style-preview-box[data-bg="black"] {
    background: #000000;
    border-color: #2c3e50;
}

/* Image preview styling */
.style-preview-box img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Loading state */
.preview-loading {
    font-size: 1rem;
    color: #6c757d;
    margin: 0;
    padding: 2rem;
}

/* Generation Controls */
.generation-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.generation-status {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}

/* Live Queue Status Widget */
.live-queue-status {
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.queue-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.queue-widget .queue-icon {
    font-size: 1.5rem;
}

.queue-widget .queue-text {
    font-size: 0.95rem;
}

.queue-widget strong {
    font-weight: 600;
}

.queue-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #856404;
}

.queue-icon {
    font-size: 1.2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
    width: 0%;
}

.generation-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.generate-btn,
.download-btn {
    background-color: #9b59b6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.generate-btn:hover:not(:disabled) {
    background-color: #8e44ad;
}

.download-btn {
    background-color: #27ae60;
}

.download-btn:hover {
    background-color: #229954;
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Generation Progress Enhancements */
.generation-status.processing {
    color: #3498db;
    font-weight: 500;
}

.generation-status.completed {
    color: #27ae60;
    font-weight: 600;
}

.generation-status.error {
    color: #e74c3c;
    font-weight: 500;
}

.progress-info.enhanced {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-percentage {
    font-weight: 600;
    color: #2c3e50;
    min-width: 50px;
}

.progress-message {
    flex: 1;
    color: #7f8c8d;
}

/* Download Button Enhancements */
.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #95a5a6;
}

.download-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Job Status Indicator */
.job-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.job-status-indicator.processing {
    background-color: #f39c12;
    animation: pulse 1.5s infinite;
}

.job-status-indicator.completed {
    background-color: #27ae60;
}

.job-status-indicator.failed {
    background-color: #e74c3c;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav ul {
        gap: 1rem;
    }
    
    .upload-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .custom-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timestamp-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .status-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .style-controls {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .video-section,
    .lyrics-section,
    .style-section,
    .generation-section {
        padding: 1rem;
    }
    
    .generation-actions {
        flex-direction: column;
    }
    
    .generate-btn,
    .download-btn {
        width: 100%;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #4caf50;
    color: #2e7d32;
}

.notification-error {
    border-left: 4px solid #f44336;
    color: #c62828;
}

.notification-info {
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

/* Animation and Transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Focus and Accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideDown 0.3s ease;
}

/* Help Modal - Larger and Scrollable */
.help-modal-content {
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2.5rem;
}

.help-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h3 {
    color: #2c3e50;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.help-section p {
    margin-bottom: 0.75rem;
    color: #555;
    line-height: 1.7;
}

.help-section ul,
.help-section ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: #555;
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.help-section strong {
    color: #2c3e50;
    font-weight: 600;
}

.help-section em {
    color: #7f8c8d;
    font-style: italic;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 1rem;
    color: #555;
    line-height: 1.6;
}

.discord-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #5865F2 0%, #7289DA 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}

.discord-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Font Selector with Search */
.font-selector-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-search {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
}

.font-search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.font-list-container {
    width: 100%;
    min-height: 400px;
    max-height: 400px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.5rem;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.font-list-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0.25rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

.font-list-item:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.font-list-item.selected {
    border-color: #007bff;
    background-color: #e7f3ff;
}

.font-list-item img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 50px;
    object-fit: contain;
}

.font-list-item .font-name {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
    margin-top: 0.25rem;
    display: none; /* Hidden by default, shown for items without preview */
}

.font-list-item.no-preview .font-name {
    display: block;
    font-size: 1rem;
    color: #212529;
    padding: 0.5rem;
}

.font-count {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: right;
}

/* Font Preview Display */
.font-preview-display {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    display: none;
}

.font-preview-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.font-preview-image {
    display: block;
    max-width: 100%;
    height: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.25rem;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .video-section,
    .lyrics-section,
    .style-section,
    .generation-section {
        border: 2px solid #000;
    }
    
    .control-btn,
    .upload-btn,
    .timestamp-btn,
    .undo-btn,
    .generate-btn,
    .download-btn {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}