/* ===== FILES PAGE SPECIFIC STYLES ===== */

/* File Tree Container */
.file-tree {
    max-height: 600px;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.file-tree::-webkit-scrollbar {
    width: 8px;
}

.file-tree::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.file-tree::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.file-tree::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Search Bar */
.file-search-bar {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.file-search-bar input {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: white;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.file-search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.file-search-bar i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* File Tree Legend */
.file-tree-legend {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.legend-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1.5px solid;
    background: white;
    user-select: none;
    white-space: nowrap;
}

.filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.filter-btn .filter-count {
    background: rgba(0,0,0,0.1);
    padding: 0.0625rem 0.25rem;
    border-radius: 6px;
    font-size: 0.625rem;
    margin-left: 0.125rem;
    min-width: 1.25rem;
    text-align: center;
}

/* Filter Button Color Variants */
.filter-btn.good {
    border-color: var(--color-good);
    color: var(--color-good-dark);
}

.filter-btn.good.active {
    background: linear-gradient(135deg, var(--color-good), var(--color-good-dark));
    color: white;
}

.filter-btn.good.active .filter-count {
    background: rgba(255,255,255,0.3);
}

.filter-btn.ok {
    border-color: var(--color-ok);
    color: var(--color-ok-dark);
}

.filter-btn.ok.active {
    background: linear-gradient(135deg, var(--color-ok), var(--color-ok-dark));
    color: white;
}

.filter-btn.ok.active .filter-count {
    background: rgba(255,255,255,0.3);
}

.filter-btn.warning {
    border-color: var(--color-warning);
    color: var(--color-warning-dark);
}

.filter-btn.warning.active {
    background: linear-gradient(135deg, var(--color-warning), var(--color-warning-dark));
    color: white;
}

.filter-btn.warning.active .filter-count {
    background: rgba(255,255,255,0.3);
}

.filter-btn.critical {
    border-color: var(--color-critical);
    color: var(--color-critical-dark);
}

.filter-btn.critical.active {
    background: linear-gradient(135deg, var(--color-critical), var(--color-critical-dark));
    color: white;
}

.filter-btn.critical.active .filter-count {
    background: rgba(255,255,255,0.3);
}

/* Legend Dots */
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.good { background: var(--color-good); }
.legend-dot.ok { background: var(--color-ok); }
.legend-dot.warning { background: var(--color-warning); }
.legend-dot.critical { background: var(--color-critical); }

/* File Tree Structure */
.file-tree ul {
    list-style: none;
    padding-left: 1.5rem;
    margin: 0.25rem 0;
    position: relative;
}

.file-tree ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0.5rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--border-light), transparent);
}

.file-tree > ul {
    padding-left: 0;
}

.file-tree > ul::before {
    display: none;
}

.file-tree li {
    position: relative;
    margin: 0.125rem 0;
    padding-left: 1rem;
}

.file-tree li::before {
    content: '';
    position: absolute;
    top: 0.875rem;
    left: 0.5rem;
    width: 0.75rem;
    height: 2px;
    background: var(--border-light);
}

.file-tree > ul > li::before {
    display: none;
}

.file-tree li > i {
    margin-right: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.file-tree li.filtered-out {
    display: none;
}

/* Folder and File Styles */
.file-tree .folder,
.file-tree .file {
    display: inline-block;
    cursor: pointer;
    padding: 0.375rem 0.625rem;
    padding-left: 0.75rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    color: var(--text-primary);
    font-weight: 500;
    border-left: 3px solid transparent;
    margin-left: -3px;
}

.file-tree .folder {
    color: var(--primary-color);
    font-weight: 600;
}

.file-tree .folder:hover {
    background-color: rgba(59, 130, 246, 0.08);
    color: var(--primary-dark);
    transform: translateX(2px);
}

.file-tree .folder:hover + ul {
    border-left-color: var(--primary-color);
}

.file-tree .file:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.1));
    color: var(--primary-color);
    transform: translateX(2px);
}

.file-tree .folder i {
    color: var(--warning-color);
}

.file-tree .file i {
    color: var(--info-color);
}

/* File Health Borders */
.file-tree .file.health-good {
    border-left-color: var(--color-good);
}

.file-tree .file.health-ok {
    border-left-color: var(--color-ok);
}

.file-tree .file.health-warning {
    border-left-color: var(--color-warning);
}

.file-tree .file.health-critical {
    border-left-color: var(--color-critical);
}

/* Enhanced Hover for Health Borders */
.file-tree .file.health-good:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.1));
    box-shadow: inset 3px 0 0 0 var(--color-good);
}

.file-tree .file.health-ok:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.1));
    box-shadow: inset 3px 0 0 0 var(--color-ok);
}

