/* Modern Elegant Theme - Structural Fidelity Preserved */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; /* Updated font stack */
    background: #f8fafc; /* Lighter, cleaner background */
    color: #334155; /* Dark slate gray for better readability */
    font-size: 16px;
    min-height: 1200px;
}

.header {
    background: rgba(255, 255, 255, 0.95); /* Semi-transparent white */
    backdrop-filter: blur(5px); /* Elegant blur effect */
    border-bottom: 1px solid #e2e8f0;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}


footer {
  padding: 20px;
  padding-bottom: 40px;
  width: 100%;
  text-align: center;
  color: #94a3b8; /* Soft footer text */
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: #4f46e5; /* Primary Indigo accent */
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: #4f46e5;
    border-radius: 8px; /* Slightly rounder */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2); /* Subtle colored shadow */
}

.container.loading {
  filter: blur(5px);
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: #64748b; /* Slate 500 */
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px; /* Slightly rounder */
    transition: all 0.2s;
    font-weight: 500;
}

.nav a:hover, .nav a.active {
    background: #eef2ff; /* Soft indigo hover */
    color: #1e293b; /* Darker text */
}

.nav a.active {
    font-weight: 600;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: #4a5568;
    border-radius: 2px;
    transition: 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.filters, .health-card, .distributions-section, .metric-card, .charts-section, .table-container, .section {
    background: white;
    border-radius: 10px; /* Consistent rounding */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.02); /* Softer, diffuse shadow */
    border: 1px solid #f1f5f9; /* Subtle border */
}

.filters {
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 60px;
    z-index: 90;
    transition: box-shadow 0.2s;
}

.filters.scrolled {
    box-shadow: 0 6px 10px rgba(0,0,0,0.05); /* Slightly darker shadow on scroll */
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    background: #f8fafc;
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
}

.type-filters, .time-filters {
    display: flex;
    gap: 8px;
    background: #f1f5f9; /* Lighter background for filter buttons */
    border-radius: 8px;
    padding: 4px;
}

.type-filter, .time-filter {
    padding: 6px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    color: #64748b;
}

.type-filter.active, .time-filter.active {
    background: white;
    color: #1e293b;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.health-card {
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.health-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.health-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px; /* Changed to squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

/* Updated Pastel Status Colors */
.health-icon.good, .metric-indicator.good, .health-issue-badge.good, .health-badge.good {
    background: #ecfdf5; /* Emerald 50 */
    color: #059669; /* Emerald 600 */
}

.health-icon.fair, .metric-indicator.fair, .health-issue-badge.fair, .health-badge.fair {
    background: #fffbeb; /* Amber 50 */
    color: #d97706; /* Amber 600 */
}

.health-icon.poor, .metric-indicator.poor, .health-issue-badge.poor, .health-badge.poor {
    background: #fff1f2; /* Rose 50 */
    color: #e11d48; /* Rose 600 */
}

.health-text {
    flex: 1;
}

.health-text h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #1e293b;
}

.health-stats {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
}

.health-stats strong {
    font-weight: 600;
    color: #334155;
}

.health-distribution {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #64748b;
}

