/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --light-bg: #f8fafc;
    --alt-bg: #fef3c7;
    --dark-text: #1e293b;
    --body-text: #475569;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

html {
    scroll-padding-top: 80px; /* Offset for fixed navigation */
}

/* Universal anchor offset for all elements with IDs */
[id] {
    scroll-margin-top: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 0.75rem 0;
    backdrop-filter: blur(10px);
    background: rgba(30, 58, 138, 0.98);
}

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

.nav-logo {
    display: flex;
    align-items: center;
}

.nav-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 50px;
    width: auto;
    display: block;
    /* Blend the logo with nav background */
    mix-blend-mode: screen;
    filter: brightness(1.2) contrast(1.1);
    transition: transform 0.2s, filter 0.2s;
}

/* Add hover effect */
.nav-logo a:hover .logo-img {
    transform: scale(1.05);
    filter: brightness(1.3) contrast(1.2);
}

/* Alternative approach - extract just the white parts */
@supports (mix-blend-mode: screen) {
    .logo-img {
        mix-blend-mode: screen;
    }
}

/* Fallback for browsers without blend mode support */
@supports not (mix-blend-mode: screen) {
    .logo-img {
        opacity: 0.95;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .logo-img {
        height: 40px;
    }
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.nav-links a:hover {
    background-color: rgba(59, 130, 246, 0.2);
    color: white;
}

.nav-links a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Floating Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 20px;
    top: 80px;
    width: 200px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem 0;
    z-index: 900;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
    animation: slideIn 0.3s ease-out;
}

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

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.sidebar-content {
    padding: 0 1rem;
}

.sidebar h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.75rem;
    font-weight: 600;
    padding: 0 0.75rem;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.125rem;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
}

.sidebar-link:hover {
    background-color: #f3f4f6;
    color: var(--primary-color);
    transform: translateX(2px);
}

.sidebar-link.active {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 500;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 50%;
    background-color: white;
    border-radius: 0 2px 2px 0;
}

/* No layout adjustment needed for floating sidebar */
body.has-sidebar {
    margin-left: 0;
}

