/* CSS Variables for theming */
:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #6B7280;
    --success-color: #22C55E;
    --warning-color: #FB923C;
    --error-color: #EF4444;
    --info-color: #818CF8;

    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --border-color: #475569;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "main sidebar";
    min-height: 100vh;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    grid-area: header;
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.description {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Status Bar */
.status-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.status-value {
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Mode Selection */
.mode-selection {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mode-selection h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.radio-group {
    display: flex;
    gap: 2rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked+.radio-custom {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* Model Selection */
.model-selection {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.model-selection:hover {
    box-shadow: var(--shadow-lg);
}

.model-selection h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-selection h3::before {
    content: '⚙️';
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: 0.025em;
}

/* Add a subtle icon to labels */
.form-group label::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.form-control {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.form-control:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Custom dropdown arrow for select elements */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

/* Dark theme dropdown arrow */
[data-theme="dark"] select.form-control {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23CBD5E1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Model Select Container */
.model-select-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.model-select-container .form-control {
    flex: 1;
}

.btn-download {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.btn-download:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-download i {
    font-size: 0.875rem;
}

/* Disabled state */
.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
}

/* Select option styling */
select.form-control option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
    font-weight: 500;
}

select.form-control option:disabled {
    color: var(--text-secondary);
    font-style: italic;
}

.compare-models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.model-checkbox:hover {
    background: var(--bg-tertiary);
}

.model-checkbox input[type="checkbox"] {
    margin: 0;
}

/* File Upload */
.file-upload-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.file-upload-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-formats {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 1rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    position: relative;
}

.file-details i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.file-meta {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.audio-preview {
    max-width: 300px;
}

.btn-remove-file {
    background: var(--error-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    margin-left: auto;
}

.btn-remove-file:hover {
    background: #DC2626;
    transform: scale(1.1);
}

.btn-remove-file:active {
    transform: scale(0.95);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4B5563;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Progress */
.progress-section {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.transcription-progress {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    opacity: 0.8;
}

.transcription-status {
    margin-top: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Results */
.results-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.results-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.result-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.result-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
}

.result-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.result-table th,
.result-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.result-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sidebar-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.dependency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.dependency-item:last-child {
    border-bottom: none;
}

.dependency-name {
    font-weight: 500;
    color: var(--text-primary);
}

.dependency-status {
    font-size: 0.875rem;
}

.status-ready {
    color: var(--success-color);
}

.status-missing {
    color: var(--error-color);
}



.model-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.model-card h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.model-card ul {
    list-style: none;
    padding: 0;
}

.model-card li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Recent Logs */
.recent-logs {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.75rem;
}

.log-entry {
    padding: 0.25rem;
    margin-bottom: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.log-entry.success {
    border-left: 3px solid var(--success-color);
}

.log-entry.error {
    border-left: 3px solid var(--error-color);
}

.log-entry.info {
    border-left: 3px solid var(--info-color);
}

.log-timestamp {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.log-message {
    color: var(--text-primary);
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notifications - Removed duplicate styles */

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main"
            "sidebar";
    }

    .sidebar {
        order: 3;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        gap: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 1rem;
    }

    .action-section {
        flex-direction: column;
    }

    .compare-models-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile dropdown adjustments */
    .form-control {
        padding: 1rem 3rem 1rem 1rem;
        font-size: 1.1rem;
    }

    select.form-control {
        background-size: 1.25rem;
        background-position: right 1rem center;
    }

    .model-selection {
        padding: 1.5rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }
}

/* Utility Classes */
.info-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.success-text {
    color: var(--success-color);
}

.error-text {
    color: var(--error-color);
}

.warning-text {
    color: var(--warning-color);
}

.hidden {
    display: none !important;
}

/* 
Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
}

.model-download-info {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.download-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.download-detail:last-child {
    margin-bottom: 0;
}

.download-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning-color);
    background-color: rgba(251, 146, 60, 0.1);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.download-progress-info {
    margin-bottom: 1.5rem;
}

/* Progress bar in modal */
.modal .progress-bar {
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.modal .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.modal .progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/*
 Model comparison cards */
.model-card-compare {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.model-card-compare:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.model-checkbox-label {
    display: block;
    padding: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.model-checkbox-label:hover {
    background-color: var(--bg-secondary);
}

.model-checkbox-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.model-checkbox-label input[type="checkbox"] {
    margin-right: 0.75rem;
    transform: scale(1.2);
}

.model-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.model-name {
    font-weight: 600;
    color: var(--text-primary);
}

.model-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.model-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.25rem;
}

.status-cached {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.status-downloading {
    background-color: rgba(129, 140, 248, 0.1);
    color: var(--info-color);
}

.status-not-cached {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Cached models list */
.cached-model-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
}

.cached-model-item:hover {
    background-color: var(--bg-tertiary);
}

.cached-model-info {
    flex: 1;
}

.cached-model-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.cached-model-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.delete-model-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.delete-model-btn:hover {
    background-color: #ef4444;
    color: white;
    transform: scale(1.1);
}

.delete-model-btn:active {
    transform: scale(0.95);
}

/* Delete confirmation modal */
.delete-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #fef3cd;
    border: 1px solid #fde68a;
    border-radius: 6px;
    margin-top: 1rem;
}

.delete-warning i {
    color: #d97706;
    margin-top: 0.125rem;
}

.delete-warning p {
    margin: 0;
    color: #92400e;
    font-size: 0.875rem;
}

/* Transcription History */
.transcription-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.history-filename {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.history-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-weight: 500;
}

.history-status.success {
    background-color: #10b981;
    color: white;
}

.history-status.error {
    background-color: #ef4444;
    color: white;
}

.history-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-model {
    font-weight: 500;
}

.history-duration {
    color: var(--text-tertiary);
}

.history-rtfx {
    color: var(--text-tertiary);
    font-size: 0.85em;
    font-weight: 500;
}

.stat.rtfx {
    background-color: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    cursor: help;
    transition: background-color 0.2s ease;
}

.stat.rtfx:hover {
    background-color: var(--primary-color);
}

/* RTFx performance indicators */
.stat.rtfx[title*="RTFx: 0."],
.stat.rtfx[title*="RTFx: 0,"] {
    background-color: #ef4444;
    /* Red for slow performance */
}

.stat.rtfx[title*="RTFx: 1."],
.stat.rtfx[title*="RTFx: 1,"] {
    background-color: #f59e0b;
    /* Orange for real-time */
}

.history-rtfx {
    color: var(--text-tertiary);
    font-size: 0.85em;
    font-weight: 500;
    cursor: help;
}

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

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    flex: 1;
}

/* History Modal */
.modal-large .modal-content {
    max-width: 900px;
    width: 90vw;
}

.history-content {
    max-height: 60vh;
    overflow-y: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.history-table th,
.history-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.history-table td {
    color: var(--text-secondary);
}

.history-table tr:hover {
    background-color: var(--bg-tertiary);
}

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

.history-table-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view {
    background-color: var(--primary-color);
    color: white;
}

.btn-view:hover {
    background-color: var(--primary-hover);
}

.btn-delete-small {
    background-color: #ef4444;
    color: white;
}

.btn-delete-small:hover {
    background-color: #dc2626;
}

/* Transcription Detail */
.transcription-detail-content {
    max-height: 60vh;
    overflow-y: auto;
}

.transcription-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 6px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-weight: 500;
    color: var(--text-primary);
}

.transcription-results {
    margin-top: 1rem;
}

.transcription-results h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    cursor: pointer;
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast i {
    font-size: 1.1rem;
}

.toast-success i {
    color: var(--success-color);
}

.toast-error i {
    color: var(--error-color);
}

.toast-warning i {
    color: var(--warning-color);
}

.toast-info i {
    color: var(--info-color);
}

/* Log items */
.log-item {
    padding: 0.5rem;
    border-radius: 4px;
    background-color: var(--bg-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.log-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.log-event {
    color: var(--text-primary);
    font-weight: 500;
    text-transform: capitalize;
}

/* Result cards */
.result-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.result-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.result-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.result-content {
    padding: 1rem;
}

.csv-table-container {
    overflow-x: auto;
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.csv-table th,
.csv-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.csv-table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.csv-table td {
    color: var(--text-primary);
}

.csv-table tr:hover {
    background-color: var(--bg-secondary);
}

.result-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--error-color);
    padding: 1rem;
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
}

.error-message {
    color: var(--error-color);
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        min-width: auto;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .result-stats {
        flex-direction: column;
        gap: 0.25rem;
    }

    .csv-table {
        font-size: 0.8rem;
    }

    .csv-table th,
    .csv-table td {
        padding: 0.25rem;
    }
}

/* RTFx
 Explanation Styles */
.rtfx-explanation {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

.rtfx-definition {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.rtfx-examples {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.rtfx-example {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.rtfx-value {
    font-weight: 700;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 3rem;
    text-align: center;
    color: white;
}

.rtfx-value.excellent {
    background: var(--success-color);
}

.rtfx-value.good {
    background: var(--info-color);
}

.rtfx-value.slow {
    background: var(--warning-color);
}

.rtfx-desc {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.rtfx-desc small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.rtfx-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border-left: 3px solid var(--info-color);
}

.rtfx-note i {
    color: var(--info-color);
}

/* Collapsible Sidebar Styles */ 

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 0.25rem;
    border-radius: 4px;
}

.sidebar-header:hover {
    background: var(--bg-tertiary);
}

.sidebar-header span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collapse-icon {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.sidebar-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.sidebar-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.sidebar-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Ensure proper spacing when collapsed */
.sidebar-section .sidebar-content {
    margin-top: 1rem;
}

.sidebar-section .sidebar-content.collapsed {
    margin-top: 0;
}

/* TTS Specific Styles */
.feature-selection {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.feature-selection .radio-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.feature-selection .radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 2px solid transparent;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.feature-selection .radio-label:hover {
    background: var(--bg-tertiary);
}

.feature-selection .radio-label input:checked + .radio-custom + i {
    color: var(--primary-color);
}

.tts-section {
    display: none;
}

.tts-voice-selection,
.tts-text-section,
.tts-format-section,
.tts-action-section,
.tts-audio-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Language Selection */
.language-selection {
    margin-bottom: 1.5rem;
}

.language-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Speaker Selection */
.speaker-selection {
    margin-bottom: 1.5rem;
}

.speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.speaker-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.speaker-card:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.speaker-card.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.speaker-card.female {
    border-left: 4px solid #ec4899;
}

.speaker-card.male {
    border-left: 4px solid #3b82f6;
}

.speaker-card.mixed {
    border-left: 4px solid #8b5cf6;
}

.speaker-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.speaker-card.selected .speaker-avatar {
    background: white;
    color: var(--primary-color);
}

.speaker-info {
    flex: 1;
    min-width: 0;
}

.speaker-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.speaker-card-details {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.3;
}

.speaker-card.selected .speaker-card-details {
    opacity: 0.9;
}

.speaker-gender-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.speaker-gender-badge.female {
    background: #fce7f3;
    color: #be185d;
}

.speaker-gender-badge.male {
    background: #dbeafe;
    color: #1d4ed8;
}

.speaker-card.selected .speaker-gender-badge.female {
    background: white;
    color: #be185d;
}

.speaker-card.selected .speaker-gender-badge.male {
    background: white;
    color: #1d4ed8;
}

/* AI & Provider Settings */
.tts-ai-settings {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px solid #8b5cf6;
}

.tts-ai-settings h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.setting-item {
    margin-bottom: 1rem;
}

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

.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    transition: all 0.2s;
}

.toggle-label:hover {
    background: var(--bg-primary);
}

.toggle-label input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toggle-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toggle-text small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.provider-note {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Selected Voice Info */
.selected-voice-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

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

.speaker-icon {
    font-size: 2rem;
}

.speaker-details {
    flex: 1;
}

.speaker-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.speaker-description {
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.speaker-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gender-tag.female {
    background: #fce7f3;
    color: #be185d;
}

.gender-tag.male {
    background: #dbeafe;
    color: #1d4ed8;
}

.quality-tag {
    background: #d1fae5;
    color: #065f46;
}

.language-tag {
    background: #e0e7ff;
    color: #3730a3;
}

.voice-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.voice-detail {
    display: inline-block;
    margin-right: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.voice-detail::before {
    content: "•";
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.voice-detail:first-child::before {
    display: none;
}

.tts-text-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.tts-text-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.char-counter {
    margin-top: 0.5rem;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tts-action-section {
    text-align: center;
}

.tts-action-section .btn {
    min-width: 200px;
}

/* Female voice highlighting */
.tts-voice-selection option[data-gender="female"] {
    color: var(--primary-color);
    font-weight: 500;
}

/* TTS Format Selection - Grid Layout */
.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.format-option {
    position: relative;
}

.format-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 80px;
    justify-content: center;
}

.format-card:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.format-option input[type="radio"]:checked + .format-card {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.format-option input[type="radio"]:checked + .format-card .format-icon {
    transform: scale(1.2);
}

.format-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    transition: transform 0.2s ease;
}

.format-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.format-name {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-desc {
    font-size: 0.75rem;
    opacity: 0.8;
}

.format-option input[type="radio"]:checked + .format-card .format-desc {
    opacity: 0.9;
}

/* Focus states */
.format-option input[type="radio"]:focus + .format-card {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* TTS Audio Preview */
.audio-preview-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-preview {
    width: 100%;
    max-width: 100%;
    border-radius: 6px;
}

.audio-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.audio-actions .btn {
    min-width: 120px;
}

.tts-audio-section {
    background: var(--bg-tertiary);
    border: 2px solid var(--primary-color);
    position: relative;
}

.tts-audio-section::before {
    content: "🎵";
    position: absolute;
    top: -10px;
    right: 15px;
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Format indicator in download button */
.download-format-indicator {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: 0.25rem;
}

/* Audio player custom styling */
audio::-webkit-media-controls-panel {
    background-color: var(--bg-secondary);
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-pause-button {
    background-color: var(--primary-color);
    border-radius: 50%;
}

/* Responsive adjustments for TTS */
@media (max-width: 768px) {
    .feature-selection .radio-group {
        flex-direction: column;
    }
    
    .voice-detail {
        display: block;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .voice-detail::before {
        display: none;
    }

    .audio-actions {
        flex-direction: column;
    }
    
    .audio-actions .btn {
        width: 100%;
        min-width: auto;
    }
}