/* Code Tree Styles */

.code-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

/* Container for Code Tree - Now full width */
.code-split-container {
    display: flex;
    flex: 1;
    padding: 10px;
    overflow: hidden;
}

/* Advanced Options - Always Visible */
.code-advanced-options-visible {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 12px;
}

.code-advanced-options-visible .advanced-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.code-advanced-options-visible .option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-advanced-options-visible .option-group label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #4a5568;
}

.code-advanced-options-visible .option-group input[type="checkbox"] {
    margin: 0;
}

/* Compact Header Layout */
.code-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    gap: 15px;
    min-height: 40px;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left {
    flex: 0 1 auto;
}

.header-center {
    flex: 0 0 auto;
}

.header-right {
    flex: 0 1 auto;
    justify-content: flex-end;
}

/* Compact Input Elements */
.path-input-compact {
    width: 150px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
}

.btn-compact {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-compact:hover {
    background: #f8f9fa;
    border-color: #94a3b8;
}

.btn-compact.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
    font-weight: 500;
}

.btn-compact.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-compact.btn-primary:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-compact.btn-primary.analyzing {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-color: #f59e0b;
    animation: pulse 1.5s infinite;
    position: relative;
}

.btn-compact.btn-primary.analyzing::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.btn-compact.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-compact.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.stat-compact {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.stat-compact span {
    font-weight: 600;
    color: #1e293b;
}

.select-compact {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.search-compact {
    width: 120px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
}

/* Advanced Options (collapsible) */
.code-advanced-options {
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.code-advanced-options summary {
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    color: #64748b;
    font-size: 12px;
}

.code-advanced-options summary:hover {
    color: #1e293b;
}

.advanced-content {
    padding: 8px 12px;
    display: flex;
    gap: 20px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #475569;
}

.input-compact {
    width: 60px;
    padding: 2px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-size: 12px;
}

/* Analysis Options Panel - OLD STYLES DEPRECATED */
.code-analysis-options {
    padding: 15px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.analysis-row:last-child {
    margin-bottom: 0;
}

.analysis-row label {
    font-weight: 500;
    color: #64748b;
    min-width: 100px;
}

.analysis-row input[type="text"],
.analysis-row input[type="number"] {
    flex: 1;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    color: #1e293b;
}

.language-selection {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.language-selection label {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: auto;
    cursor: pointer;
}

.language-checkbox {
    cursor: pointer;
}

.analysis-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-options input[type="number"] {
    width: 80px;
}

#cancel-analysis {
    margin-left: 10px;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Notification Styles */
.code-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    background: #475569;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    animation: slideIn 0.3s ease;
}

.code-notification.success {
    background: #10b981;
}

.code-notification.error {
    background: #ef4444;
}

.code-notification.warning {
    background: #f59e0b;
}

.code-notification.info {
    background: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.code-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.code-controls .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.code-controls .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.code-controls .btn-primary.analyzing {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.code-controls .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: #e2e8f0;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.code-controls .btn-sm:hover {
    background: #cbd5e0;
}

.code-controls select {
    padding: 6px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

.code-controls input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    width: 200px;
    font-size: 13px;
}

.code-stats {
    display: flex;
    gap: 20px;
}

.code-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.code-stats .stat-label {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

.code-stats .stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #2d3748;
}

/* Code Tree Container - Full Width */
.code-tree-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

/* Code Content Area - DEPRECATED (Removed duplicate pane) */
/* Content now displayed in main Structured Data section */
/* .code-module-data-content class removed */

/* Visual hierarchy improvements */
.code-tree-container:focus-within {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* Loading indicator */
#code-tree-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
}

#code-tree-loading.hidden {
    display: none;
}

.code-tree-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.code-tree-loading-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

#code-tree {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Progress Bar */
.code-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}

/* Tree Legend - Collapsible and Compact */
.tree-legend {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 200px;
    font-size: 12px;
}

.tree-legend.collapsed {
    display: none;
}

.legend-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    line-height: 1;
}

.legend-close:hover {
    color: #475569;
}

.legend-content {
    display: flex;
    gap: 20px;
}

.legend-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4a5568;
    white-space: nowrap;
}

.legend-icon {
    font-size: 14px;
}

.legend-icon.module {
    color: #8b5cf6;
}

.legend-icon.class {
    color: #3b82f6;
}

.legend-icon.function {
    color: #f59e0b;
}

.legend-icon.method {
    color: #10b981;
}

.legend-icon.complexity-low {
    color: #10b981;
}

.legend-icon.complexity-medium {
    color: #f59e0b;
}

.legend-icon.complexity-high {
    color: #ef4444;
}

/* Breadcrumb */
/* Breadcrumb Ticker */
.code-breadcrumb {
    padding: 8px 12px;
    background: linear-gradient(90deg, #f8f9fa, white);
    border-radius: 6px;
    margin-top: 15px;
    font-size: 12px;
    color: #4a5568;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    min-height: 32px;
}

.breadcrumb-ticker {
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: all 0.3s ease-out;
}

#breadcrumb-content {
    display: inline-block;
    font-size: 11px;
    color: #475569;
    transition: opacity 0.3s;
}

/* Event type styling in ticker */
.ticker-event {
    animation: slideIn 0.3s ease-in;
}

.ticker-file {
    color: #3b82f6;
}

.ticker-node {
    color: #10b981;
}

.ticker-progress {
    color: #8b5cf6;
}

.ticker-success {
    color: #10b981;
    font-weight: 500;
}

.ticker-error {
    color: #ef4444;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(-10px);
    }
    to { 
        opacity: 1; 
        transform: translateX(0);
    }
}

