/**
 * TLOGic Workspace Navigation - Phase 1
 * New top navigation with workspaces (Home, Analysis, AI Tools, Testing)
 * Preserves existing page structure within workspaces
 */

:root {
    --workspace-nav-height: 52px;
    --secondary-nav-height: 42px;
    --redlist-red: #be302a;
    --redlist-red-dark: #9a2621;
    --redlist-red-light: #e8a5a2;
    --redlist-gray: #999999;
}

/* ===== WORKSPACE TOP NAVIGATION ===== */
.workspace-top-nav {
    height: var(--workspace-nav-height);
    background: linear-gradient(135deg, var(--redlist-red) 0%, var(--redlist-red-dark) 100%);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.workspace-top-nav .brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1.5rem;
    white-space: nowrap;
}

.workspace-top-nav .brand:hover {
    color: white;
    text-decoration: none;
}

.workspace-top-nav .brand img {
    height: 26px;
}

/* Workspace tabs in top nav */
.workspace-tabs {
    display: flex;
    gap: 0.25rem;
    height: 100%;
    align-items: flex-end;
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.workspace-tabs::-webkit-scrollbar {
    display: none;
}

.workspace-tab {
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    background: rgba(255,255,255,0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}

.workspace-tab:hover {
    color: white;
    background: rgba(255,255,255,0.2);
    text-decoration: none;
}

.workspace-tab.active {
    color: var(--redlist-red);
    background: #f8f9fa;
    font-weight: 600;
}

.workspace-tab .badge {
    font-size: 0.6rem;
    padding: 0.15em 0.4em;
    vertical-align: middle;
}

.workspace-tab i {
    font-size: 0.9rem;
}

/* Right side of workspace nav */
.workspace-nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding-left: 1rem;
}

/* Trial badge styling in workspace nav */
.workspace-nav-right #trial-badge .badge {
    font-size: 0.75rem;
}

/* User menu */
.workspace-nav-right #user-button {
    display: flex;
    align-items: center;
}

/* Help icon */
.workspace-nav-right .help-link {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    padding: 0.25rem;
}

.workspace-nav-right .help-link:hover {
    color: white;
}

/* Settings icon */
.workspace-nav-right .settings-link {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    padding: 0.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.workspace-nav-right .settings-link:hover {
    color: white;
}

/* ===== WORKSPACE CONTENT AREAS ===== */
.workspace-content {
    display: none;
    margin-top: var(--workspace-nav-height);
    min-height: calc(100vh - var(--workspace-nav-height));
}

.workspace-content.active {
    display: block;
}

/* When showing the analysis workspace, offset for the existing nav-navbar */
.workspace-content#workspace-analysis.active {
    /* The existing nav-navbar will show inside this workspace */
}

/* ===== HOME WORKSPACE (QUICK ACTIONS HUB) ===== */
.quick-actions-hub {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - var(--workspace-nav-height));
    background: #f8f9fa;
}

.hub-header {
    margin-bottom: 2rem;
    text-align: center;
}

.hub-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.hub-header p {
    color: var(--redlist-gray);
    margin: 0;
    font-size: 1rem;
}

/* Action cards grid */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: var(--redlist-red);
    text-decoration: none;
    color: inherit;
}

.action-card .icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.action-card.primary .icon-wrapper {
    background: linear-gradient(135deg, var(--redlist-red), var(--redlist-red-dark));
    color: white;
}

.action-card.ai .icon-wrapper {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.action-card.testing .icon-wrapper {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.action-card.future .icon-wrapper {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
}

.action-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.action-card p {
    font-size: 0.875rem;
    color: var(--redlist-gray);
    margin: 0;
    line-height: 1.5;
}

.action-card .badge {
    font-size: 0.65rem;
    font-weight: 500;
    vertical-align: middle;
}

/* Recent Files Section */
.recent-files-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 1rem;
}

.recent-files-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
}

.recent-file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.recent-file-item:hover {
    background: #f8f9fa;
    text-decoration: none;
    color: inherit;
}

.recent-file-item .file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: var(--redlist-red);
}

.recent-file-item .file-info {
    flex: 1;
    min-width: 0;
}

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