@media (max-width: 1200px) {
    .sidebar {
        display: none;
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c3e50 100%);
    color: var(--white);
    padding: 5rem 20px;
    text-align: center;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.hero-content {
    max-width: 1000px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    margin-bottom: 3rem;
    opacity: 0.9;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
}

.stat-card.urgent {
    border-color: var(--danger-color);
    background: rgba(231, 76, 60, 0.2);
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--danger-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover {
    background: var(--white);
    color: var(--primary-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    margin-top: 1rem;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section-alt {
    background: linear-gradient(to bottom, rgba(59, 130, 246, 0.03), var(--white));
}

.section-action {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: var(--white);
}

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

h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 2rem;
    font-weight: 700;
    text-align: center;
}

.section-action h2 {
    color: var(--white);
}

/* Intro Text */
.intro-text {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

.intro-text p {
    margin-bottom: 1.5rem;
    color: var(--body-text);
}

.feature-list {
    list-style: none;
    margin: 1.5rem 0;
}

.feature-list li {
    padding-left: 2rem;
    position: relative;
    margin-bottom: 1rem;
}

.feature-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Findings Grid */
.findings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.finding-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border-left: 5px solid var(--secondary-color);
}

.finding-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.finding-card.critical {
    border-left-color: var(--danger-color);
}

.finding-card.warning {
    border-left-color: var(--warning-color);
}

.finding-card h3 {
    color: var(--dark-text);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.finding-card p {
    color: var(--body-text);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.link-more {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s;
}

.link-more:hover {
    color: var(--primary-color);
}

/* Chart Container */
.chart-container {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.chart-note {
    text-align: center;
    color: var(--body-text);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Testimonials */
.testimonial {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--light-bg);
    border-radius: 12px;
    border-left: 5px solid var(--secondary-color);
}

blockquote {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--dark-text);
    font-style: italic;
}

cite {
    display: block;
    margin-top: 1rem;
    color: var(--body-text);
    font-style: normal;
    font-weight: 600;
}

/* Document Grid */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.doc-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.doc-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.doc-card p {
    color: var(--body-text);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.doc-link {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Action Section */
.action-intro {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: rgba(255, 255, 255, 0.9);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.action-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.action-card h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.action-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.action-resources {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.action-resources h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.action-resources ul {
    list-style: none;
}

.action-resources li {
    margin-bottom: 0.5rem;
}

.action-resources a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.action-resources a:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
}

.footer p {
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        flex-wrap: wrap;
        gap: 1rem;
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .hero {
        padding: 3rem 20px;
        min-height: auto;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
    }
    
    .findings-grid,
    .doc-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
}

/* Citation Tooltips */
sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

sup a {
    position: relative;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    cursor: help;
    padding: 0 2px;
}

.citation-tooltip, .perf-tooltip {
    position: fixed !important;
    background: #1e293b !important;
    color: white !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    font-size: 0.875rem !important;
    font-weight: normal !important;
    white-space: normal !important;
    width: 350px !important;
    max-width: 90vw !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    line-height: 1.4 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    overflow: visible !important;
    min-height: 50px !important;
    display: block !important;
}

.citation-tooltip.show, .perf-tooltip.show, .citation-tooltip.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Arrow for tooltip */
.citation-tooltip::after, .perf-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

/* Ensure all tooltip content has proper display */
.citation-tooltip > *,
.perf-tooltip > * {
    display: block !important;
    width: 100% !important;
}

.citation-tooltip .tooltip-source,
.citation-tooltip .tooltip-header {
    font-weight: 600 !important;
    color: #60a5fa !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

.citation-tooltip .tooltip-content {
    margin-bottom: 0.5rem !important;
    font-weight: 500 !important;
    color: #f1f5f9 !important;
}

.citation-tooltip .tooltip-excerpt {
    margin-bottom: 0.75rem !important;
    font-style: italic !important;
    color: #cbd5e1 !important;
    font-size: 0.85rem !important;
    padding: 0.75rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 4px !important;
    border-left: 3px solid #60a5fa !important;
}

.citation-tooltip .tooltip-link,
.citation-tooltip a.tooltip-link {
    color: #93c5fd !important;
    text-decoration: underline !important;
    font-size: 0.8rem !important;
    display: block !important;
}

.citation-tooltip .tooltip-link:hover,
.citation-tooltip a.tooltip-link:hover {
    color: #dbeafe !important;
}

/* Page Navigation */
.page-nav {
    background: var(--light-bg);
    padding: 3rem 0;
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.page-nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.page-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--dark-text);
    padding: 1rem 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    flex: 1;
    max-width: 400px;
}

.page-nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.page-nav-link.prev {
    flex-direction: row-reverse;
    text-align: right;
}

.page-nav-link.next {
    text-align: left;
}

.page-nav-arrow {
    font-size: 1.5rem;
    color: var(--secondary-color);
    transition: transform 0.3s ease;
}

.page-nav-link.prev:hover .page-nav-arrow {
    transform: translateX(-5px);
}

.page-nav-link.next:hover .page-nav-arrow {
    transform: translateX(5px);
}

.page-nav-text {
    flex: 1;
}

.page-nav-label {
    font-size: 0.875rem;
    color: var(--body-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.page-nav-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .page-nav-content {
        flex-direction: column;
    }
    
    .page-nav-link {
        width: 100%;
        max-width: none;
    }
}

/* Print Styles */
@media print {
    .nav,
    .hero-actions,
    .btn,
    .footer,
    .page-nav {
        display: none;
    }
    
    .hero {
        background: white;
        color: black;
        min-height: auto;
    }
    
    .section {
        page-break-inside: avoid;
    }
}