/* ==========================================================================
   Design System & Variable Declarations
   ========================================================================== */
:root {
    --bg-base: #0a0d16;
    --bg-glass: rgba(22, 28, 45, 0.45);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(147, 51, 234, 0.5); /* Violet-500 */
    
    --text-primary: #f3f4f6; /* Gray-100 */
    --text-secondary: #9ca3af; /* Gray-400 */
    --text-muted: #6b7280; /* Gray-500 */
    
    --color-violet: #8b5cf6; /* Violet-500 */
    --color-violet-glow: rgba(139, 92, 246, 0.3);
    --color-emerald: #10b981; /* Emerald-500 */
    --color-rose: #f43f5e; /* Rose-500 */
    --color-slate-800: #1e293b;
    
    --font-sans: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Glowing background blur elements */
.glass-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.app-container {
    width: 100%;
    max-width: 1560px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
}

/* ==========================================================================
   Typography & Headers
   ========================================================================== */
h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.main-header {
    position: relative;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 28px;
    color: var(--color-violet);
    filter: drop-shadow(0 0 8px var(--color-violet));
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

/* Session Badge */
.session-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 99px;
    border: 1px solid var(--border-glass);
    font-size: 13px;
    font-weight: 500;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 4px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    color: var(--color-rose);
    background: rgba(244, 63, 94, 0.15);
}


.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.red {
    background-color: var(--color-rose);
    box-shadow: 0 0 8px var(--color-rose);
}

.status-indicator.green {
    background-color: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
}

/* ==========================================================================
   Layout Grid
   ========================================================================== */
.workspace-grid {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0; /* Important for flex/grid nested scroll */
    margin-bottom: 12px;
    position: relative;
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
}

.flex-row {
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.flex-1 { flex: 1; min-width: 0; }
.flex-2 { flex: 2; min-width: 0; }

.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.margin-top-lg { margin-top: 24px; }

/* ==========================================================================
   Glassmorphic Cards
   ========================================================================== */
.glass-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-icon {
    font-size: 18px;
    color: var(--text-secondary);
}

.card-header h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.color-violet {
    color: var(--color-violet);
    filter: drop-shadow(0 0 4px var(--color-violet));
}

/* ==========================================================================
   Header Toggle Button & Collapsible Card
   ========================================================================== */
.header-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    transition: var(--transition-smooth);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.header-action-btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state rules */
.auth-card.collapsed .auth-card-body {
    display: none !important;
}

.auth-card.collapsed .auth-card-summary {
    display: flex !important;
}

.auth-card.collapsed #auth-toggle-icon {
    transform: rotate(180deg);
}

/* Summary state styling */
.auth-card-summary {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
}

.summary-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.summary-icon.success {
    color: var(--color-emerald);
    text-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.summary-icon.warning {
    color: #f59e0b;
    text-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.summary-icon.error {
    color: var(--color-rose);
    text-shadow: 0 0 6px rgba(244, 63, 94, 0.4);
}

.edit-settings-btn {
    margin-top: 4px;
    font-size: 13px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Flexible Left Panel (Ingestion Panel Layout)
   ========================================================================== */
.ingest-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ingest-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0; /* Override margin-bottom to maximize space */
}

.ingest-tabs-content {
    flex: 1;
    min-height: 0;
}

.ingest-tab-pane {
    height: 100%;
}

.ingest-tab-pane.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* File Upload drag-drop area expansion */
#ingest-upload.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.upload-dropzone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Raw Text area expansion */
#ingest-raw.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
}

#ingest-raw .form-group:nth-child(2) {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 12px;
}

#raw-recipe {
    flex: 1;
    min-height: 120px;
    resize: none;
}


/* ==========================================================================
   Form Fields & Inputs
   ========================================================================== */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition-smooth);
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-violet);
    box-shadow: 0 0 0 2px var(--color-violet-glow);
    background: rgba(0, 0, 0, 0.4);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 40px;
}

textarea {
    resize: vertical;
}

/* ==========================================================================
   Tabs Systems (Authentication & Ingest)
   ========================================================================== */
