/* ========================================
   Neumorphic Design System
   Light Mode - Inspired by reference design
   ======================================== */

:root {
    /* Light mode colors from reference */
    --primary-light: #3676d8;
    --background-light: #f0f2f5;
    --background-outer: #ffffff;
    --text-dark: #1f2a3a;
    --text-muted-light: #6b7a90;
    --border-light: #e0e4e9;
    --success-light: #28a745;
    --success-light-bg: #e6faed;
    --info-light: #0d6efd;
    --info-light-bg: #e0edff;

    /* Neumorphic shadows */
    --shadow-dark: #d8dbdf;
    --shadow-light: #ffffff;

    /* Translation preview height (based on MAX_TOKENS_PER_CHUNK) */
    /* Default: 300px for 450 tokens. Formula: (tokens / 450) * 300 */
    /* Min: 120px, Max: 400px */
    --preview-height: 300px;
}

/* ========================================
   Dark Mode Theme
   ======================================== */

html.dark {
    /* Dark mode colors - neutral grays */
    --primary-light: #5a8ee8;
    --background-light: #2a2a2a;
    --background-outer: #121212;
    --text-dark: #e8e8e8;
    --text-muted-light: #999999;
    --border-light: #444444;
    --success-light: #34d399;
    --success-light-bg: #1a2a1a;
    --info-light: #60a5fa;
    --info-light-bg: #1a1a2a;

    /* Neumorphic shadows for dark mode */
    --shadow-dark: #1a1a1a;
    --shadow-light: #3a3a3a;
}

html.dark .neu-inset-light {
    background: #222222;
    border: 2px solid rgba(136, 136, 136, 0.15);
}

html.dark .neu-inset-light:hover {
    border-color: rgba(136, 136, 136, 0.35);
}

html.dark .neu-inset-light:focus-within {
    border-color: var(--primary-light);
}

html.dark .form-control {
    background: #222222;
    color: #e8e8e8;
}

html.dark .neu-inset-light .form-control {
    background: #222222;
}

html.dark .form-control:focus {
    background: #222222;
}

html.dark .form-control::placeholder {
    color: #777777;
}

html.dark .header {
    background: rgba(42, 42, 42, 0.9);
}

html.dark .file-upload {
    background: var(--background-light);
}

html.dark .file-table thead tr {
    background: rgba(136, 136, 136, 0.1);
}

html.dark .file-table tbody tr:hover {
    background: rgba(136, 136, 136, 0.05);
}

html.dark .message.error {
    background: #2d1f1f;
    border-color: #7f1d1d;
    color: #fca5a5;
}

html.dark .message.success {
    background: #1a3a2e;
    border-color: #166534;
    color: #86efac;
}

html.dark .message.info {
    background: #1e3a5f;
    border-color: #1e40af;
    color: #93c5fd;
}

html.dark #ttsOptions {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(52, 211, 153, 0.08) 100%);
    border-color: rgba(52, 211, 153, 0.4);
}

html.dark .log-entry.log-summary-detailed {
    background: #222222;
    border-color: rgba(136, 136, 136, 0.3);
    border-left-color: var(--primary-light);
}

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

body {
    background-color: var(--background-outer);
    color: var(--text-dark);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   Neumorphic Card Styles
   ======================================== */

.neu-card-light {
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 2rem;
}

.neu-inset-light {
    background: #ffffff;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 2px solid rgba(54, 118, 216, 0.15);
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.neu-inset-light:hover {
    border-color: rgba(54, 118, 216, 0.35);
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.neu-inset-light:focus-within {
    border-color: var(--primary-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light), 0 0 0 3px rgba(54, 118, 216, 0.1);
}

/* ========================================
   Layout
   ======================================== */

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ========================================
   Header
   ======================================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    margin-bottom: 3rem;
    background: rgba(240, 242, 245, 0.9);
    backdrop-filter: blur(30px);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-light);
    border-radius: 2rem;
}

.header #themeToggleBtn {
    min-width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.header #themeToggleBtn:hover {
    transform: scale(1.05) rotate(15deg);
}

.header #themeToggleBtn .material-symbols-outlined {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.header .logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.header .logo-icon .material-symbols-outlined {
    color: var(--primary-light);
    font-size: 2rem;
}

.header img {
    max-width: 200px;
    height: auto;
}

.header .logo-text h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.025em;
    line-height: 1;
}

.header .logo-text p {
    color: var(--text-muted-light);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.header .status-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header .status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
}