.file-tree .file.health-warning:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), rgba(249, 115, 22, 0.1));
    box-shadow: inset 3px 0 0 0 var(--color-warning);
}

.file-tree .file.health-critical:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.1));
    box-shadow: inset 3px 0 0 0 var(--color-critical);
}

/* File Health Indicators */
.file-health-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    transition: all var(--transition-fast);
}

.file-health-indicator.good { background: var(--color-good); }
.file-health-indicator.ok { background: var(--color-ok); }
.file-health-indicator.warning { background: var(--color-warning); }
.file-health-indicator.critical {
    background: var(--color-critical);
    animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 4px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 6px rgba(239, 68, 68, 0.1);
    }
}

.file-tree .file:hover .file-health-indicator {
    transform: scale(1.3);
}

/* Priority Badge */
.file-priority-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.375rem;
    border-radius: 8px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.file-priority-badge.critical { background: var(--color-critical); color: white; }
.file-priority-badge.warning { background: var(--color-warning); color: white; }
.file-priority-badge.ok { background: var(--color-ok); color: white; }

/* File Details Panel */
.file-view {
    min-height: 400px;
}

.file-details {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(255, 255, 255, 0.98) 100%);
    border: 1px solid var(--border-light);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.file-details h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.file-details h2 i {
    color: var(--primary-color);
    font-size: 1.75rem;
}

.file-details > p {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0 var(--spacing-sm) var(--spacing-sm) 0;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.file-details > p strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
    font-weight: 600;
}

.file-details hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    margin: var(--spacing-xl) 0 var(--spacing-lg) 0;
}

.file-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--spacing-lg) 0 var(--spacing-md) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.file-details h3::before {
    content: '';
    width: 4px;
    height: 1.125rem;
    background: linear-gradient(180deg, var(--primary-color), var(--info-color));
    border-radius: 2px;
}

.file-details ul {
    list-style: none;
    padding-left: 0;
    margin: var(--spacing-md) 0;
}

.file-details > ul > li {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    transition: all var(--transition-fast);
}

.file-details > ul > li:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-dark);
}

.file-details > ul > li > strong {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9375rem;
}

.file-details .methods {
    list-style: none;
    padding-left: var(--spacing-lg);
    margin-top: var(--spacing-sm);
}

.file-details .methods li {
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-xs) 0;
    background-color: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--info-color);
    transition: all var(--transition-fast);
}

.file-details .methods li:hover {
    background-color: rgba(6, 182, 212, 0.05);
    border-left-color: var(--info-color);
    transform: translateX(4px);
}

/* Metric Badge */
.metric-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid;
    transition: all var(--transition-fast);
    flex: 0 1 auto;
}

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

.metric-badge .label { font-weight: 600; margin-right: 0.25rem; }
.metric-badge .value { font-weight: 700; }

.metric-badge .segment-indicator {
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.metric-badge.good {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.15));
    border-color: var(--color-good);
    color: var(--color-good-dark);
}
.metric-badge.good .segment-indicator { background: var(--color-good); color: white; }

.metric-badge.ok {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.15));
    border-color: var(--color-ok);
    color: var(--color-ok-dark);
}
.metric-badge.ok .segment-indicator { background: var(--color-ok); color: white; }

.metric-badge.warning {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.15));
    border-color: var(--color-warning);
    color: var(--color-warning-dark);
}
.metric-badge.warning .segment-indicator { background: var(--color-warning); color: white; }

.metric-badge.critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.15));
    border-color: var(--color-critical);
    color: var(--color-critical-dark);
}
.metric-badge.critical .segment-indicator { background: var(--color-critical); color: white; }

/* Complexity Indicator */
.complexity-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.complexity-indicator.good { background: var(--color-good); color: white; }
.complexity-indicator.ok { background: var(--color-ok); color: white; }
.complexity-indicator.warning { background: var(--color-warning); color: white; }
.complexity-indicator.critical { background: var(--color-critical); color: white; }

/* Empty State */
.file-view:empty::before {
    content: '👈 Select a file from the tree to view details';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-muted);
    font-size: 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-light);
}

/* Responsive */
@media (max-width: 768px) {
    .file-tree {
        max-height: 400px;
    }

    .file-details {
        padding: var(--spacing-lg);
    }

    .file-details h2 {
        font-size: 1.25rem;
    }

    .metrics-summary {
        flex-direction: column !important;
    }

    .metric-badge {
        width: 100%;
        justify-content: space-between;
    }

    .metric-badge .segment-indicator {
        margin-left: auto;
    }

    .file-tree-legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend-title {
        width: 100%;
    }

    .filter-controls {
        width: 100%;
    }

    .filter-btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: 0.25rem 0.375rem;
    }
}