/* D3 Tree Styles */
.code-node {
    cursor: pointer;
}

.code-node circle {
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.code-node circle:hover {
    stroke-width: 3px;
    filter: brightness(1.1);
}

/* Directory node styling - make expandable directories obvious */
.code-node.directory circle {
    fill: #f8fafc;
    stroke: #3b82f6;
    stroke-width: 2px;
}

.code-node.directory:hover circle {
    fill: #eef2ff;
    stroke: #2563eb;
    stroke-width: 3px;
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
}

/* Expanded directory styling */
.code-node.directory.expanded circle {
    fill: #dbeafe;
    stroke: #1d4ed8;
}

/* File node styling */
.code-node.file circle {
    fill: #f9fafb;
    stroke: #6b7280;
    stroke-width: 1.5px;
}

.code-node.file:hover circle {
    fill: #f3f4f6;
    stroke: #4b5563;
    stroke-width: 2px;
}

/* Empty directory styling */
.code-node.directory.empty circle {
    fill: #f9fafb;
    stroke: #9ca3af;
    stroke-dasharray: 3,3;
    opacity: 0.7;
}

/* Directory expand/collapse icons */
.expand-icon {
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    fill: #374151;
    pointer-events: none;
    transition: all 0.2s ease;
}

.code-node.directory .expand-icon {
    fill: #3b82f6;
}

.code-node.directory.expanded .expand-icon {
    fill: #1d4ed8;
    transform: rotate(90deg);
}

.code-node.directory.loading .expand-icon {
    fill: #f59e0b;
    animation: spin 1s linear infinite;
}

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

/* Visualization Controls */
.viz-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
}

.layout-toggle {
    cursor: pointer;
    transition: all 0.2s;
}

.layout-toggle:hover rect {
    opacity: 1;
    filter: brightness(1.1);
}

/* Radial layout specific styles */
.radial-layout .link {
    fill: none;
    stroke: #cbd5e0;
    stroke-width: 1.5px;
    opacity: 0.6;
}

.radial-layout .node text {
    font: 11px sans-serif;
    text-anchor: middle;
}

.radial-layout .node.root text {
    font-size: 14px;
    font-weight: bold;
}

.code-node text {
    font: 12px sans-serif;
    pointer-events: none;
    /* Smooth transitions for zoom-based text scaling */
    transition: font-size 0.2s ease;
}

.code-node.module circle {
    fill: #8b5cf6;
    stroke: #7c3aed;
}

.code-node.class circle {
    fill: #3b82f6;
    stroke: #2563eb;
}

.code-node.function circle {
    fill: #f59e0b;
    stroke: #d97706;
}

.code-node.method circle {
    fill: #10b981;
    stroke: #059669;
}

.code-link {
    fill: none;
    stroke: #cbd5e0;
    stroke-width: 1.5px;
}