.header .status-indicator .status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #6b7280;
    transition: background-color 0.3s ease;
}

/* Status dot states */
.header .status-indicator .status-dot.checking {
    background-color: #6b7280;
    animation: pulse-gray 2s infinite;
}

.header .status-indicator .status-dot.connected {
    background-color: #22c55e;
    animation: pulse-green 2s infinite;
}

.header .status-indicator .status-dot.disconnected {
    background-color: #dc2626;
    animation: pulse-red 2s infinite;
}

.header .status-indicator .status-dot.error {
    background-color: #f59e0b;
    animation: pulse-orange 2s infinite;
}

.header .status-indicator .status-dot.waiting {
    background-color: #6b7280;
    animation: pulse-gray 2s infinite;
}

.header .status-indicator span {
    font-size: 0.75rem;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    color: #16a34a;
    transition: color 0.3s ease;
}

/* ========================================
   Main Card
   ======================================== */

.main-card {
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 2.5rem;
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    background: var(--background-light);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header .material-symbols-outlined {
    color: var(--primary-light);
    font-size: 1.5rem;
}

.card-header h2 {
    color: var(--text-dark);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.card-body {
    padding: 2rem;
    color: var(--text-dark);
}

/* ========================================
   Form Controls
   ======================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-muted-light);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    height: 3.5rem;
    background: #ffffff;
    border: none;
    border-radius: 1rem;
    color: #1a1a1a;
    font-size: 1rem;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s;
    font-weight: 600;
}

.neu-inset-light .form-control {
    background: #ffffff;
    border-radius: 1rem;
}

.form-control:focus {
    outline: none;
    background: #ffffff;
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

select.form-control {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' 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 1rem center;
    background-size: 1.2em;
    padding-right: 3rem;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.025em;
}

.btn-primary {
    background: var(--primary-light);
    color: white;
    box-shadow: 0 8px 20px rgba(54, 118, 216, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 12px 30px rgba(54, 118, 216, 0.35);
    transform: scale(1.02);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary {
    background: var(--background-light);
    color: var(--text-dark);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}

.btn-danger {
    background: #ef4444;
    color: white;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.35);
}

/* ========================================
   File Upload Area
   ======================================== */

.file-upload {
    margin: 2rem 0;
    padding: 4rem;
    border: 2px dashed rgba(54, 118, 216, 0.3);
    border-radius: 3rem;
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.file-upload:hover {
    border-color: rgba(54, 118, 216, 0.6);
    transform: scale(1.01);
}

.file-upload.dragging {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(54, 118, 216, 0.05), rgba(54, 118, 216, 0.1));
}

.file-upload .upload-icon {
    background: rgba(54, 118, 216, 0.1);
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: transform 0.3s;
}

.file-upload:hover .upload-icon {
    transform: scale(1.1);
}

.file-upload .material-symbols-outlined {
    font-size: 3rem;
    color: var(--primary-light);
}

.file-upload h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.file-upload p {
    color: var(--text-muted-light);
    font-size: 1rem;
}

.file-upload .browse-btn {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    background: var(--primary-light);
    color: white;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    display: inline-block;
}

/* ========================================
   Progress Section
   ======================================== */

.progress-section {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 2rem;
}

.progress-section h3 {
    color: var(--text-dark);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar-container {
    height: 2.5rem;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1.25rem;
    overflow: hidden;
    margin: 1.5rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), #5a8ee8);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
}

/* ========================================
   Stats Grid
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.stat-card {
    padding: 0.5rem 0.25rem;
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    text-align: center;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-1px);
}

.stat-card h3 {
    font-size: 1.25rem;
    color: var(--primary-light);
    font-weight: 900;
    margin-bottom: 0.15rem;
}

.stat-card p {
    color: var(--text-muted-light);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ========================================
   Log Container
   ======================================== */

.log-container {
    max-height: 250px;
    min-height: 200px;
    overflow-y: auto;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 2rem;
    padding: 2rem;
    padding-right: 1.5rem; /* Réduit pour faire de la place à la scrollbar */
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Last Translation Preview - Dynamic height based on MAX_TOKENS_PER_CHUNK */
#lastTranslationPreview {
    height: var(--preview-height) !important;
    min-height: var(--preview-height) !important;
    max-height: var(--preview-height) !important;
}

/* Scrollbar visible uniquement pour log-container */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: transparent;
    margin: 1rem 0; /* Décale la scrollbar pour éviter les coins arrondis */
}

.log-container::-webkit-scrollbar-thumb {
    background: var(--shadow-dark);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted-light);
}

