/* src/static/new_style.css - Light/Dark theme for MLX-Whisper */
:root {
    /* Minimalist color palette - muted tones */
    --primary-color: #2d3748;
    --secondary-color: #718096;
    --accent-color: #4299e1;
    --background-dark: #f7fafc;
    --background-light: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --success-color: #48bb78;
    --error-color: #e53e3e;
    --warning-color: #ecc94b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
    --switch-thumb: #ffffff;
    --switch-track: #e2e8f0;
}

/* Ensure the theme switch label is always white regardless of theme */
.theme-switch-label {
    color: #fff !important;
}

/* Dark theme color palette */
[data-theme="dark"] {
    --primary-color: #a0aec0;
    --secondary-color: #718096;
    --accent-color: #63b3ed;
    --background-dark: #1a202c;
    --background-light: #2d3748;
    --card-bg: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --border-color: #4a5568;
    --success-color: #48bb78;
    --error-color: #e53e3e;
    --warning-color: #ecc94b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --switch-thumb: #f7fafc;
    --switch-track: #4a5568;
}

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

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.65;
    color: var(--text-primary);
    background-color: var(--background-dark);
    min-height: 100vh;
    padding: 24px;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    background-color: var(--background-light);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

/* Header styling - minimal */
.app-header {
    background-color: var(--primary-color);
    padding: 24px;
    color: white;
    text-align: center;
}

.app-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1rem;
    opacity: 0.9;
}

/* Main content - One Column Layout */
.app-main {
    flex: 1;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: stretch;
}

/* Section styling - minimal */
.upload-section, .result-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

/* Spacing between upload button and result block */
.result-section {
    margin-top: 32px;
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.section-description p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Form styling */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.2px;
    font-size: 0.95rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* File upload styling */
.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: var(--transition);
    background-color: var(--background-dark);
    cursor: pointer;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 216, 0.08);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
}

.upload-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin: 0;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 4px;
}

.file-input {
    display: none;
}

/* Input elements */
.form-select {
    background-color: var(--background-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: 'Source Sans 3', sans-serif;
    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='%23718096' stroke-width='2'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    width: 100%;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 216, 0.2);
    background-color: var(--background-light);
}

.form-input {
    background-color: var(--background-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: var(--transition);
    font-family: 'Source Sans 3', sans-serif;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 216, 0.2);
}

.initial-prompt-input {
    font-size: 0.95rem;
}

/* Отступ после поля initial prompt */
#initialPrompt {
    margin-bottom: 20px;
}

/* Full width input in form grid */
.form-input-full {
    grid-column: 1 / -1;
}

/* Range sliders */
.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.form-range::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.form-range::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
}

.form-range::-ms-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.form-range::-ms-track {
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
}

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

.range-value {
    text-align: right;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Range slider container for consistent layout */
.range-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.range-container .form-range {
    width: 100%;
}

/* Checkbox styling */
.form-checkboxes {
    margin: 20px 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background-color: var(--background-light);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 12px;
}

.checkbox-group:hover {
    border-color: var(--primary-color);
}

/* Full width checkboxes in form grid */
.form-grid .form-checkboxes {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--background-light);
    margin-right: 10px;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-group:hover input[type="checkbox"] {
    border-color: var(--primary-color);
}

/* Text inside checkbox group */
.checkbox-group > span {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.95rem;
}

/* Submit button */
.submit-button {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    transition: var(--transition);
    font-family: 'Source Sans 3', sans-serif;
    letter-spacing: 0.5px;
    border: none;
}

.submit-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.submit-button:active {
    transform: translateY(0);
}

/* Result section */
.result-content {
    min-height: 200px;
    padding: 20px;
    background-color: var(--background-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.7;
}

.empty-state h3 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.4rem;
    color: var(--primary-color);
}

.empty-state p {
    font-size: 1rem;
    max-width: 600px;
    line-height: 1.6;
}

/* Loading state */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-state i {
    font-size: 3rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loading-state h3 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.4rem;
    color: var(--primary-color);
}

/* Error state */
.error-state {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--error-color);
}