/* Complexity-based coloring */
.code-node.complexity-low circle {
    stroke: #10b981 !important;
}

.code-node.complexity-medium circle {
    stroke: #f59e0b !important;
}

.code-node.complexity-high circle {
    stroke: #ef4444 !important;
}

/* Highlighted nodes (search results) */
.code-node.highlighted circle {
    stroke: #ec4899 !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.5));
}

.code-node.highlighted text {
    font-weight: bold;
    fill: #ec4899;
}

/* Search match highlighting */
.code-node.search-match circle {
    stroke: #fbbf24 !important;
    stroke-width: 3px;
    fill: #fef3c7 !important;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
    animation: searchPulse 2s ease-in-out infinite;
}

.code-node.search-match text {
    font-weight: bold;
    fill: #92400e;
}

@keyframes searchPulse {
    0%, 100% {
        stroke-width: 3px;
        opacity: 1;
    }
    50% {
        stroke-width: 4px;
        opacity: 0.8;
    }
}

/* Collapsed node indicator */
.code-node.collapsed circle {
    fill: #e2e8f0 !important;
}

/* Active/selected node */
.code-node.selected circle {
    stroke: #9333ea !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 12px rgba(147, 51, 234, 0.5));
}

/* Active node styling (larger icon) */
.node-circle.active {
    stroke: #3b82f6 !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
    transition: all 0.3s ease;
}

/* Parent context styling */
.node-circle.parent-context {
    stroke: #10b981 !important;
    stroke-width: 2px;
    opacity: 0.8;
}

/* Loading pulse animation */
@keyframes nodePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.node-circle.loading-pulse {
    animation: nodePulse 1.2s ease-in-out infinite;
    stroke: #f59e0b !important;
    fill: #fef3c7 !important;
}

/* Enhanced loading states */
.code-node.loading circle {
    stroke: #f59e0b !important;
    fill: #fef3c7 !important;
    animation: nodePulse 1.5s ease-in-out infinite;
}

.code-node.loading text {
    fill: #92400e;
    font-weight: 600;
}

/* Directory item count badge */
.item-count-badge {
    font-size: 10px;
    fill: #6b7280;
    text-anchor: middle;
    dominant-baseline: central;
    font-weight: 500;
    /* Smooth transitions for zoom-based scaling */
    transition: font-size 0.2s ease;
}

.code-node.directory:hover .item-count-badge {
    fill: #374151;
}

/* Tooltips */
.code-tooltip {
    position: absolute;
    padding: 8px 12px;
    background: rgba(45, 55, 72, 0.95);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
}

/* Tree control toolbar */
.tree-controls-toolbar {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tree-control-btn {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 32px;
    justify-content: center;
}

.tree-control-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.tree-control-btn:active {
    transform: translateY(0);
}

.tree-control-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tree-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Breadcrumb navigation */
.tree-breadcrumb {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: #4b5563;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    max-width: 400px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.breadcrumb-path {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.breadcrumb-separator {
    color: #9ca3af;
    margin: 0 2px;
}

.breadcrumb-segment {
    color: #374151;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.breadcrumb-segment:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.breadcrumb-segment.current {
    color: #3b82f6;
    font-weight: 600;
}

/* Code tree notifications */
.code-tree-notification {
    position: absolute;
    top: 70px;
    right: 15px;
    padding: 12px 20px;
    border-radius: 6px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
    max-width: 300px;
}

.code-tree-notification.info {
    background: #3b82f6;
    color: white;
}

.code-tree-notification.success {
    background: #10b981;
    color: white;
}

.code-tree-notification.warning {
    background: #f59e0b;
    color: white;
}

.code-tree-notification.error {
    background: #ef4444;
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Ensure container has relative positioning for notifications */
#code-tree-container {
    position: relative;
}

/* Code Viewer Modal Styles */
.code-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.code-viewer-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-viewer-content {
    background: white;
    width: 90%;
    max-width: 1200px;
    height: 80%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.code-viewer-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-viewer-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.code-viewer-info {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: #718096;
}

.code-viewer-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.code-viewer-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

.code-viewer-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #282c34;
}

.code-viewer-code {
    margin: 0;
    min-height: 100%;
}

.code-viewer-navigation {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
}

.code-nav-button {
    padding: 8px 16px;
    background: white;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.code-nav-button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.code-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .code-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .code-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .code-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .tree-legend {
        position: static;
        margin-top: 20px;
        max-width: 100%;
    }
    
    .code-viewer-content {
        width: 95%;
        height: 90%;
    }
}

/* Analyze button states */
#analyze-code {
    transition: all 0.3s ease;
    min-width: 80px;
}