.tabs-container, .ingest-tabs {
    margin-bottom: 20px;
}

.tabs-header, .ingest-tabs-header {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}

.tab-btn, .ingest-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active, .ingest-tab-btn.active {
    background: var(--color-slate-800);
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.tab-pane, .ingest-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.active, .ingest-tab-pane.active {
    display: block;
}

/* ==========================================================================
   Buttons UI
   ========================================================================== */
.action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.primary-btn {
    background: linear-gradient(135deg, var(--color-violet) 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
}

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

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

.success-btn {
    background: var(--color-emerald);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    width: auto;
    font-size: 13px;
    padding: 8px 16px;
}

.success-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.action-btn:disabled {
    background: var(--color-slate-800) !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
    border-color: transparent !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ==========================================================================
   File Drag & Drop Zone
   ========================================================================== */
.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--color-violet);
    background: rgba(139, 92, 246, 0.03);
}

.cloud-icon {
    font-size: 32px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-dropzone h3 {
    font-size: 14px;
    color: var(--text-primary);
}

.upload-dropzone p {
    font-size: 11px;
    color: var(--text-muted);
}

.select-file-btn {
    width: auto;
    font-size: 12px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    margin-top: 8px;
}

/* ==========================================================================
   Recipe Workspace & Editor
   ========================================================================== */
.editor-panel {
    flex: 1;
    min-height: 0; /* Nested scroll triggers */
    transition: var(--transition-smooth);
}

.editor-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 24px;
}

.scrollable-content {
    overflow-y: auto;
    padding-right: 12px;
}

/* Scrollbars styling */
.scrollable-content::-webkit-scrollbar,
.console-box::-webkit-scrollbar {
    width: 6px;
}

.scrollable-content::-webkit-scrollbar-track,
.console-box::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-content::-webkit-scrollbar-thumb,
.console-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

.scrollable-content::-webkit-scrollbar-thumb:hover,
.console-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.editor-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 12px;
}

.editor-section-header h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.add-item-btn {
    background: transparent;
    border: none;
    color: var(--color-violet);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

.add-item-btn:hover {
    color: white;
}

/* Lists and Items */
.editor-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-list-item {
    display: flex;
    gap: 8px;
    align-items: center;
    animation: slideIn 0.2s ease-out;
}

.step-list-item {
    align-items: flex-start;
}

.step-num {
    background: rgba(255, 255, 255, 0.08);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-secondary);
    margin-top: 8px;
    flex-shrink: 0;
}

.delete-item-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 14px;
    transition: var(--transition-smooth);
    border-radius: 6px;
}

.delete-item-btn:hover {
    color: var(--color-rose);
    background: rgba(244, 63, 94, 0.1);
}

/* ==========================================================================
   Console Log Panel
   ========================================================================== */

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-section h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.console-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.6;
    height: 180px;
    overflow-y: auto;
}

.console-box p {
    margin-bottom: 8px;
    word-break: break-all;
}