/* Scrollbar pour Firefox */
.log-container {
    scrollbar-width: thin;
    scrollbar-color: var(--shadow-dark) transparent;
}

.log-entry {
    margin-bottom: 0.75rem;
    display: flex;
    gap: 1rem;
}

.log-timestamp {
    color: var(--text-muted-light);
    font-weight: 700;
    flex-shrink: 0;
}

/* Progress log entry (updated in-place) */
.log-entry.log-progress {
    opacity: 0.8;
    font-style: italic;
}

/* Summary log entry (consolidated completion messages) */
.log-entry.log-summary {
    background: var(--success-light-bg);
    border-left: 3px solid var(--success-light);
    padding: 0.75rem;
    border-radius: 6px;
    display: block;
    margin: 1rem 0;
    line-height: 1.6;
}

/* Detailed summary with statistics and recommendations */
.log-entry.log-summary-detailed {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 6px;
    display: block;
    margin: 1rem 0;
    line-height: 1.8;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-content {
    color: var(--text-dark);
}

.log-content.success {
    color: var(--success-light);
    font-weight: 700;
}

.log-content.info {
    color: var(--primary-light);
    font-weight: 500;
}

.log-content.error {
    color: #ef4444;
    font-weight: 700;
}

/* ========================================
   Scrollbar Customization - Hidden
   ======================================== */

::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
}

::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* Hide scrollbars for Firefox */
* {
    scrollbar-width: none;
}

/* Hide scrollbars for IE and Edge Legacy */
* {
    -ms-overflow-style: none;
}

/* ========================================
   Toggle Sections
   ======================================== */

.prompt-options-toggle {
    cursor: pointer;
    padding: 1rem 1.5rem;
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-dark);
    transition: all 0.3s;
}

.prompt-options-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}

.prompt-options-toggle span {
    font-weight: 600;
}

#promptOptionsIcon {
    transition: transform 0.2s;
    color: var(--primary-light);
}

#promptOptionsSection {
    padding: 1.5rem;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1.5rem;
    margin-bottom: 1rem;
}

/* ========================================
   Checkbox Styles
   ======================================== */

input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    min-height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-light);
    flex-shrink: 0;
}

/* ========================================
   File Management
   ======================================== */

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background-light);
    border-radius: 1.5rem;
    overflow: hidden;
}

.file-table thead tr {
    background: rgba(54, 118, 216, 0.05);
}

.file-table th {
    padding: 1rem;
    text-align: left;
    color: var(--text-muted-light);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

.file-table tbody tr {
    border-top: 1px solid var(--border-light);
    transition: background 0.2s;
}

.file-table tbody tr:hover {
    background: rgba(54, 118, 216, 0.03);
}

.file-table td {
    padding: 1rem;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.clickable-filename {
    cursor: pointer;
    color: var(--primary-light);
    font-weight: 600;
    transition: all 0.2s;
}

.clickable-filename:hover {
    text-decoration: underline;
}

.file-action-btn {
    padding: 0;
    background: var(--background-light);
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    color: var(--text-dark);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.file-action-btn:hover {
    transform: translateY(-1px);
}

.file-action-btn.download {
    color: var(--primary-light);
}

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

/* ========================================
   Messages
   ======================================== */

.message {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    margin: 1rem 0;
    font-weight: 600;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.success {
    background: var(--success-light-bg);
    border: 1px solid #86efac;
    color: #166534;
}

.info {
    background: var(--info-light-bg);
    border: 1px solid #93c5fd;
    color: #1e3a8a;
}

/* ========================================
   Footer
   ======================================== */

.app-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    color: var(--text-muted-light);
    border-top: 1px solid var(--border-light);
    border-radius: 2rem;
}

.app-footer p {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.app-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
}

.app-footer a:hover {
    color: #5a8ee8;
}

.app-footer .footer-separator {
    margin: 0 0.75rem;
    color: var(--border-light);
}

.app-footer .heart {
    color: #ef4444;
    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); }
}

/* ========================================
   TTS Section
   ======================================== */

#ttsOptions {
    margin-top: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 1.5rem;
}

.gpu-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    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: #16a34a;
}

.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: #dc2626;
}

.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: #f59e0b;
}

.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);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(34, 197, 94, 0.9);
        transform: scale(1.1);
    }
}

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

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(220, 38, 38, 0.9);
        transform: scale(1.1);
    }
}

