:root {
    --bg-main: #0b0813; /* Deep Purple Black */
    --bg-panel: #130f22;
    --bg-card: #1a152e;
    --card-border: rgba(139, 92, 246, 0.15); /* Indigo tint */
    --card-border-hover: rgba(139, 92, 246, 0.4);
    --primary: #a78bfa; /* Pastel Violet */
    --primary-hover: #c084fc; /* Lavender */
    --primary-glow: rgba(167, 139, 250, 0.35);
    --danger: #f43f5e;
    --danger-hover: #e11d48;
    --success: #10b981;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--card-border);
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.6);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 0 0 15px var(--primary-glow);
}

.logo i {
    font-size: 1.5rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary);
    color: #0c0817;
    box-shadow: 0 4px 15px var(--primary-glow);
    font-weight: 700;
}

/* Contextual Settings Panels */
.settings-panel {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.settings-panel.active {
    display: flex;
}

.control-group h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.format-radio:hover {
    border-color: var(--primary);
    background: rgba(167, 139, 250, 0.05);
}

.format-radio input[type="radio"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    outline: none;
    transition: 0.2s;
}

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

.format-radio input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.format-radio span {
    font-size: 0.9rem;
    font-weight: 500;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Sliders */
.slider-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.slider-header span {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* Select input */
.select-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

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

.btn-primary {
    background: var(--primary);
    color: #0c0817;
    box-shadow: 0 4px 15px var(--primary-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger-link {
    background: transparent;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-danger-link:hover {
    color: var(--danger-hover);
    text-decoration: underline;
}

/* Main Workspace Styling */
.main-content {
    flex: 1;
    background: #07050d;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow: hidden;
    position: relative;
}

.workspace-area {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    gap: 20px;
}

.workspace-area.active {
    display: flex;
}

/* Dropzone */
.dropzone {
    flex: 1;
    max-height: 400px;
    border: 2px dashed rgba(167, 139, 250, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.01);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(167, 139, 250, 0.03);
    box-shadow: inset 0 0 30px rgba(167, 139, 250, 0.05);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: none;
}

.upload-icon {
    font-size: 4rem;
    color: rgba(167, 139, 250, 0.3);
    transition: 0.3s;
}

.dropzone:hover .upload-icon, .dropzone.dragover .upload-icon {
    color: var(--primary);
    transform: translateY(-5px) scale(1.05);
}

.dropzone-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.dropzone-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.5;
}

/* The browse label must receive pointer events even though parent is none */
.dropzone-content label.btn,
.dropzone-content .btn {
    pointer-events: auto;
    margin-top: 10px;
}

/* File Queue */
.file-queue-container {
    flex: 1.2;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
}

.queue-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-queue {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom Scrollbars */
.file-queue::-webkit-scrollbar, .editor-textarea::-webkit-scrollbar {
    width: 6px;
}
.file-queue::-webkit-scrollbar-track, .editor-textarea::-webkit-scrollbar-track {
    background: transparent;
}
.file-queue::-webkit-scrollbar-thumb, .editor-textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
.file-queue::-webkit-scrollbar-thumb:hover, .editor-textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(167, 139, 250, 0.3);
}

/* File Item UI */
.file-item {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: var(--card-border-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pending { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.status-converting { background: rgba(167, 139, 250, 0.15); color: var(--primary); }
.status-completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-failed { background: rgba(244, 63, 94, 0.15); color: var(--danger); }

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

.btn-item-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-item-action:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-item-download {
    color: var(--success);
}
.btn-item-download:hover {
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
}

/* Document / Editor Layout */
.editor-grid {
    display: flex;
    flex: 1;
    gap: 20px;
    height: 100%;
}

.editor-pane {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    font-size: 0.9rem;
}

.pane-header-actions {
    display: flex;
    gap: 8px;
}

.btn-pane-action {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-pane-action:hover:not(:disabled) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.btn-pane-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.editor-textarea {
    flex: 1;
    background: #0a0812;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 20px;
    resize: none;
    outline: none;
    line-height: 1.6;
}

.editor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.output-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0812;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.status-converting i {
    animation: pulse 1s infinite alternate;
}