.console-box .sys-msg { color: #38bdf8; } /* Light blue */
.console-box .info-msg { color: #facc15; } /* Yellow */
.console-box .success-msg { color: var(--color-emerald); }
.console-box .error-msg { color: var(--color-rose); }

/* Success Box Panel */
.success-box-section {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.check-large {
    font-size: 36px;
    color: var(--color-emerald);
    margin-bottom: 12px;
}

.success-banner h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.success-banner p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.link-btn {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--color-emerald);
    color: white;
}

.link-btn:hover {
    background: var(--color-emerald);
    transform: translateY(-2px);
}

/* ==========================================================================
   Toasts Notifications System
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: rgba(22, 28, 45, 0.95);
    border-left: 4px solid var(--color-violet);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    border-top: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    min-width: 300px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--color-emerald); }
.toast.error { border-left-color: var(--color-rose); }
.toast.info { border-left-color: #38bdf8; }

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 13, 22, 0.7);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-loader {
    background: rgba(22, 28, 45, 0.7);
    border: 1px solid var(--border-glass);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(139, 92, 246, 0.1);
    border-left-color: var(--color-violet);
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spin 1s linear infinite;
}

.glass-loader h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.glass-loader p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

/* ==========================================================================
   Recipe Image Workspace
   ========================================================================== */
.recipe-image-workspace {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.image-preview-container {
    position: relative;
    height: 220px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.placeholder-icon {
    font-size: 36px;
    color: var(--text-muted);
}

.image-placeholder span {
    font-size: 11px;
    max-width: 200px;
    line-height: 1.4;
}

.image-controls-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.image-controls-row input {
    flex: 1;
}

.image-upload-btn-wrap {
    flex-shrink: 0;
}

#upload-image-file-btn {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
}

/* ==========================================================================
   Loader Overlay Debug Console
   ========================================================================== */
.loader-debug-console {
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    max-width: 340px;
    width: 100%;
    box-sizing: border-box;
}

.loader-debug-title {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.loader-debug-logs {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    color: #e2e8f0;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 4px;
}

.loader-debug-line {
    word-break: break-all;
    line-height: 1.4;
}

.loader-debug-line.success { color: var(--color-emerald); }
.loader-debug-line.error { color: var(--color-rose); }
.loader-debug-line.info { color: #38bdf8; }
.loader-debug-line.warn { color: #fbbf24; }
/* ==========================================================================
   Workspace Tabs Navigation & Layout
   ========================================================================== */
.workspace-tabs-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.workspace-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.workspace-tab-btn.active {
    background: var(--color-slate-800);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.workspace-tab-pane {
    display: none;
    height: 100%;
    animation: fadeIn 0.3s ease-out;
}

.workspace-tab-pane.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ==========================================================================
   Conversion History Tab Styles
   ========================================================================== */
.history-tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 16px;
}

.history-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    gap: 16px;
}

.history-filters {
    display: flex;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 3px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--color-slate-800);
    color: white;
}

.danger-hover:hover {
    background: rgba(244, 63, 94, 0.1) !important;
    border-color: var(--color-rose) !important;
    color: var(--color-rose) !important;
}

.history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 8px;
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: var(--text-muted);
    text-align: center;
    gap: 8px;
}

.history-empty-state .placeholder-icon {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.history-empty-state h3 {
    color: var(--text-secondary);
    font-size: 15px;
}

.history-empty-state p {
    font-size: 12px;
    max-width: 320px;
}

.history-item-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: var(--transition-smooth);
    animation: slideIn 0.2s ease-out;
    border-left: 4px solid var(--color-slate-800);
}

.history-item-card:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Status borders */
.history-item-card.status-converted { border-left-color: #38bdf8; }
.history-item-card.status-uploading { border-left-color: #a855f7; }
.history-item-card.status-success { border-left-color: var(--color-emerald); }
.history-item-card.status-warning { border-left-color: #facc15; }
.history-item-card.status-failed { border-left-color: var(--color-rose); }

.history-img-wrap {
    width: 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.history-thumbnail {
    width: 100px;
    height: 82px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumbnail .no-img-icon {
    font-size: 24px;
    color: var(--text-muted);
}

.download-img-btn {
    font-size: 11px;
    color: #38bdf8;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(56, 189, 248, 0.1);
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.15);
    transition: var(--transition-smooth);
    width: 100%;
    font-weight: 500;
}

.download-img-btn:hover {
    background: #38bdf8;
    color: #000;
}

.history-details-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.history-details-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.history-meta-row {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.history-meta-row span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-origin-text {
    font-weight: 500;
    color: var(--text-secondary);
    word-break: break-all;
}

.history-status-msg {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: 4px;
    font-family: var(--font-sans);
    line-height: 1.4;
}

.history-badge {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-badge.converted { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2); }
.history-badge.uploading { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.2); }
.history-badge.success { background: rgba(16, 185, 129, 0.15); color: var(--color-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.history-badge.warning { background: rgba(250, 204, 21, 0.15); color: #fbbf24; border: 1px solid rgba(250, 204, 21, 0.2); }
.history-badge.failed { background: rgba(244, 63, 94, 0.15); color: var(--color-rose); border: 1px solid rgba(244, 63, 94, 0.2); }

.history-actions-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.history-actions-section .action-btn {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    width: auto;
}

/* ==========================================================================
   Logs Tab Styles
   ========================================================================== */
.logs-tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 16px;
}

.logs-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    gap: 16px;
}

.logs-terminal-wrapper {
    flex: 1;
    min-height: 0;
    background: rgba(5, 7, 12, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    display: flex;
}

.logs-terminal {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #e2e8f0;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    padding-right: 8px;
}

.log-entry {
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.01);
    padding-bottom: 4px;
}

.log-entry.sys { color: #38bdf8; }
.log-entry.info { color: #94a3b8; }
.log-entry.success { color: var(--color-emerald); }
.log-entry.warn { color: #fbbf24; }
.log-entry.error { color: var(--color-rose); }

/* ==========================================================================
   Instructions Tab Styles
   ========================================================================== */
.instructions-tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 16px;
}

.instructions-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    gap: 16px;
}

.instructions-editor-wrapper {
    flex: 1;
    min-height: 0;
    background: rgba(5, 7, 12, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    display: flex;
}

.instructions-editor-textarea {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    background: transparent;
    border: none;
    resize: none;
    outline: none;
    overflow-y: auto;
    padding-right: 8px;
}

/* ==========================================================================
   Header Dropdown & Discrete Options Styling
   ========================================================================== */
.badge-divider {
    color: var(--border-glass);
    margin: 0 4px;
    user-select: none;
}

.system-menu-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.system-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    margin-left: 2px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.system-menu-btn:hover {
    color: var(--color-violet);
    background: rgba(139, 92, 246, 0.15);
}

.system-dropdown-content {
    display: none;
    position: absolute;
    right: -10px;
    top: calc(100% + 14px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    width: 400px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(16px);
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.system-dropdown-content.show {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    text-align: left;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.dropdown-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.dropdown-item:hover i {
    color: var(--color-violet);
}

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

/* ==========================================================================
   Ingestion Drawer & settings dropdown extensions
   ========================================================================== */
.control-panel {
    width: 360px; /* Reduced from 460px */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-panel.collapsed {
    width: 0;
    margin-right: -24px;
    opacity: 0;
    pointer-events: none;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

.auth-card {
    display: flex;
    flex-direction: column;
}

.auth-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-card .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

/* Floating Expand Tab Button */
.drawer-expand-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--color-violet) 0%, #7c3aed 100%);
    border: 1px solid var(--border-glass);
    border-left: none;
    color: white;
    padding: 20px 8px;
    border-radius: 0 16px 16px 0;
    cursor: pointer;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-expand-btn:hover {
    padding-left: 14px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.6);
}

.drawer-expand-btn span {
    writing-mode: vertical-rl;
    text-transform: uppercase;
    white-space: nowrap;
}

.drawer-expand-btn i {
    font-size: 14px;
}

@keyframes slideInLeft {
    from {
        transform: translate(-100%, -50%);
        opacity: 0;
    }
    to {
        transform: translate(0, -50%);
        opacity: 1;
    }
}

/* ==========================================================================
   Local Auth & Profiles Integration
   ========================================================================== */
.local-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 99px;
    padding: 4px 12px;
    margin-right: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.local-profile-badge .profile-icon {
    font-size: 14px;
    color: var(--color-violet);
}

.local-logout-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.local-logout-btn:hover {
    color: var(--color-rose);
    transform: scale(1.1);
}

.local-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.local-auth-overlay.hidden {
    display: none !important;
}

.glass-bg-auth {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(22, 28, 45, 0.85) 0%, rgba(10, 13, 22, 0.98) 100%);
    backdrop-filter: blur(25px);
    z-index: -1;
}

.local-auth-card {
    background: rgba(22, 28, 45, 0.55);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    animation: zoomInAuth 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.local-auth-card .logo {
    justify-content: center;
    margin-bottom: 24px;
}

.local-auth-title {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.local-auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

.local-auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.local-auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
}

.local-auth-tab-btn.active {
    background: var(--color-slate-800);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@keyframes zoomInAuth {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
