/* Global Styles */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: white !important;
}

.navbar-brand i {
    font-size: 1.5rem;
    color: #fbbf24;
}

#model-status, #processing-status {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.875rem;
}

#model-status i, #processing-status i {
    font-size: 0.5rem;
    margin-right: 0.5rem;
}

/* Main Container */
.main-container {
    padding-top: 60px;
    height: calc(100vh - 60px);
    background: var(--bg-secondary);
    width: 100%;
    max-height: 100%;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
}

/* Sidebar */
.sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.sidebar-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Upload Section */
.upload-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    position: relative;
}

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

.upload-area.dragover {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File Info */
.file-info {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    gap: 1rem;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

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

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-remove:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

/* Settings Section */
.settings-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.settings-section .form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.settings-section .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.settings-section .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.form-text {
    font-size: 0.75rem;
    line-height: 1.4;
}

.form-text i {
    color: var(--primary-color);
}

/* Controls Section */
.controls-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-buttons .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.search-section .input-group {
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.search-section .form-control {
    border: 1px solid var(--border-color);
    border-right: none;
    font-size: 0.875rem;
}

.search-section .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: none;
}

.search-section .btn {
    border: 1px solid var(--border-color);
    border-left: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.search-section .btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* History Section */
.history-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.history-item.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.history-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    background: var(--bg-primary);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

.content-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.welcome-content {
    max-width: 600px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    color: white;
    font-size: 2rem;
    box-shadow: var(--shadow-lg);
}

.welcome-content h2 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-item i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.feature-item span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.loading-content {
    max-width: 500px;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    color: white;
    font-size: 2rem;
    box-shadow: var(--shadow-lg);
}

.loading-state h3 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.loading-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.progress-container {
    margin-top: 2rem;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Mindmap Container */
.mindmap-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: var(--bg-primary);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

/* Mindmap Header Styles */
.mindmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: fit-content;
    margin: 0 auto 1rem auto;
    min-width: 400px;
}

.mindmap-title h4 {
    margin: 0;
    color: #1e293b;
    font-weight: 600;
}

.mindmap-title small {
    color: #64748b;
    font-size: 0.875rem;
}

.mindmap-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.stat-item i {
    font-size: 0.75rem;
    color: #6366f1;
}

.mindmap-status {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    padding: 0.25rem 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.status-item i {
    font-size: 0.75rem;
}

.status-item.text-success {
    color: #059669;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.status-item.text-warning {
    color: #d97706;
    background: #fffbeb;
    border-color: #fed7aa;
}

.status-item.text-danger {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.status-item.text-info {
    color: #0891b2;
    background: #ecfeff;
    border-color: #a5f3fc;
}

.status-item.text-muted {
    color: #6b7280;
    background: #f9fafb;
    border-color: #d1d5db;
}

.mindmap-viewport {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.mindmap-viewport svg {
    width: 100%;
    height: 100%;
    display: block;
}

.mindmap-node {
    cursor: pointer;
    transition: none;
}

.mindmap-node:hover {
    /* Removed transform to prevent vibration */
}

.mindmap-node rect {
    transition: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.mindmap-node:hover rect {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
    stroke-width: 3;
}

.mindmap-node text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    fill: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    user-select: none;
    transition: all 0.2s ease;
}

.mindmap-link {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 2;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.mindmap-link:hover {
    stroke: #6366f1;
    stroke-width: 3;
    opacity: 1;
}

/* Expandable Node Styles */
.expand-indicator {
    transition: all 0.2s ease;
    opacity: 0.8;
}

.expand-indicator:hover {
    opacity: 1;
    /* Removed transform to prevent vibration */
}

.node-details {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    font-size: 13px;
    line-height: 1.5;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.node-details::-webkit-scrollbar {
    width: 6px;
}

.node-details::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.node-details::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.node-details::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chunk-content {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-left: 3px solid #6366f1;
    transition: all 0.2s ease;
}

.chunk-content:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(2px);
}

.chunk-content:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.chunk-content h6 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: 0.3px;
}

.chunk-content p {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
    font-style: italic;
}

.similarity-score {
    font-size: 11px;
    color: #6366f1;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.no-content {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    background: rgba(107, 114, 128, 0.05);
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

.no-content p {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
}

.error-content {
    text-align: center;
    padding: 20px;
    color: #dc2626;
    font-size: 12px;
    background: rgba(220, 38, 38, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.error-content p {
    margin: 0;
    line-height: 1.4;
}

/* Animation for expanding nodes */
.mindmap-node.expanded {
    /* Removed transform to prevent vibration - positioning handled by foreignObject */
}

/* Ensure expanded content doesn't overlap */
.mindmap-node foreignObject {
    pointer-events: auto;
}

/* Responsive adjustments for expanded content */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 80px;
        width: 100%;
        height: calc(100vh - 80px);
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .main-content {
        width: 100%;
    }

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

    .mindmap-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
        width: 90%;
        min-width: 300px;
        margin: 0 auto 1rem auto;
    }

    .mindmap-stats {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }

    .mindmap-status {
        width: 100%;
        justify-content: center;
        gap: 1rem;
    }

    .node-details {
        font-size: 11px;
        max-width: 250px;
    }
    
    .chunk-content h6 {
        font-size: 10px;
    }
    
    .chunk-content p {
        font-size: 10px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

/* Status Indicators */
.status-online {
    color: var(--success-color) !important;
}

.status-offline {
    color: var(--danger-color) !important;
}

.status-loading {
    color: var(--warning-color) !important;
} 

.welcome-status {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    backdrop-filter: blur(10px);
} 