.health-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.health-issues {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.health-issue {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.health-issue-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* Status dot colors */
.health-issue-badge.good::before, .metric-indicator.good::before, .health-badge.good::before { background: #10b981; }
.health-issue-badge.fair::before, .metric-indicator.fair::before, .health-badge.fair::before { background: #f59e0b; }
.health-issue-badge.poor::before, .metric-indicator.poor::before, .health-badge.poor::before { background: #f43f5e; }


.health-issue-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.health-issue-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

.distributions-section {
    padding: 20px;
    margin-bottom: 20px;
}

.distributions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.distribution-container {
    min-height: 240px;
}

.distribution-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.distribution-label {
    min-width: 100px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.distribution-bar-container {
    flex: 1;
    height: 20px; /* Slimmer bar */
    background: #e2e8f0;
    border-radius: 10px; /* Pill shape */
    position: relative;
    overflow: hidden;
}

.distribution-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.distribution-value {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
}

.distribution-container.duration .distribution-bar {
  background-color: #4f46e588; /* Primary Indigo */
}

.distribution-container.pages .distribution-bar {
  background-color: #10b98188; /* Primary Emerald */
}

.distribution-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Distribution dot colors are covered by status colors above */


.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px; /* Pill shape */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.health-badge::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
}


.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
}

.metric-card {
    padding: 20px; /* Increased padding */
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.metric-card.expanded {
    position: fixed;
    z-index: 10;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    min-width: 320px;
    border-color: #4f46e5;
}

.metric-card-placeholder {
    visibility: hidden;
}

.metric-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-transform: uppercase;
}

.metric-info-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%; /* Circle icon */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: #94a3b8;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.metric-info-icon:hover {
    color: #4f46e5;
    background: #eef2ff;
}

.metric-details {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    animation: slideDown 0.3s ease;
}

.metric-card.expanded .metric-details {
    display: block;
}

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

.metric-details-section {
    margin-bottom: 12px;
}

.metric-details-section:last-child {
    margin-bottom: 0;
}

.metric-details-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

.metric-details-content {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.metric-details-content ul {
    margin: 6px 0 0 0;
    padding-left: 16px;
}

.metric-details-content li {
    margin-bottom: 4px;
}

.metric-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #64748b;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.metric-card.expanded .metric-close {
    display: flex;
}

.metric-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.metric-value {
    font-size: 30px; /* Slightly larger */
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.metric-description {
    font-size: 13px;
    color: #718096;
    margin-bottom: 8px;
}

.metric-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px; /* Slightly rounder */
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}


.sparkline-container {
    height: 40px;
    margin-top: 12px;
}

.sparkline {
    width: 100%;
    height: 100%;
}


.charts-section {
    padding: 24px;
    margin-bottom: 20px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-container {
    min-height: 240px;
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 16px;
}

.chart-placeholder {
    width: 100%;
    height: 200px;
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 8px; /* Slightly rounder */
    background: #f8fafc;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.trend-chart {
    width: 100%;
    height: 100%;
}

.chart-axis-y {
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 32px;
    width: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8; /* Softer axis color */
}

.chart-axis-y span {
    text-align: right;
    padding-right: 8px;
}

.chart-axis-x {
    position: absolute;
    bottom: 8px;
    left: 40px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8; /* Softer axis color */
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 11px;
    color: #64748b;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.table-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 0; /* Remove padding to contain table */
    border: 1px solid #e2e8f0;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 5;
}

.table-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f8fafc; /* Light table header */
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

th:hover {
    background: #f1f5f9;
}

th::after {
    content: '⇅';
    opacity: 0.5;
    margin-left: 6px;
    font-size: 12px;
    transition: opacity 0.2s;
}

th.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: #4f46e5;
}

th.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: #4f46e5;
}

td {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

tr:hover {
    background: #f8fafc;
}

.url-cell {
    color: #4f46e5;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.error-message-cell {
    color: #1e293b;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'ui-monospace', monospace;
    font-size: 12px;
}

.file-location {
    color: ##334155;
    font-size: 11px;
    font-family: 'ui-monospace', monospace;
}

.expand-icon {
    cursor: pointer;
    color: #718096;
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    user-select: none;
}

.expand-icon:hover {
    color: #475569;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.expand-icon.disabled {
    color: #cbd5e0;
    cursor: not-allowed;
}

.error-row-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stack-trace-row {
    display: none;
}

.stack-trace-row.visible {
    display: table-row;
}

.stack-trace-cell {
    padding: 12px 12px 12px 48px !important;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.stack-trace-content {
    font-family: 'ui-monospace', monospace;
    font-size: 11px;
    color: #475569;
    white-space: pre-wrap;
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    max-height: 200px;
    overflow-y: auto;
}

.stack-trace-line {
    padding: 2px 0;
}

.last-seen {
    color: #94a3b8;
    font-size: 12px;
}

.impact-score {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.impact-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 16px; /* More rounded pill shape */
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.impact-badge.high {
    background: #fff1f2;
    color: #e11d48;
}

.impact-badge.medium {
    background: #fffbeb;
    color: #d97706;
}

.impact-badge.low {
    background: #f0fdf4;
    color: #16a34a;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 16px; /* More rounded pill shape */
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.js {
    background: #fffbeb;
    color: #b45309;
}

.badge.http {
    background: #fef2f2;
    color: #be123c;
}

.badge.network {
    background: #eef2ff;
    color: #4338ca;
}

.count-cell {
    font-weight: 600;
    color: #1e293b;
}

.badge.spa {
    background: #eef2ff;
    color: #3730a3;
}

.badge.mpa {
    background: #ecfdf5;
    color: #047857;
}

/* New metric colors to align with theme */
.metric-good {
    color: #10b981;
    font-weight: 600;
}

.metric-medium, .metric-fair {
    color: #f59e0b;
    font-weight: 600;
}

.metric-poor {
    color: #f43f5e;
    font-weight: 600;
}

.section {
    padding: 24px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.section-content {
    display: grid;
    gap: 24px;
}

.section-content.with-chart {
    grid-template-columns: 320px 1fr;
}

.map-container {
    width: 100%;
    height: 450px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
    position: relative;
    padding: 16px;
}


.dem-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dem-pie-chart {
    width: 280px;
    height: 280px;
}

.pie-slice {
    transition: opacity 0.2s;
    cursor: pointer;
}

.pie-slice:hover {
    opacity: 0.8;
}

.chart-legend {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-label {
    color: #475569;
}

.legend-value {
    color: #1e293b;
    font-weight: 600;
}

.pie-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0px;
}

.pie-chart {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.pie-legend {
    flex: 1;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.pie-legend-item:last-child {
    border-bottom: none;
}

.pie-legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.pie-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.pie-legend-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}


/* --- Media Queries (Unchanged) --- */
@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 12px 20px;
        border-bottom: 1px solid #e2e8f0;
        gap: 8px;
    }

    .nav.open {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .health-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .health-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-value {
        font-size: 22px;
    }

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

    .filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .health-issues {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .filters {
        padding: 12px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .health-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .health-issues {
        grid-template-columns: 1fr;
    }

}