@keyframes pulse-orange {
    0%, 100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.9);
        transform: scale(1.1);
    }
}

@keyframes pulse-gray {
    0%, 100% {
        box-shadow: 0 0 8px rgba(107, 114, 128, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px rgba(107, 114, 128, 0.7);
        transform: scale(1.1);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotating {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* TTS Slider Styles */
.tts-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--background-light);
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
    outline: none;
    cursor: pointer;
    margin-top: 0.5rem;
}

.tts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-light);
    cursor: pointer;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: all 0.2s;
}

.tts-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.tts-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-light);
    cursor: pointer;
    border: none;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: all 0.2s;
}

.tts-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

/* ========================================
   API Key Status
   ======================================== */

.key-status {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    vertical-align: middle;
}

.key-status.configured {
    background: rgba(34, 197, 94, 0.2);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

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

/* ========================================
   Modal Styles
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--background-light);
    box-shadow: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
}

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

.modal-header h3 {
    color: var(--text-dark);
    font-weight: 700;
    margin: 0;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: var(--background-light);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-dark);
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

/* ========================================
   Range Input Styles
   ======================================== */

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--background-light);
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
    outline: none;
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-light);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-light);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

/* ========================================
   File List Container
   ======================================== */

/* Styles moved to EPUB Thumbnail Styles section below */

/* ========================================
   EPUB Thumbnail Styles
   ======================================== */

#fileListContainer {
    list-style: none;
    padding: 1rem;
    margin: 0;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--background-light);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Clickable file items (Queued status) */
.file-item[style*="cursor: pointer"]:hover {
    box-shadow: 0 2px 8px rgba(54, 118, 216, 0.15);
    transform: translateY(-1px);
    border-color: var(--primary-light);
}

.file-item[style*="cursor: pointer"]:hover:not(.file-active) {
    background: rgba(54, 118, 216, 0.03);
}

/* Non-clickable file items (Processing/Completed) */
.file-item:not([style*="cursor: pointer"]):hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Active file - the last uploaded file that syncs with language selectors */
.file-item.file-active {
    border-color: var(--primary-light);
    border-width: 2px;
    background: linear-gradient(135deg, rgba(54, 118, 216, 0.05) 0%, rgba(54, 118, 216, 0.02) 100%);
}

.file-item.file-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-light);
    border-radius: 0.75rem 0 0 0.75rem;
}

.file-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-light);
    background: rgba(54, 118, 216, 0.1);
    border-radius: 4px;
    margin-left: 8px;
}

.file-icon {
    flex-shrink: 0;
    width: 48px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(54, 118, 216, 0.05);
    font-size: 2rem;
}

.epub-thumbnail {
    width: 48px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.generic-epub-icon {
    width: 48px;
    height: 64px;
}

.file-info {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.file-status {
    font-size: 0.875rem;
    color: var(--text-muted-light);
    font-style: italic;
}

.file-remove-btn {
    margin-left: auto;
    padding: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted-light);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.file-remove-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Dark mode support */
html.dark .file-item {
    background: rgba(26, 31, 46, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .file-item.file-active {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(90, 142, 232, 0.12) 0%, rgba(90, 142, 232, 0.05) 100%);
}

html.dark .file-active-badge {
    color: var(--primary-light);
    background: rgba(90, 142, 232, 0.2);
}

html.dark .file-icon {
    background: rgba(90, 142, 232, 0.1);
}

html.dark .sponsor-section iframe {
    display: none;
}

html.dark .sponsor-section .sponsor-link {
    display: inline-flex;
}

.sponsor-section .sponsor-link {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--background-light);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.sponsor-section .sponsor-link:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    color: #db61a2;
}

.sponsor-section .sponsor-link .material-symbols-outlined {
    color: #db61a2;
}

html.dark .file-info {
    color: var(--text-light);
}

/* ========================================
   Resumable Jobs Cards
   ======================================== */

.resumable-job-card {
    border: 1px solid var(--border-light) !important;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 1rem !important;
    background: var(--background-light) !important;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resumable-job-card:hover {
    transform: translateY(-2px);
    box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
}

#resumableJobsList {
    padding: 1rem;
    background: var(--background-light);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    border: 1px solid var(--border-light);
    border-radius: 1.5rem;
}

/* ========================================
   Responsive Design
   ======================================== */

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

    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    .file-upload {
        padding: 2rem;
    }
}

/* ========================================
   Searchable Select Component
   ======================================== */

.searchable-select {
    position: relative;
    width: 100%;
}

/* Display area - shows selected value */
.searchable-select-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    min-height: 44px;
    transition: background 0.2s;
}