.recent-file-item .file-meta {
    font-size: 0.8rem;
    color: var(--redlist-gray);
}

.recent-files-empty {
    text-align: center;
    padding: 2rem;
    color: var(--redlist-gray);
}

.recent-files-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* ===== ANALYSIS WORKSPACE ===== */
/* The analysis workspace contains the existing app structure */
#workspace-analysis .existing-app-content {
    /* This wrapper holds the existing primary-navbar, nav-navbar, and app-layout */
}

/* Adjust existing navbar positions when in workspace mode */
.workspace-mode .primary-navbar {
    top: var(--workspace-nav-height);
}

.workspace-mode .nav-navbar {
    top: calc(var(--workspace-nav-height) + 56px); /* workspace nav + primary nav */
}

.workspace-mode .main-content {
    padding-top: 0 !important; /* Reset - app-layout handles its own margin */
}

/* Adjust app-container padding to account for workspace nav */
.workspace-mode .app-container {
    padding-top: calc(var(--workspace-nav-height) + var(--navbar-height) + var(--subnav-height)) !important;
}

/* Adjust app-layout margin to account for workspace nav */
.workspace-mode .app-layout {
    margin-top: calc(var(--workspace-nav-height) + var(--navbar-height) + var(--subnav-height) - 1px) !important;
    height: calc(100vh - var(--workspace-nav-height) - var(--navbar-height) - var(--subnav-height) + 1px) !important;
}

/* Remove any extra spacing from workspace content */
.workspace-mode #workspace-analysis {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.workspace-mode #mainContent {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.workspace-mode .upload-page {
    padding-top: var(--workspace-nav-height);
}

/* Hide original nav-navbar user controls when in workspace mode (they're in workspace nav) */
.workspace-mode .nav-navbar-right {
    display: none;
}

/* ===== AI TOOLS WORKSPACE ===== */
#workspace-ai-tools {
    background: #f8f9fa;
}

/* ===== TESTING WORKSPACE ===== */
#workspace-testing {
    background: #f8f9fa;
}

/* ===== LOAD FILE PROMPT ===== */
.load-file-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    margin: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.load-file-prompt .icon {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.load-file-prompt h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.load-file-prompt p {
    color: var(--redlist-gray);
    margin-bottom: 1.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .workspace-tabs {
        gap: 0.125rem;
    }

    .workspace-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .workspace-tab span {
        display: none;
    }

    .workspace-tab i {
        font-size: 1rem;
    }

}

@media (max-width: 768px) {
    .action-cards {
        grid-template-columns: 1fr;
    }

    .quick-actions-hub {
        padding: 1rem;
    }

    .hub-header h1 {
        font-size: 1.5rem;
    }
}

/* ===== BUTTON STYLES ===== */
.btn-redlist {
    background: var(--redlist-red);
    border-color: var(--redlist-red);
    color: white;
}

.btn-redlist:hover {
    background: var(--redlist-red-dark);
    border-color: var(--redlist-red-dark);
    color: white;
}

/* ===== FILE UPLOAD MODAL FOR HUB ===== */
.hub-file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f9fafb;
    transition: all 0.2s;
    cursor: pointer;
}

.hub-file-drop-zone:hover,
.hub-file-drop-zone.dragover {
    border-color: var(--redlist-red);
    background: #fef2f2;
}

.hub-file-drop-zone .upload-icon {
    font-size: 3rem;
    color: var(--redlist-gray);
    margin-bottom: 1rem;
}

.hub-file-drop-zone.dragover .upload-icon {
    color: var(--redlist-red);
}

/* ===== WORKSPACE SECONDARY NAVIGATION ===== */
.workspace-secondary-nav {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    height: 42px;
}

.secondary-tabs {
    display: flex;
    gap: 0.5rem;
    height: 100%;
}

.secondary-tab {
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.secondary-tab:hover {
    color: var(--redlist-red);
}

.secondary-tab.active {
    color: var(--redlist-red);
    border-bottom-color: var(--redlist-red);
}

/* ===== AI TOOLS WORKSPACE ===== */
#workspace-ai-tools .ai-tools-tab-content {
    display: none;
    min-height: calc(100vh - var(--workspace-nav-height) - 42px);
    background: #f8f9fa;
}