#analyze-code.analyzing {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
    animation: pulse 1.5s infinite;
}

#analyze-code.analyzing:before {
    content: '⏳ ';
}

#analyze-code:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* Analysis events display */
.analysis-events {
    border-top: 2px solid #e2e8f0;
    margin-top: 15px;
    padding-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border-radius: 6px;
    padding: 12px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.analysis-event {
    padding: 6px 10px;
    margin: 3px 0;
    border-left: 3px solid #3b82f6;
    background: white;
    border-radius: 3px;
    animation: slideIn 0.3s ease;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-event:hover {
    background: #f0f9ff;
    transform: translateX(2px);
}

@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Back Button for Focused Directory View */
.tree-control-btn.back-btn {
    background: #3182ce !important;
    color: white !important;
    border: 1px solid #2c5aa0 !important;
    font-weight: 600;
    margin-right: 10px;
}

.tree-control-btn.back-btn:hover {
    background: #2c5aa0 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(49, 130, 206, 0.3);
}

/* Focused Directory View Styling */
.code-tree-container.focused {
    border: 2px solid #3182ce;
    border-radius: 8px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.code-tree-container.focused .tree-controls-toolbar {
    background: #e6fffa;
    border-bottom: 1px solid #81e6d9;
}

/* Corner Controls Styling */
.tree-corner-controls {
    position: absolute;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    font-size: 12px;
}

.tree-corner-controls.top-left {
    top: 10px;
    left: 10px;
}

.tree-corner-controls.top-right {
    top: 10px;
    right: 10px;
}

.tree-corner-controls.bottom-left {
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.tree-corner-controls.bottom-right {
    bottom: 10px;
    right: 10px;
}

.tree-corner-controls .control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tree-corner-controls .control-label {
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}

.tree-corner-controls .checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tree-corner-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4a5568;
    cursor: pointer;
    white-space: nowrap;
}

.tree-corner-controls .checkbox-label input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
}

.tree-corner-controls .select-compact,
.tree-corner-controls .search-compact,
.tree-corner-controls .input-compact {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
}

.tree-corner-controls .search-compact {
    width: 120px;
}

.tree-corner-controls .input-compact {
    width: 140px;
}

.tree-corner-controls .stats-display {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 4px;
}

.tree-corner-controls .status-display {
    font-size: 10px;
    color: #4b5563;
    font-style: italic;
    opacity: 0.8;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-corner-controls .status-display .breadcrumb-ticker {
    display: block;
}

.tree-corner-controls .status-display #breadcrumb-content {
    display: inline-block;
    animation: none; /* Disable any existing animations for corner display */
}

/* Hide corner controls when in focused mode to avoid clutter */
.code-tree-container.focused .tree-corner-controls {
    opacity: 0.7;
}

.code-tree-container.focused .tree-corner-controls:hover {
    opacity: 1;
}

/* Force horizontal text for specific nodes */
.node-label.horizontal-text {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: rotate(0deg) !important;
}

/* Zoom controls styling */
.zoom-level-display {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px !important;
    color: #718096 !important;
    margin-left: 8px !important;
    vertical-align: middle;
    min-width: 35px;
    text-align: center;
}

/* Enhanced tree control buttons for zoom */
.tree-control-btn {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 6px 8px;
    margin: 0 2px;
    cursor: pointer;
    font-size: 12px;
    color: #4a5568;
    transition: all 0.2s;
    display: inline-block;
    vertical-align: middle;
}

.tree-control-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    color: #2d3748;
}

.tree-control-btn:active {
    background: #cbd5e0;
    transform: translateY(1px);
}

/* Zoom-specific button styling */
.tree-control-btn[title*="Zoom"] {
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 500;
}

/* Pan cursor when dragging */
.code-tree-container svg {
    cursor: grab;
}

.code-tree-container svg:active {
    cursor: grabbing;
}