/* Coverage Report Styles */

/* Additional coverage-specific variables */
:root {
    --bg-primary: #ffffff;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    --bg-primary: #1f2937;
}

.coverage-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.coverage-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.coverage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.coverage-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: rgba(138, 43, 226, 0.5);
}

.coverage-card:hover::before {
    transform: scaleX(1);
}

.coverage-card h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.coverage-percent {
    font-size: 4rem;
    font-weight: 800;
    margin: 0 0 1.5rem 0;
    color: var(--primary-color);
    line-height: 1;
    letter-spacing: -2px;
}

.coverage-bar {
    height: 24px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: visible;
    margin: 0 0 1rem 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--border-color);
    position: relative;
}

.coverage-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(0, 102, 204, 0.5);
    border-radius: 6px;
    border: 2px solid rgba(0, 102, 204, 0.3);
    position: relative;
}

.coverage-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    bottom: -2px;
    width: 3px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 6px 6px 0;
}

[data-theme="dark"] .coverage-bar-fill {
    box-shadow: 0 0 8px rgba(51, 153, 255, 0.5);
    border: 2px solid rgba(51, 153, 255, 0.3);
}

[data-theme="dark"] .coverage-bar-fill::after {
    background: rgba(255, 255, 255, 0.3);
}

.coverage-details {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 1.25rem 0;
    font-weight: 600;
}

.coverage-explanation {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    opacity: 0.85;
}
.file-list {
    margin-top: 2rem;
}

.file-list h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

#complete-coverage-section {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 3px solid var(--border-color);
}

#complete-coverage-section h2 {
    color: var(--primary-color);
}

.file-filter {
    margin-bottom: 1.5rem;
}

.file-filter input {
    width: 100%;
    max-width: 500px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.file-filter input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.file-table thead {
    background: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
}

.file-table th {
    text-align: left;
    padding: 1rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.8px;
}

.file-table th:nth-child(2),
.file-table th:nth-child(3),
.file-table th:nth-child(4) {
    text-align: center;
}

.file-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}

.file-table td:nth-child(2),
.file-table td:nth-child(3),
.file-table td:nth-child(4) {
    text-align: center;
}

.file-table tbody tr {
    transition: background 0.2s;
}

.file-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Directory header styling */
.directory-header {
    background: var(--bg-secondary);
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.directory-header:hover {
    background: var(--bg-secondary) !important;
}

.directory-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--primary-color);
    padding: 1rem !important;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    font-weight: 700;
}

.directory-header td {
    font-weight: 600;
}

.directory-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.directory-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* File row styling */
.file-row .file-name {
    padding-left: 2.5rem !important;
}

.file-name {
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.file-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.file-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.coverage-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.coverage-excellent {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.coverage-good {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
}

.coverage-poor {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Regression Alert */
.regression-alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.regression-alert .alert-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.regression-alert .alert-content {
    flex: 1;
}

.regression-alert .alert-content strong {
    display: block;
    font-size: 1.1rem;
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.regression-alert .alert-content p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Trend Indicators */
.trend-indicator {
    margin: 0.75rem 0;
    min-height: 28px;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.trend-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.trend-badge.improving {
    background-color: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.trend-badge.degrading {
    background-color: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.trend-badge.stable {
    background-color: #e5e7eb;
    color: #374151;
    border: 2px solid #6b7280;
}

[data-theme="dark"] .trend-badge.improving {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .trend-badge.degrading {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

[data-theme="dark"] .trend-badge.stable {
    background-color: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
}

/* Historical Trends Section */
#historical-trends,
#test-trends,
#recent-snapshots,
.historical-section {
    margin: 3rem 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: box-shadow 0.3s ease;
    /* Fallbacks for older browsers */
    background-color: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="dark"] #historical-trends,
[data-theme="dark"] #test-trends,
[data-theme="dark"] #recent-snapshots,
[data-theme="dark"] .historical-section {
    background-color: #1f2937;
    border-color: #374151;
}

#historical-trends h2,
#test-trends h2,
#recent-snapshots h2,
.historical-section h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.time-range-selector {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

#historical-trends .time-range-selector {
    display: flex !important;
}

.time-range-btn {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Fallbacks */
    background-color: #ffffff;
    border-color: #e5e7eb;
    color: #111827;
}

[data-theme="dark"] .time-range-btn {
    background-color: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.time-range-btn:hover {
    border-color: var(--primary-color);
    border-color: #8a2be2;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.time-range-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    /* Fallback */
    background-color: #8a2be2;
    border-color: #8a2be2;
}

.chart-container {
    position: relative;
    height: 400px;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    /* Ensure Chart.js renders properly */
    width: 100%;
    box-sizing: border-box;
    /* Fallback background */
    background-color: #f9fafb;
}

/* Specific targeting for Chart.js canvas elements */
#historical-trends .chart-container,
#test-trends .chart-container {
    height: 400px !important;
    width: 100% !important;
}

#trends-chart {
    max-width: 100% !important;
    max-height: 380px !important;
    height: 100% !important;
    width: 100% !important;
}

#test-chart {
    max-width: 100% !important;
    max-height: 380px !important;
    height: 100% !important;
    width: 100% !important;
}

[data-theme="dark"] .chart-container {
    background-color: #111827;
}

.chart-container canvas {
    cursor: pointer;
    /* Ensure canvas takes full space */
    max-width: 100% !important;
    max-height: 100% !important;
    display: block;
    margin: 0 auto;
}

.chart-legend {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.chart-legend p {
    margin: 0;
    line-height: 1.6;
}

.chart-legend strong {
    color: var(--text-primary);
}

.chart-legend em {
    opacity: 0.8;
}

/* Snapshots Table */
.snapshots-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.export-btn {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--primary-color);
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: var(--bg-primary);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.2);
}

.snapshots-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.snapshots-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.snapshots-table thead {
    background: var(--primary-color);
}

.snapshots-table th {
    text-align: left;
    padding: 1rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.8px;
}

.snapshots-table th:nth-child(3),
.snapshots-table th:nth-child(4),
.snapshots-table th:nth-child(5),
.snapshots-table th:nth-child(6) {
    text-align: center;
}

.snapshots-table td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

.snapshots-table td:nth-child(3),
.snapshots-table td:nth-child(4),
.snapshots-table td:nth-child(5),
.snapshots-table td:nth-child(6) {
    text-align: center;
    font-weight: 600;
}

.snapshots-table tbody tr {
    transition: background 0.2s;
}

.snapshots-table tbody tr:hover {
    background: var(--bg-secondary);
}

.commit-link {
    color: var(--primary-color);
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(138, 43, 226, 0.1);
    transition: all 0.2s ease;
}

.commit-link:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .regression-alert {
        flex-direction: column;
        text-align: center;
    }
    
    .time-range-selector {
        flex-direction: column;
    }
    
    .time-range-btn {
        width: 100%;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .snapshots-table th,
    .snapshots-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .export-btn {
        width: 100%;
    }
}