#workspace-ai-tools .ai-tools-tab-content.active {
    display: block;
}

.ai-tools-playground-wrapper {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.ai-playground-container-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ===== TRANSITIONS ===== */
.workspace-content {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== HIDE ELEMENTS IN NON-WORKSPACE MODE ===== */
/* When not in workspace mode, hide workspace nav */
body:not(.workspace-mode) .workspace-top-nav {
    display: none;
}

body:not(.workspace-mode) .workspace-content {
    display: none;
}

/* In workspace mode, the upload overlay behavior changes */
/* When in analysis workspace, show upload overlay if no file is loaded */
.workspace-mode #workspace-analysis #uploadPageOverlay {
    /* Let the existing visibility logic control this */
}

/* Adjust upload overlay position for workspace nav */
.workspace-mode #uploadPageOverlay {
    padding-top: var(--workspace-nav-height);
}

/* When file is loaded, the existing code hides uploadPageOverlay and shows mainContent */
/* We just need to ensure proper positioning */

.workspace-mode #mainContent {
    /* mainContent already handles its own display logic */
}

/* ===== TESTING WORKSPACE ===== */
#workspace-testing .testing-tab-content {
    display: none;
    min-height: calc(100vh - var(--workspace-nav-height) - 42px);
    background: #f8f9fa;
}

#workspace-testing .testing-tab-content.active {
    display: block;
}

.testing-content-wrapper {
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.testing-header {
    margin-bottom: 1.5rem;
}

.testing-header h4 {
    margin-bottom: 0.25rem;
    color: #333;
}

/* Testing Steps */
.testing-step {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
    overflow: hidden;
}

.testing-step .step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.testing-step .step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--redlist-red);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.testing-step .step-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.testing-step .step-content {
    padding: 1.25rem;
}

/* ======================================
   Load Test Step Navigation
   ====================================== */

.lt-wrapper {
    max-width: 1100px;
}

.lt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.lt-header #lt-compare-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Step Nav Bar */
.lt-step-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0;
    margin-bottom: 1rem;
    gap: 0;
}

.lt-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    position: relative;
}

.lt-step-item:hover {
    opacity: 0.85;
}

.lt-step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #d1d5db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    transition: background 0.2s, transform 0.2s;
}

.lt-step-item.active .lt-step-number {
    background: var(--redlist-red, #be302a);
    transform: scale(1.1);
}

.lt-step-item.completed .lt-step-number {
    background: #4CAF50;
}

.lt-step-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #9ca3af;
    transition: color 0.2s;
    white-space: nowrap;
}

.lt-step-item.active .lt-step-label {
    color: #333;
}

.lt-step-item.completed .lt-step-label {
    color: #4CAF50;
}

.lt-step-connector {
    flex: 1;
    max-width: 80px;
    height: 2px;
    background: #d1d5db;
    margin: 0 0.25rem;
    margin-bottom: 1.5rem; /* align with center of circle */
}

/* Step Content Panels */
.lt-step-content {
    display: none;
}

.lt-step-content.active {
    display: block;
}

/* Tabbed wizard step content (loadtest-tabbed-module) */
.ltt-step-content {
    display: none;
}

.ltt-step-content.active {
    display: block;
}

