/* Document Viewer - Wikipedia-like Styling */

.doc-viewer-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: #6c757d;
}

.breadcrumb a {
    color: #183661;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 0.5rem;
    color: #adb5bd;
}

.breadcrumb .current {
    color: #495057;
    font-weight: 500;
}

.toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Simple unstyled links - no button styling at all */
.toolbar .btn,
.toolbar .btn-primary,
.toolbar .btn-secondary {
    display: inline;
    padding: 0;
    border: none;
    border-radius: 0;
    text-decoration: none;
    font-size: inherit;
    font-weight: normal;
    transition: none;
    background: transparent !important;
    color: inherit !important;
    cursor: pointer;
    margin-right: 1rem;
}

.toolbar .btn:last-child,
.toolbar .btn-primary:last-child,
.toolbar .btn-secondary:last-child {
    margin-right: 0;
}

.toolbar .btn:hover,
.toolbar .btn-primary:hover,
.toolbar .btn-secondary:hover {
    background: transparent !important;
    color: inherit !important;
    text-decoration: underline;
    transform: none;
    box-shadow: none;
}

/* Wikipedia-style Layout */
.doc-viewer-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .doc-viewer-layout {
        grid-template-columns: 280px 1fr;
    }
}

/* Table of Contents Sidebar */
.toc {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 80vh;
    overflow: auto;
    position: sticky;
    top: 100px;
    align-self: start;
}

.toc h2 {
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    color: #183661;
    font-weight: 600;
}

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

.toc li {
    margin: 0.5rem 0;
}

.toc ul ul {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.toc a {
    color: #183661;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.5;
    display: block;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.toc a:hover {
    color: #64748b;
    text-decoration: underline;
}

/* Main Content Area */
.content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2.5rem;
    line-height: 1.7;
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.content h1 {
    font-size: 2.25rem;
    margin: 0 0 1.5rem 0;
    color: #183661;
    font-weight: 700;
    line-height: 1.2;
    border-bottom: 3px solid #183661;
    padding-bottom: 0.75rem;
}

.content h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem 0;
    color: #183661;
    font-weight: 600;
    line-height: 1.3;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.content h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.75rem 0;
    color: #2c4c80;
    font-weight: 600;
    line-height: 1.4;
}

.content h4 {
    font-size: 1.2rem;
    margin: 1.25rem 0 0.5rem 0;
    color: #2c4c80;
    font-weight: 600;
}

.content p {
    margin: 1rem 0;
    line-height: 1.7;
}

.content ul,
.content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.content li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.content a {
    color: #183661;
    text-decoration: underline;
}

.content a:hover {
    color: #64748b;
}

/* Code Blocks */
.content pre {
    background: #f5f7fa;
    color: #111827;
    padding: 1.25rem;
    overflow: auto;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.content :not(pre) > code {
    background: #f5f7fa;
    color: #111827;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
}

.content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0;
    border: none;
}

/* Tables */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border: 1px solid #e2e8f0;
}

.content th,
.content td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
}

.content th {
    background: #f8fafc;
    font-weight: 600;
    color: #183661;
}

.content tr:nth-child(even) {
    background: #f8fafc;
}

/* Blockquotes */
.content blockquote {
    border-left: 4px solid #183661;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: #495057;
    font-style: italic;
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-radius: 4px;
}

/* Images */
.content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Horizontal Rules */
.content hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 2rem 0;
}

/* Top Button */
.top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    background: #183661;
    color: #ffffff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(24, 54, 97, 0.3);
    transition: all 0.3s ease;
    z-index: 100;
}

.top:hover {
    background: #2c4c80;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(24, 54, 97, 0.4);
}

/* Error Message */
.error-message {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-left: 4px solid #e53e3e;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.error-message h2 {
    color: #e53e3e;
    margin: 0 0 1rem 0;
}

.error-message p {
    color: #495057;
    margin: 0 0 1.5rem 0;
}

.error-message a {
    color: #183661;
    text-decoration: none;
    font-weight: 600;
}

.error-message a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 991px) {
    .doc-viewer-layout {
        grid-template-columns: 1fr;
    }

    .toc {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 1.5rem;
    }

    .content {
        padding: 1.5rem;
    }

    .content h1 {
        font-size: 1.75rem;
    }

    .content h2 {
        font-size: 1.5rem;
    }

    .content h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .content {
        padding: 1.25rem;
    }

    .content h1 {
        font-size: 1.5rem;
    }

    .content h2 {
        font-size: 1.35rem;
    }

    .top {
        right: 1rem;
        bottom: 1rem;
        width: 44px;
        height: 44px;
        font-size: 0.75rem;
    }
}
