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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px; /* Account for fixed nav height */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 70px 20px 20px; /* Add top padding for fixed nav */
}

/* Navigation Menu */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2563eb;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding: 5px 10px;
    border-radius: 4px;
}

.nav-links a:hover {
    color: #2563eb;
    background: #eff6ff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

h1 {
    font-size: 2.5rem;
    color: #1f2937;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.last-update {
    color: #9ca3af;
    font-size: 0.9rem;
    font-style: italic;
}

/* Disclaimer */
.disclaimer {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    text-align: left;
}

.disclaimer p {
    margin: 8px 0;
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.5;
}

.disclaimer p:first-child {
    margin-top: 0;
}

.disclaimer p:last-child {
    margin-bottom: 0;
}

.disclaimer strong {
    color: #92400e;
}

.disclaimer a {
    color: #1d4ed8;
    text-decoration: underline;
}

.disclaimer a:hover {
    color: #1e40af;
}

/* About and Resources Sections */
.about-section,
.resources-section {
    margin: 40px 0;
    padding: 30px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
}

.about-section h2,
.resources-section h2 {
    font-size: 1.8rem;
    color: #1f2937;
    margin-bottom: 15px;
    font-weight: 600;
}

.about-section h3 {
    font-size: 1.3rem;
    color: #374151;
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
}

.about-section p {
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 15px;
}

.about-section ul {
    list-style-type: disc;
    margin-left: 30px;
    margin-bottom: 15px;
}

.about-section li {
    line-height: 1.8;
    color: #4b5563;
    margin-bottom: 8px;
}

.about-section a {
    color: #1d4ed8;
    text-decoration: underline;
    font-weight: 500;
}

.about-section a:hover {
    color: #1e40af;
}

.about-section strong {
    color: #1f2937;
    font-weight: 600;
}

/* FAQ Accordion Styles */
.about-section details {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
}

.about-section details[open] {
    border-color: #2563eb;
}

.about-section summary {
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    user-select: none;
    font-size: 1.05rem;
    list-style: none;
}

.about-section summary::-webkit-details-marker {
    display: none;
}

.about-section summary::marker {
    display: none;
}

.about-section summary::before {
    content: "▶ ";
    margin-right: 8px;
    color: #2563eb;
    transition: transform 0.2s ease;
    display: inline-block;
}

.about-section details[open] summary::before {
    transform: rotate(90deg);
}

.about-section details p {
    margin-top: 12px;
    margin-bottom: 0;
    padding-left: 20px;
    color: #6b7280;
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.resource-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.resource-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.resource-card h4 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 8px;
    font-weight: 600;
}

.resource-card p {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.5;
}

.resource-card a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.resource-card a:hover {
    color: #1e40af;
}

/* News Section */
.news-section {
    margin: 40px 0;
    padding: 30px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.news-section h2 {
    font-size: 1.8rem;
    color: #1f2937;
    margin-bottom: 10px;
    font-weight: 600;
}

.news-intro {
    color: #6b7280;
    margin-bottom: 25px;
    line-height: 1.6;
}

.news-loading,
.news-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 1.1rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.news-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.news-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
    transform: translateY(-2px);
}

.news-card:hover .news-title a {
    color: #f59e0b;
}

.news-title {
    font-size: 1.05rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-title a {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.news-title a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.news-source {
    color: #2563eb;
    font-size: 0.85rem;
    font-weight: 600;
}

.news-date {
    color: #9ca3af;
    font-size: 0.85rem;
}

.news-description {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;
}

.news-updated {
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 20px;
}

/* Footer */
footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    padding: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 25px;
}

.footer-section h4 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 12px;
    font-weight: 600;
}

.footer-section p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: #1e40af;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.footer-bottom p {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 5px 0;
}

/* Code Reference Note */
.code-reference-note {
    background: #dbeafe;
    border-left: 4px solid #1d4ed8;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1e40af;
    font-weight: 500;
}

/* Ad Container */
.ad-container {
    margin: 30px auto;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    max-width: 100%;
    text-align: center;
}

.ad-container ins {
    display: block;
    min-height: 100px;
}

/* Filters Section */
.filters-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

.report-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 400;
    color: #4b5563;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.timeframe-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeframe-buttons button {
    padding: 10px 20px;
    border: 2px solid #d1d5db;
    background: white;
    color: #4b5563;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.timeframe-buttons button:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.timeframe-buttons button.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Charts Container */
.charts-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.chart-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-section h2 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 20px;
    font-weight: 600;
}

.chart-wrapper {
    background: white;
    border-radius: 6px;
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.chart-wrapper:last-child {
    margin-bottom: 0;
}

/* D3 Chart Styles */
.line {
    fill: none;
    stroke: #2563eb;
    stroke-width: 2px;
}

.area {
    fill: #2563eb;
    fill-opacity: 0.1;
}

.x-axis path,
.y-axis path,
.x-axis line,
.y-axis line {
    stroke: #d1d5db;
}

.x-axis text,
.y-axis text {
    fill: #6b7280;
    font-size: 12px;
}

.axis-label {
    fill: #4b5563;
    font-size: 13px;
    font-weight: 500;
}

.dots circle {
    cursor: pointer;
    transition: r 0.2s ease;
}

.dots circle:hover {
    r: 6;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    pointer-events: none;
    font-size: 13px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tooltip strong {
    color: #2563eb;
}

/* Bar Chart Styles */
.bar {
    transition: opacity 0.2s ease;
}

.bar:hover {
    opacity: 0.7;
}

/* Heatmap Styles */
.heatmap-svg {
    font-family: inherit;
}

.cell {
    transition: all 0.2s ease;
}

.legend-axis path,
.legend-axis line {
    stroke: #d1d5db;
}

.legend-axis text {
    fill: #6b7280;
    font-size: 11px;
}

/* Multi-line Chart Styles */
.multi-line .line-path {
    transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.legend-item {
    cursor: default;
}

.legend-item text {
    fill: #4b5563;
}

/* Stacked Area Chart Styles */
.layer .area {
    transition: opacity 0.2s ease;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.2rem;
    color: #6b7280;
}

.loading p::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Error */
.error {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.error p {
    color: #dc2626;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 60px 10px 10px;
    }

    .nav-container {
        padding: 12px 20px;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 4px 8px;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .filters-section {
        padding: 15px;
    }

    .report-checkboxes {
        flex-direction: column;
        gap: 10px;
    }

    .timeframe-buttons {
        flex-direction: column;
    }

    .timeframe-buttons button {
        width: 100%;
    }

    .chart-section {
        padding: 15px;
    }

    .chart-wrapper {
        padding: 10px;
    }

    svg {
        max-width: 100%;
        height: auto;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
    }
}
