/* Additional styles for documentation pages */

/* Additional CSS variables for documentation pages */
:root {
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
}

[data-theme="dark"] {
    --card-bg: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
}

/* Documentation Header */
.docs-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    padding: 30px 20px;
    position: relative;
}

.docs-header .container {
    position: relative;
}

.docs-header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: white;
}

.docs-header h1 a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.docs-header h1 a:visited {
    color: white;
}

.docs-header h1 a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.docs-header .tagline {
    font-size: 1.2rem;
    margin: 0;
    color: white;
    opacity: 0.95;
}

/* Documentation Navigation */
.docs-nav {
    background-color: var(--secondary-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.docs-nav .container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    position: relative;
}

.docs-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.docs-nav a:hover {
    opacity: 0.8;
}

.docs-nav a.active {
    font-weight: 700;
    color: white;
    border-bottom: 3px solid white;
    padding-bottom: 3px;
}

/* Theme Toggle Button for docs pages */
.docs-nav .theme-toggle {
    position: absolute;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.docs-nav .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.docs-nav .theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    line-height: 1;
    display: inline-block;
}

/* Improve link readability in dark mode */
[data-theme="dark"] article a {
    color: #66b3ff;
}

[data-theme="dark"] article a:visited {
    color: #b39ddb;
}

[data-theme="dark"] article a:hover {
    color: #99ccff;
}

/* Documentation Content Layout */
.docs-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
    margin-top: 40px;
    align-items: start;
}

/* Table of Contents */
.toc {
    position: sticky;
    top: 80px;
    background: var(--code-background);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.toc h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: var(--secondary-color);
}

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

.toc ul ul {
    margin-left: 15px;
    margin-top: 5px;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.toc a:hover {
    color: var(--primary-color);
}

/* Article Content */
article {
    max-width: 900px;
}

article h2 {
    font-size: 2.2rem;
    margin-top: 60px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

article h2:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

article h3 {
    font-size: 1.6rem;
    margin-top: 40px;
    margin-bottom: 15px;
}

article h4 {
    font-size: 1.3rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: var(--secondary-color);
}

/* Info Boxes */
.info-box,
.warning-box,
.algorithm-box {
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid;
}

.info-box {
    background-color: #e7f3ff;
    border-color: var(--primary-color);
}

.warning-box {
    background-color: #fff3cd;
    border-color: var(--warning-color);
}

.algorithm-box {
    background-color: #e8f5e9;
    border-color: var(--success-color);
}

.info-box p,
.warning-box p,
.algorithm-box p {
    margin: 0;
}

.algorithm-box ol {
    margin: 10px 0 0 0;
    padding-left: 25px;
}

.algorithm-box li {
    margin-bottom: 8px;
}

/* Tables */
.spec-table,
.property-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.spec-table th,
.property-table th {
    background-color: var(--secondary-color);
    color: white;
    padding: 12px;
    text-align: left;
}

.spec-table td,
.property-table td {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
}

.spec-table code,
.property-table code {
    background-color: transparent;
    border: none;
    padding: 0;
}

/* Code Examples */
.code-example {
    margin: 25px 0;
}

.code-example h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Parse Example */
.parse-example {
    background-color: var(--code-background);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.parse-example h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.parse-example ul {
    margin: 10px 0;
    padding-left: 25px;
}

.parse-example li {
    margin-bottom: 5px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* Consideration Blocks */
.consideration {
    background-color: var(--code-background);
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    border-left: 4px solid var(--primary-color);
}

.consideration h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.4rem;
}

.consideration ul {
    margin: 10px 0;
    padding-left: 25px;
}

.consideration li {
    margin-bottom: 8px;
}

/* Architecture Diagrams */
.architecture-section {
    margin: 30px 0;
}

.pipeline-diagram {
    background-color: var(--code-background);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0;
    overflow-x: auto;
}

.pipeline-diagram pre {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
}

/* Phase Comparison */
.phase-comparison {
    background-color: var(--code-background);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.phase-comparison h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.phase-comparison pre {
    margin: 10px 0;
}

.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.pros,
.cons {
    padding: 15px;
    border-radius: 5px;
}

.pros {
    background-color: #e8f5e9;
    border-left: 4px solid var(--success-color);
}

.cons {
    background-color: #ffebee;
    border-left: 4px solid #d32f2f;
}

.pros h5,
.cons h5 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.pros ul,
.cons ul {
    margin: 0;
    padding-left: 20px;
}

/* Performance Table */
.performance-table {
    margin: 30px 0;
}

.performance-table table {
    width: 100%;
}

.performance-table th {
    background-color: var(--primary-color);
}

/* Related Documentation */
.related-docs {
    background-color: #f0f7ff;
    padding: 25px;
    border-radius: 8px;
    margin-top: 50px;
    margin-bottom: 40px;
    border: 2px solid var(--primary-color);
}

.related-docs h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.related-docs ul {
    margin: 0;
    padding-left: 25px;
}

.related-docs li {
    margin-bottom: 10px;
}

.related-docs a {
    color: var(--primary-color);
    font-weight: 500;
}

/* Dark mode for related docs */
[data-theme="dark"] .related-docs {
    background-color: #1a2b3d;
    border-color: var(--primary-color);
}

[data-theme="dark"] .related-docs h3 {
    color: var(--primary-color);
}

[data-theme="dark"] .related-docs a {
    color: #66b3ff;
}

/* Dark mode for pros-cons boxes */
[data-theme="dark"] .pros {
    background-color: #1a3a1a;
    border-left-color: #4caf50;
    color: #e0e0e0;
}

[data-theme="dark"] .cons {
    background-color: #3a1a1a;
    border-left-color: #f44336;
    color: #e0e0e0;
}

[data-theme="dark"] .pros h5,
[data-theme="dark"] .cons h5 {
    color: #ffffff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .docs-content {
        grid-template-columns: 200px 1fr;
        gap: 30px;
    }
    
    .toc {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .docs-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .toc {
        position: static;
        margin-bottom: 30px;
    }
    
    article h2 {
        font-size: 1.8rem;
    }
    
    article h3 {
        font-size: 1.4rem;
    }
    
    .pros-cons {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .spec-table,
    .property-table {
        font-size: 0.85rem;
    }
    
    .spec-table th,
    .spec-table td,
    .property-table th,
    .property-table td {
        padding: 8px;
    }
}

/* Statement Grid for ANTLR4 documentation */
.statement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.statement-category {
    background: var(--code-background);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.statement-category h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

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

.statement-category li {
    padding: 5px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Keyword Grid for ANTLR4 documentation */
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.keyword-grid div {
    background: var(--code-background);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .docs-header h1 {
        font-size: 1.5rem;
    }
    
    .docs-header .tagline {
        font-size: 1rem;
    }
    
    article h2 {
        font-size: 1.5rem;
    }
    
    /* Make tables scrollable on small screens */
    .spec-table,
    .property-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
