/* Whitepaper Page Styles */

/* Main Layout */
.whitepaper-container {
    display: flex;
    min-height: calc(100vh - 200px);
    background: linear-gradient(135deg, #0a1929 0%, #1e3a8a 50%, #3730a3 100%);
    color: #ffffff;
}

/* Sidebar Styles */
.whitepaper-sidebar {
    width: 350px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    color: #60a5fa;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-actions {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-btn, .print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.download-btn {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
}

.download-btn:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.print-btn {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.print-btn:hover {
    background: rgba(96, 165, 250, 0.3);
    transform: translateY(-2px);
}

/* Table of Contents */
.sidebar-nav {
    padding: 0 1rem;
}

.toc-item {
    margin-bottom: 0.25rem;
}

.toc-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
    border-left-color: #60a5fa;
    transform: translateX(4px);
}

.toc-link.active {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border-left-color: #60a5fa;
    font-weight: 500;
}

.toc-level-1 { padding-left: 1rem; }
.toc-level-2 { padding-left: 1.5rem; font-size: 0.8rem; }
.toc-level-3 { padding-left: 2rem; font-size: 0.75rem; }

/* Reading Progress */
.reading-progress {
    margin: 2rem 1.5rem 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Main Content */
.whitepaper-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-width: calc(100vw - 350px);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.whitepaper-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.document-type, .version, .date {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.document-type {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.version {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.date {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.content-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.3);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    margin: 2rem 0;
}

.loading-indicator.hidden {
    display: none !important;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(96, 165, 250, 0.2);
    border-top: 4px solid #60a5fa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Whitepaper Article */
.whitepaper-article {
    line-height: 1.8;
    font-size: 1.05rem;
    max-width: none;
    min-height: 400px; /* Ensure minimum height for better loading experience */
}

.whitepaper-article.hidden {
    display: none;
}

.whitepaper-article:not(.hidden) {
    display: block;
}

.whitepaper-article h1,
.whitepaper-article h2,
.whitepaper-article h3,
.whitepaper-article h4,
.whitepaper-article h5,
.whitepaper-article h6 {
    color: #60a5fa;
    margin: 2.5rem 0 1.5rem;
    font-weight: 600;
    scroll-margin-top: 2rem;
}

.whitepaper-article h1 {
    font-size: 2.5rem;
    text-align: center;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 2px solid rgba(96, 165, 250, 0.3);
    padding-bottom: 1rem;
}

.whitepaper-article h2 {
    font-size: 1.8rem;
    border-left: 4px solid #60a5fa;
    padding-left: 1rem;
}

.whitepaper-article h3 {
    font-size: 1.4rem;
}

.whitepaper-article h4 {
    font-size: 1.2rem;
}

.whitepaper-article p {
    margin: 1.2rem 0;
    color: #e2e8f0;
    text-align: justify;
}

.whitepaper-article ul,
.whitepaper-article ol {
    margin: 1.2rem 0;
    padding-left: 2rem;
}

.whitepaper-article li {
    margin: 0.75rem 0;
    color: #e2e8f0;
}

.whitepaper-article strong {
    color: #f1f5f9;
    font-weight: 600;
}

.whitepaper-article em {
    color: #cbd5e1;
    font-style: italic;
}

/* Code Blocks */
.whitepaper-article code {
    background: rgba(0, 0, 0, 0.4);
    color: #60a5fa;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

.whitepaper-article pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
    position: relative;
}

.whitepaper-article pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
}

/* Tables */
.whitepaper-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.whitepaper-article th,
.whitepaper-article td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.whitepaper-article th {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    font-weight: 600;
    font-size: 0.95rem;
}

.whitepaper-article td {
    color: #e2e8f0;
}

.whitepaper-article tr:last-child td {
    border-bottom: none;
}

.whitepaper-article tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Blockquotes */
.whitepaper-article blockquote {
    border-left: 4px solid #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 0 12px 12px 0;
    position: relative;
}

.whitepaper-article blockquote::before {
    content: '"';
    font-size: 4rem;
    color: rgba(96, 165, 250, 0.3);
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    font-family: Georgia, serif;
}

.whitepaper-article blockquote p {
    margin: 0;
    color: #bfdbfe;
    font-style: italic;
    padding-left: 2rem;
}

/* Citation Box */
.citation-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    margin: 3rem 0;
}

.citation-box h4 {
    color: #60a5fa;
    margin: 0 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.citation-content p {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.copy-citation-btn {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.copy-citation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

/* Mathematical Formulas */
.whitepaper-article .MathJax {
    color: #f1f5f9 !important;
}

/* Font Size Control */
.whitepaper-article.font-small {
    font-size: 0.9rem;
}

.whitepaper-article.font-large {
    font-size: 1.2rem;
}

.whitepaper-article.font-xl {
    font-size: 1.4rem;
}

/* Dark Theme Toggle */
body.light-theme .whitepaper-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    color: #1e293b;
}

body.light-theme .whitepaper-sidebar {
    background: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .whitepaper-article h1,
body.light-theme .whitepaper-article h2,
body.light-theme .whitepaper-article h3,
body.light-theme .whitepaper-article h4,
body.light-theme .whitepaper-article h5,
body.light-theme .whitepaper-article h6 {
    color: #1e40af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .whitepaper-sidebar {
        width: 300px;
    }
    
    .whitepaper-content {
        max-width: calc(100vw - 300px);
    }
}

@media (max-width: 768px) {
    .whitepaper-container {
        flex-direction: column;
    }
    
    .whitepaper-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem 0;
    }
    
    .whitepaper-content {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .whitepaper-article h1 {
        font-size: 2rem;
    }
    
    .whitepaper-article table {
        font-size: 0.85rem;
    }
    
    .whitepaper-article th,
    .whitepaper-article td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .whitepaper-content {
        padding: 1rem;
    }
    
    .whitepaper-article {
        font-size: 1rem;
    }
    
    .whitepaper-article h1 {
        font-size: 1.8rem;
    }
    
    .citation-box {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .whitepaper-sidebar,
    .content-header,
    .citation-box {
        display: none !important;
    }
    
    .whitepaper-content {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .whitepaper-article {
        color: #000 !important;
    }
    
    .whitepaper-article h1,
    .whitepaper-article h2,
    .whitepaper-article h3,
    .whitepaper-article h4,
    .whitepaper-article h5,
    .whitepaper-article h6 {
        color: #333 !important;
    }
    
    .whitepaper-article table {
        background: #fff !important;
    }
    
    .whitepaper-article th {
        background: #f5f5f5 !important;
        color: #333 !important;
    }
}

/* Custom Scrollbar */
.whitepaper-sidebar::-webkit-scrollbar,
.whitepaper-content::-webkit-scrollbar {
    width: 6px;
}

.whitepaper-sidebar::-webkit-scrollbar-track,
.whitepaper-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.whitepaper-sidebar::-webkit-scrollbar-thumb,
.whitepaper-content::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.5);
    border-radius: 3px;
}

.whitepaper-sidebar::-webkit-scrollbar-thumb:hover,
.whitepaper-content::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 165, 250, 0.7);
}

/* Fullscreen Mode */
.whitepaper-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #0a1929;
}

.whitepaper-container.fullscreen .whitepaper-sidebar {
    display: none;
}

.whitepaper-container.fullscreen .whitepaper-content {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
}