/* Step 2: Run Test Panel */
.lt-run-test-panel {
    text-align: center;
    padding: 2.5rem 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.lt-run-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.lt-run-instructions {
    display: flex;
    gap: 1.5rem;
    text-align: left;
    justify-content: center;
}

.lt-run-cmd-block {
    flex: 1;
    max-width: 320px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
}

.lt-run-cmd-block h6 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.lt-run-cmd-block code {
    display: block;
    background: #1a1a2e;
    color: #4ade80;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    word-break: break-all;
}

.lt-run-tips {
    text-align: left;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.lt-run-tips h6 {
    margin-bottom: 0.5rem;
}

.lt-run-tips ul {
    padding-left: 1.25rem;
}

.lt-run-tips li {
    margin-bottom: 0.35rem;
}

/* Step 3: Results Empty State */
.lt-results-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.lt-results-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f0f9ff;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

/* Dark mode support */
[data-bs-theme="dark"] .lt-step-number {
    background: #4b5563;
}

[data-bs-theme="dark"] .lt-step-item.active .lt-step-number {
    background: var(--redlist-red, #be302a);
}

[data-bs-theme="dark"] .lt-step-connector {
    background: #4b5563;
}

[data-bs-theme="dark"] .lt-step-label {
    color: #6b7280;
}

[data-bs-theme="dark"] .lt-step-item.active .lt-step-label {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .lt-run-icon {
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

[data-bs-theme="dark"] .lt-run-cmd-block {
    background: #1e293b;
    border-color: #374151;
}

[data-bs-theme="dark"] .lt-run-tips {
    background: #1e293b;
    border-color: #92400e;
}

[data-bs-theme="dark"] .lt-results-empty-icon {
    background: #1e3a5f;
    color: #60a5fa;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s;
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--redlist-red);
    background: #fef2f2;
}

.file-drop-zone .upload-icon {
    font-size: 2.5rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.file-drop-zone.dragover .upload-icon {
    color: var(--redlist-red);
}

.file-drop-zone h5 {
    margin-bottom: 0.25rem;
    color: #333;
}

/* File List */
.file-item {
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.file-item:last-child {
    margin-bottom: 0;
}

/* Config Section */
.config-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.config-section h6 {
    margin-bottom: 0.75rem;
    color: #333;
    font-size: 0.875rem;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.export-buttons .btn-lg {
    min-width: 200px;
}

.export-buttons .btn-lg small {
    opacity: 0.8;
    font-weight: normal;
}

/* RIO Tab Styles */
#testing-rio .testing-content-wrapper {
    max-width: 1100px;
}

#testing-rio .config-section {
    background: white;
    border: 1px solid #e5e7eb;
}

#testing-rio .step-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Non-TLOG Placeholder */
#testing-non-tlog .load-file-prompt {
    min-height: calc(100vh - var(--workspace-nav-height) - 150px);
}

/* Responsive */
@media (max-width: 768px) {
    .testing-content-wrapper {
        padding: 1rem;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-buttons .btn-lg {
        width: 100%;
    }
}

/* ===== FILE MANAGER (HOME HUB) ===== */
.file-manager-hub {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - var(--workspace-nav-height));
    background: #f8f9fa;
}

.file-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.file-manager-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* File Drop Area */
.file-manager-drop-area {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.file-manager-drop-area:hover,
.file-manager-drop-area.dragover {
    border-color: var(--redlist-red);
    background: #fef2f2;
}

.file-manager-drop-area.dragover {
    transform: scale(1.01);
}

.file-manager-drop-area .drop-icon {
    font-size: 2.5rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.file-manager-drop-area.dragover .drop-icon {
    color: var(--redlist-red);
}

.file-manager-drop-area h4 {
    margin-bottom: 0.25rem;
    color: #333;
}

.file-manager-drop-area p {
    color: var(--redlist-gray);
    margin-bottom: 1rem;
}

/* File List Container */
.file-manager-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.file-manager-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.file-manager-list-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.file-manager-list-header .file-count {
    color: var(--redlist-gray);
    font-size: 0.875rem;
}

/* Individual File Row */
.file-manager-row {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.file-manager-row:last-child {
    border-bottom: none;
}

.file-manager-row:hover {
    background: #f8fafc;
}

.file-manager-row.selected {
    background: #fef2f2;
}

.file-manager-row .file-checkbox {
    margin-right: 1rem;
}

.file-manager-row .file-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--redlist-red);
}

.file-manager-row .file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--redlist-red), var(--redlist-red-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1rem;
}

.file-manager-row .file-info {
    flex: 1;
    min-width: 0;
}

.file-manager-row .file-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-manager-row .file-meta {
    font-size: 0.8rem;
    color: var(--redlist-gray);
    display: flex;
    gap: 1rem;
    margin-top: 0.125rem;
}

.file-manager-row .file-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.file-manager-row .file-actions .btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.file-manager-row .primary-badge {
    background: var(--redlist-red);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 500;
}

/* File Manager Empty State */
.file-manager-empty {
    padding: 3rem;
    text-align: center;
    color: var(--redlist-gray);
}

.file-manager-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Selection Actions Bar */
.file-manager-selection-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.file-manager-selection-bar .selection-info {
    font-size: 0.9rem;
    color: #333;
}

.file-manager-selection-bar .selection-info strong {
    color: var(--redlist-red);
}

.file-manager-selection-bar .selection-actions {
    display: flex;
    gap: 0.75rem;
}

/* Action Cards in Hub */
.hub-action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.hub-action-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
}

.hub-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--redlist-red);
    text-decoration: none;
    color: inherit;
}

.hub-action-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hub-action-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.hub-action-card .action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.25rem;
}