.searchable-select-display:hover {
    background: rgba(54, 118, 216, 0.05);
}

.searchable-select.open .searchable-select-display {
    background: rgba(54, 118, 216, 0.08);
}

.searchable-select-value {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-value.placeholder {
    color: var(--text-muted-light);
}

.searchable-select-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    background: rgba(54, 118, 216, 0.12);
    color: var(--primary-light);
    border-radius: 9999px;
    white-space: nowrap;
}

.searchable-select-arrow {
    font-size: 1.25rem;
    color: var(--text-muted-light);
    transition: transform 0.2s, color 0.2s;
}

.searchable-select.open .searchable-select-arrow {
    color: var(--primary-light);
}

/* Dropdown */
.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: -1px;
    right: -1px;
    z-index: 1000;
    background: var(--background-light);
    border: 2px solid var(--primary-light);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
}

.searchable-select.open .searchable-select-dropdown {
    max-height: 400px;
    opacity: 1;
    transform: translateY(0);
}

/* Search header */
.searchable-select-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: rgba(54, 118, 216, 0.03);
}

.searchable-select-search-icon {
    font-size: 1.25rem;
    color: var(--text-muted-light);
}

.searchable-select-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    padding: 0.25rem 0;
}

.searchable-select-input::placeholder {
    color: var(--text-muted-light);
}

.searchable-select-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted-light);
    border-radius: 50%;
    transition: all 0.2s;
}

.searchable-select-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.searchable-select-clear .material-symbols-outlined {
    font-size: 1rem;
}

/* Options list */
.searchable-select-options {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    max-height: 320px;
    overflow-y: auto;
}

.searchable-select-option {
    padding: 0.625rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.searchable-select-option:hover,
.searchable-select-option.highlighted {
    background: rgba(54, 118, 216, 0.08);
}

.searchable-select-option.selected {
    background: rgba(54, 118, 216, 0.12);
}

.searchable-select-option .option-check {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1rem;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.searchable-select-option .option-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.searchable-select-option .option-label {
    font-size: 0.875rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-option.selected .option-label {
    color: var(--primary-light);
    font-weight: 600;
}

.searchable-select-option .option-description {
    font-size: 0.75rem;
    color: var(--text-muted-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Group headers - sticky with opaque background */
.searchable-select-group {
    padding: 0.625rem 1rem 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-light);
    background: #f8f9fc;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.searchable-select-group:first-child {
    border-top: none;
}

/* No results */
.searchable-select-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted-light);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.searchable-select-no-results .material-symbols-outlined {
    font-size: 1.25rem;
}

.searchable-select-no-results .custom-value {
    font-weight: 600;
    color: var(--primary-light);
}

/* Scrollbar styling */
.searchable-select-options::-webkit-scrollbar {
    width: 8px;
}

.searchable-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.searchable-select-options::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.searchable-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted-light);
}

/* Dark mode adjustments */
html.dark .searchable-select-display:hover {
    background: rgba(90, 142, 232, 0.08);
}

html.dark .searchable-select.open .searchable-select-display {
    background: rgba(90, 142, 232, 0.12);
}

html.dark .searchable-select-badge {
    background: rgba(90, 142, 232, 0.2);
}

html.dark .searchable-select-dropdown {
    background: #2a2a2a;
    border-color: var(--primary-light);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

html.dark .searchable-select-search {
    background: rgba(90, 142, 232, 0.05);
    border-color: #444444;
}

html.dark .searchable-select-option:hover,
html.dark .searchable-select-option.highlighted {
    background: rgba(90, 142, 232, 0.12);
}

html.dark .searchable-select-option.selected {
    background: rgba(90, 142, 232, 0.18);
}

html.dark .searchable-select-group {
    background: #2a2a2a;
    border-color: #444444;
}

/* ========================================
   Provider Select with Logos
   ======================================== */

.provider-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.provider-logo {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 4px;
    object-fit: contain;
}

.provider-name {
    flex: 1;
}

.provider-description {
    font-size: 0.75rem;
    color: var(--text-muted-light);
    margin-left: auto;
}

/* Provider logo in display area */
.searchable-select-display .provider-logo {
    width: 18px;
    height: 18px;
}

/* Larger logo in dropdown */
.searchable-select-option .provider-logo {
    width: 22px;
    height: 22px;
}