.error-state i {
    font-size: 3rem;
}

.error-state h3 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.4rem;
}

/* Error message in upload area */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 8px;
    color: var(--error-color);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.error-message i {
    flex-shrink: 0;
}

/* Result box styling */
.result-box {
    background-color: var(--background-light);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.result-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 500;
}

.action-button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-family: 'Source Sans 3', sans-serif;
    letter-spacing: 0.5px;
    border: none;
}

.action-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.action-button:active {
    transform: translateY(0);
}

/* Green button for Copy action */
.action-button.secondary {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.action-button.secondary:hover {
    opacity: 0.9;
}

/* Result actions - horizontal layout by default */
.result-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.result-actions .action-button {
    flex: 1 1 auto;
    min-width: 140px;
}

.text-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    background-color: var(--background-dark);
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    font-family: 'Source Sans 3', sans-serif;
    line-height: 1.65;
}

.text-content p {
    margin-bottom: 0;
    color: var(--text-primary);
}

/* Отступ после элемента "Распознанный текст" */
.text-content + .result-actions {
    margin-top: 16px;
}

.result-details {
    background-color: var(--background-dark);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

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

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.detail-item i {
    color: var(--primary-color);
    min-width: 20px;
}

.detail-item span {
    font-family: 'Source Sans 3', sans-serif;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-dark);
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .app-main {
        padding: 20px 15px;
    }

    .upload-section,
    .result-section {
        padding: 20px;
    }

    .app-title {
        font-size: 2rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .action-button {
        width: 100%;
        justify-content: center;
        min-width: auto;
    }

    .result-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .app-title {
        font-size: 1.8rem;
    }

    .app-subtitle {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .empty-state h3 {
        font-size: 1.3rem;
    }

    .empty-state p {
        font-size: 1rem;
    }

    .loading-state h3 {
        font-size: 1.3rem;
    }

    .error-state h3 {
        font-size: 1.3rem;
    }

    .result-header h3 {
        font-size: 1.2rem;
    }

    .text-content {
        font-size: 0.9rem;
    }

    .detail-item {
        font-size: 0.85rem;
    }

    .detail-item i {
        font-size: 0.8rem;
    }
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Focus rings for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Theme Switcher Styles */
.theme-switch-container {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.theme-switch-container:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-switch-container:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-switch-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.theme-switch-wrapper {
    position: relative;
    width: 50px;
    height: 26px;
}

/* Hide the actual checkbox visually but keep it accessible */
.theme-toggle {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
    margin: 0;
}

.theme-switch-track {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--switch-track);
    border-radius: 34px;
    transition: var(--transition);
    pointer-events: none;
    z-index: 1;
}

.theme-switch-thumb {
    position: absolute;
    top: 2px;
    left: -4px;
    width: 22px;
    height: 22px;
    background-color: var(--switch-thumb);
    border-radius: 50%;
    transition: var(--transition);
    z-index: 2;
}

/* When checkbox is checked - use parent wrapper styling */
.theme-switch-wrapper input:checked + .theme-switch-track {
    background-color: var(--primary-color);
}

.theme-switch-wrapper input:checked + .theme-switch-track .theme-switch-thumb {
    transform: translateX(16px);
}

/* Accordion for transcription parameters */
.transcription-parameters {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    margin-bottom: 20px;
}

.transcription-parameters .parameters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background-color: var(--background-dark);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.transcription-parameters .parameters-header:hover {
    background-color: rgba(37, 99, 235, 0.03);
}

.transcription-parameters .parameters-header h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    color: var(--primary-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.toggle-btn:hover {
    background-color: rgba(74, 144, 216, 0.08);
    color: var(--primary-color);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.transcription-parameters[data-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.transcription-parameters .parameters-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    padding: 0 20px;
}

.transcription-parameters[data-expanded="true"] .parameters-content {
    padding: 20px;
    max-height: 2000px;
}

.transcription-parameters .form-grid {
    gap: 20px;
    margin-bottom: 20px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-buttons .submit-button {
    flex: 1;
    max-width: 400px;
    margin: 0 auto;
}