.hub-action-card.analyze .action-icon {
    background: linear-gradient(135deg, var(--redlist-red), var(--redlist-red-dark));
    color: white;
}

.hub-action-card.ai .action-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.hub-action-card.testing .action-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.hub-action-card.future .action-icon {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
}

.hub-action-card.export .action-icon {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.hub-action-card.reports .action-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.hub-action-card h5 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
}

.hub-action-card p {
    font-size: 0.75rem;
    color: var(--redlist-gray);
    margin: 0;
    line-height: 1.4;
}

/* File Upload Modal */
.file-upload-modal .modal-body {
    padding: 2rem;
}

.file-upload-modal .upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload-modal .upload-zone:hover,
.file-upload-modal .upload-zone.dragover {
    border-color: var(--redlist-red);
    background: #fef2f2;
}

.file-upload-modal .upload-zone .upload-icon {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.file-upload-modal .upload-zone.dragover .upload-icon {
    color: var(--redlist-red);
}

.file-upload-modal .upload-progress {
    margin-top: 1.5rem;
}

/* Context Toggle */
.context-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.context-toggle .toggle-option {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.context-toggle .toggle-option:hover {
    color: #333;
}

.context-toggle .toggle-option.active {
    background: white;
    color: var(--redlist-red);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Context Info Bar */
.context-info-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.context-info-bar i {
    color: var(--redlist-red);
}

.context-info-bar .context-files {
    color: #333;
    font-weight: 500;
}

.context-info-bar .context-change {
    margin-left: auto;
    color: var(--redlist-red);
    text-decoration: none;
    font-size: 0.8rem;
}

.context-info-bar .context-change:hover {
    text-decoration: underline;
}

/* Data Preview Section */
.data-preview-section {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-top: 1rem;
}

.data-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.data-preview-header h6 {
    margin: 0;
    font-size: 0.875rem;
    color: #333;
}

.data-preview-content {
    max-height: 300px;
    overflow: auto;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 0 0 8px 8px;
}

.data-preview-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== DYNAMIC ANALYSIS TABS ===== */
#dynamic-analysis-tabs {
    display: contents; /* Let children flow naturally in flex container */
}

.workspace-tab.analysis-tab {
    position: relative;
    padding-right: 1.75rem; /* Make room for close button */
}

.workspace-tab.analysis-tab .tab-close {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.15s;
}

.workspace-tab.analysis-tab:hover .tab-close {
    opacity: 1;
}

.workspace-tab.analysis-tab .tab-close:hover {
    background: rgba(0,0,0,0.15);
    opacity: 1;
}

.workspace-tab.analysis-tab.active .tab-close {
    color: var(--redlist-red);
}

.workspace-tab.analysis-tab.active .tab-close:hover {
    background: rgba(190, 48, 42, 0.15);
}

/* Limit text width in analysis tabs */
.workspace-tab.analysis-tab span:not(.tab-close) {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive for File Manager */
@media (max-width: 768px) {
    .file-manager-hub {
        padding: 1rem;
    }

    .file-manager-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .file-manager-row {
        flex-wrap: wrap;
    }

    .file-manager-row .file-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 0.75rem;
        padding-left: calc(18px + 1rem + 40px + 1rem);
    }

    .file-manager-selection-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .file-manager-selection-bar .selection-actions {
        width: 100%;
        justify-content: center;
    }

    .hub-action-cards {
        grid-template-columns: 1fr 1fr;
    }
}
