* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #D7E0DD;
    min-height: 100vh;
    color: #E0E6E9;
    padding: 20px;
}
.container { max-width: 1200px; margin: 0 auto; }
.header {
    text-align: center;
    margin-bottom: 40px;
}
.header img {
    max-width: 250px;
    height: auto;
    margin-bottom: 10px;
}
.header p {
    color: #A3ADB3;
    font-size: 18px;
}
.main-card {
    background: linear-gradient(145deg, #1A1A1A, #0D0D0D);
    border-radius: 20px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 1px solid #333333;
}
.card-header {
    background: linear-gradient(90deg, #1E1E1E, #2A2A2A);
    color: #79CDDE; /* Replaced accent color */
    padding: 30px;
    box-shadow: inset 0 -5px 15px rgba(0, 0, 0, 0.6);
}
.card-body { padding: 30px; color: #E0E6E9; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.form-group { display: flex; flex-direction: column; }
.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #A3ADB3;
}
.form-control {
    padding: 12px;
    border: 2px solid #333333;
    background-color: #1A1A1A;
    border-radius: 8px;
    font-size: 16px;
    color: #E0E6E9;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.form-control:focus {
    outline: none;
    border-color: #79CDDE; /* Replaced accent color */
    box-shadow: 0 0 10px rgba(121, 205, 222, 0.6); /* Replaced accent color */
}
.file-upload {
    margin: 30px 0;
    padding: 60px;
    border: 3px dashed #79CDDE; /* Replaced accent color */
    border-radius: 15px;
    text-align: center;
    background: linear-gradient(135deg, #1A1A1A, #2C2C2C);
    cursor: pointer;
    transition: all 0.3s;
    color: #A3ADB3;
}
.file-upload:hover {
    border-color: #E0E6E9;
    background: linear-gradient(135deg, #2C2C2C, #3A3A3A);
}
.file-upload.dragging {
    border-color: #79CDDE; /* Replaced accent color */
    background: linear-gradient(135deg, #3A3A3A, #4A4A4A);
}
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: #333333;
    color: #E0E6E9;
    border: 2px solid #79CDDE;
}

.btn-secondary:hover {
    background: #404040;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(121, 205, 222, 0.3);
}
.btn-primary {
    background: linear-gradient(90deg, #79CDDE, #44A6BC); /* Replaced accent color with a slight gradient */
    color: #FFFFFF;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(121, 205, 222, 0.4); /* Replaced accent color */
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-danger {
    background-color: #E57373;
    color: #FFFFFF;
}
.btn-danger:hover { background-color: #EF5350; }
.btn-danger:disabled { background-color: #E57373; opacity: 0.6; cursor: not-allowed; }
.progress-section {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(145deg, #1A1A1A, #0D0D0D);
    border-radius: 15px;
    border: 1px solid #333333;
    color: #E0E6E9;
}
.progress-bar-container {
    height: 30px;
    background: #333333;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #79CDDE, #44A6BC); /* Replaced accent color with a slight gradient */
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1A1A1A;
    font-weight: 600;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin: 20px 0; }
.stat-card {
    padding: 20px;
    background: linear-gradient(145deg, #1A1A1A, #2C2C2C);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
    color: #E0E6E9;
}
.stat-card h3 {
    font-size: 32px;
    color: #79CDDE; /* Replaced accent color */
    margin-bottom: 5px;
    text-shadow: 0 0 8px rgba(121, 205, 222, 0.7); /* Replaced accent color */
}
.log-container {
    max-height: 200px;
    overflow-y: auto;
    background: #1A1A1A;
    color: #E0E6E9;
    padding: 15px;
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 14px;
    margin-top: 15px;
    border: 1px solid #333333;
}
.output-section {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(145deg, #1A1A1A, #0D0D0D);
    border-radius: 15px;
    border: 1px solid #333333;
    color: #E0E6E9;
}
.output-preview {
    margin-top: 15px;
    padding: 15px;
    background: #1A1A1A;
    border: 1px solid #333333;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #E0E6E9;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}
.advanced-toggle {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(90deg, #1A1A1A, #2C2C2C);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #333333;
    color: #A3ADB3;
    transition: background 0.3s;
}
.advanced-toggle:hover {
    background: linear-gradient(90deg, #2C2C2C, #3A3A3A);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
.advanced-settings {
    margin-top: 15px;
    padding: 20px;
    background: #1A1A1A;
    border-radius: 8px;
    border: 1px solid #333333;
    color: #E0E6E9;
}
.hidden { display: none !important; }
.message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 600;
}
.error {
    background: #4A1B1B;
    border: 1px solid #8A2D2D;
    color: #FFC0C0;
}
.success {
    background: #1B4A1B;
    border: 1px solid #2D8A2D;
    color: #C0FFC0;
}
.info {
    background: #1B1B4A;
    border: 1px solid #2D2D8A;
    color: #C0C0FF;
}
#fileListContainer {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    background: #1A1A1A;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #333333;
    color: #A3ADB3;
}
#fileListContainer li {
    list-style-type: none;
    padding: 5px;
    border-bottom: 1px solid #333333;
}
#fileListContainer li:last-child { border-bottom: none; }
.file-status {
    font-style: italic;
    color: #79CDDE; /* Replaced accent color */
    font-size: 0.9em;
    margin-left: 10px;
}
.log-container {
    max-height: 200px;
    overflow-y: auto;
    background: #1A1A1A;
    color: #E0E6E9;
    padding: 15px;
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 14px;
    margin-top: 15px;
    border: 1px solid #333333;
}
.log-entry {
    margin-bottom: 8px;
    line-height: 1.4;
}
.log-timestamp {
    color: #79CDDE;
    font-weight: 600;
}
.log-prompt {
    background: #2A2A2A;
    border: 1px solid #79CDDE;
    border-radius: 6px;
    padding: 10px;
    margin: 5px 0;
}
.log-label {
    color: #79CDDE;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}
.prompt-content {
    background: #1A1A1A;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
    font-size: 12px;
    color: #E0E6E9;
    margin: 5px 0 0 0;
}

/* Custom Instructions textarea styling */
#customInstructions {
    width: 100%;
    resize: vertical;
    min-height: 80px;
}

/* Model dropdown container */
.model-select-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.model-select-container .form-control {
    flex: 1;
    min-width: 0; /* Allow shrinking below content width */
}

.model-select-container .btn-secondary {
    flex-shrink: 0; /* Prevent button from shrinking */
    height: 44px; /* Match form-control height with padding */
    width: 44px; /* Square button */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Ensure Ollama endpoint input doesn't break layout */
#apiEndpoint {
    word-break: break-all; /* Allow breaking long URLs */
}

/* File Management Styles */
.file-table {
    width: 100%;
    border-collapse: collapse;
    background: #1A1A1A;
    border-radius: 8px;
    overflow: hidden;
}

.file-table thead tr {
    background: #2A2A2A !important;
    border-bottom: 2px solid #333333;
}

.file-table th {
    padding: 12px;
    text-align: left;
    color: #79CDDE;
    font-weight: 600;
}

.file-table tbody tr {
    border-bottom: 1px solid #333333;
    transition: background 0.2s;
}

.file-table tbody tr:hover {
    background: #252525;
}

.file-table tbody tr:last-child {
    border-bottom: none;
}

.file-table td {
    padding: 12px;
    color: #E0E6E9;
}

.file-table .file-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

#selectAllFiles {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.file-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-action-btn {
    padding: 6px 12px;
    border: 1px solid #333333;
    background: #2A2A2A;
    color: #E0E6E9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.file-action-btn:hover {
    background: #3A3A3A;
    border-color: #79CDDE;
}

.file-action-btn.download {
    color: #79CDDE;
}

.file-action-btn.delete {
    color: #FF6B6B;
}

.clickable-filename {
    cursor: pointer;
    color: #79CDDE;
    transition: color 0.2s, text-decoration 0.2s;
}

.clickable-filename:hover {
    color: #9CE5F4;
    text-decoration: underline;
}

#fileListEmpty {
    padding: 60px 20px;
    text-align: center;
    color: #6B7280;
}

#fileListLoading {
    padding: 40px;
    text-align: center;
    color: #A3ADB3;
}

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

/* Audiobook Generation Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(145deg, #1A1A1A, #0D0D0D);
    border-radius: 12px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
    border: 1px solid #333333;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    background: linear-gradient(90deg, #1E1E1E, #2A2A2A);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333333;
}

.modal-header h3 {
    color: #79CDDE;
    margin: 0;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: #1A1A1A;
    border-top: 1px solid #333333;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: #A3ADB3;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #E0E6E9;
}

.file-action-btn.audiobook {
    color: #FFD93D;
}

.audio-progress-card {
    background: linear-gradient(145deg, #1A1A1A, #0D0D0D);
    border-radius: 12px;
    border: 1px solid #333333;
    margin-bottom: 20px;
    overflow: hidden;
}

.audio-progress-card .card-header {
    background: linear-gradient(90deg, #1E1E1E, #2A2A2A);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.audio-progress-card .card-header h3 {
    color: #FFD93D;
    font-size: 18px;
    margin: 0;
}

.audio-progress-card .card-body {
    padding: 20px;
}

.audio-status {
    margin-top: 10px;
    color: #A3ADB3;
    font-size: 14px;
}

.audio-logs {
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    color: #A3ADB3;
    line-height: 1.6;
}

.audio-complete {
    text-align: center;
    padding: 20px;
    background: #1E1E1E;
    border-radius: 8px;
    border: 1px solid #333333;
}

.audio-complete h4 {
    color: #4ADE80;
    margin-bottom: 15px;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #333333;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    border-radius: 3px;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #79CDDE;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #79CDDE;
    cursor: pointer;
    border-radius: 50%;
}

#speedValue {
    display: inline-block;
    margin-left: 10px;
    color: #79CDDE;
    font-weight: 600;
}

/* Footer Styles */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    color: #A3ADB3;
    border-top: 1px solid #333333;
}

.app-footer p {
    margin: 0;
    font-size: 14px;
}

/* Provider settings links (OpenRouter, etc.) */
.form-group small a {
    color: #79CDDE;
    text-decoration: none;
    transition: color 0.3s;
}

.form-group small a:hover {
    color: #9CE5F4;
    text-decoration: underline;
}

.app-footer a {
    color: #79CDDE;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.app-footer a:hover {
    color: #9CE5F4;
    text-decoration: underline;
}

.app-footer .heart {
    color: #E57373;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.1); }
    20%, 40% { transform: scale(1); }
}

/* API Key Status Indicators */
.key-status {
    font-size: 12px;
    font-weight: normal;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
}

.key-status.configured {
    background: rgba(74, 222, 128, 0.2);
    color: #4ADE80;
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.key-status.not-configured {
    background: rgba(251, 191, 36, 0.2);
    color: #FBBF24;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

/* ========================================
   TTS Provider Styles
   ======================================== */

/* GPU Status Indicator */
.gpu-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.gpu-status.gpu-available {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.15) 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.gpu-status.gpu-unavailable {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(185, 28, 28, 0.15) 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.gpu-status.gpu-checking {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
}

/* Status Dot Animation */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.available {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse-green 2s infinite;
}

.status-dot.unavailable {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.status-dot.checking {
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
    animation: pulse-yellow 1s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
    50% { box-shadow: 0 0 15px rgba(34, 197, 94, 0.9); }
}

@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
    50% { box-shadow: 0 0 15px rgba(251, 191, 36, 0.9); }
}

.gpu-vram {
    margin-left: auto;
    font-size: 12px;
    color: #a3adb3;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* TTS Slider Styles */
.tts-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #333333, #444444);
    outline: none;
    opacity: 0.9;
    transition: all 0.2s;
    cursor: pointer;
    margin-top: 8px;
}

.tts-slider:hover {
    opacity: 1;
    background: linear-gradient(to right, #404040, #505050);
}

.tts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    cursor: pointer;
    border: 2px solid #1a1a1a;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    transition: all 0.2s;
}

.tts-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.6);
}

.tts-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    cursor: pointer;
    border: 2px solid #1a1a1a;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    transition: all 0.2s;
}

.tts-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.6);
}

/* Voice Prompt Section */
.voice-prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #333;
}

.voice-prompt-item:hover {
    border-color: #fbbf24;
}

.voice-prompt-name {
    font-size: 13px;
    color: #e0e6e9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-prompt-size {
    font-size: 11px;
    color: #6b7280;
    margin-left: auto;
    margin-right: 10px;
}

.voice-prompt-delete {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.voice-prompt-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* TTS Provider Badge */
.tts-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tts-provider-badge.edge-tts {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.15) 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.tts-provider-badge.chatterbox {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
}

/* Chatterbox feature highlights */
.chatterbox-feature {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 12px;
    font-size: 11px;
    color: #fbbf24;
    margin-right: 6px;
}

/* TTS Options container transitions */
#edgeTTSOptions,
#chatterboxOptions {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#chatterboxOptions {
    animation: slideIn 0.3s ease;
}

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