/* Page-specific styles for content pages */

/* Page Layout */
.page-content {
    margin-top: 70px;
}

.page-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: var(--text-white);
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.breadcrumb a {
    color: var(--text-white);
    text-decoration: none;
}

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

.breadcrumb span {
    margin: 0 0.5rem;
    opacity: 0.6;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.page-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

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

.page-meta .difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reading-time,
.last-updated {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Main Content Layout */
.page-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

/* Sidebar */
.page-sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
}

.sidebar-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.sidebar-content h3,
.sidebar-content h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toc {
    list-style: none;
    margin-bottom: 2rem;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.25rem 0;
    display: block;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.toc a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding-left: 0.5rem;
}

.toc a.active {
    color: var(--primary-color);
    font-weight: 500;
    background: rgba(37, 99, 235, 0.1);
    padding-left: 0.5rem;
}

.sidebar-nav {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.nav-next,
.nav-prev {
    display: block;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.nav-next:hover,
.nav-prev:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-next span,
.nav-prev span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: block;
}

.nav-next strong,
.nav-prev strong {
    font-weight: 500;
    color: var(--text-primary);
}

/* Article Content */
.page-article {
    max-width: none;
    line-height: 1.7;
}

.page-article h1,
.page-article h2,
.page-article h3,
.page-article h4,
.page-article h5,
.page-article h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.page-article h1 {
    font-size: 2.5rem;
    margin-top: 0;
}

.page-article h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.page-article h3 {
    font-size: 1.5rem;
}

.page-article h4 {
    font-size: 1.25rem;
}

.page-article p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.page-article ul,
.page-article ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.page-article li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.page-article blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
}

.page-article blockquote p {
    margin: 0;
    font-style: italic;
}

/* Code Blocks */
.code-block {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.code-header {
    background: var(--bg-dark);
    color: var(--text-white);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.code-title {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    background: var(--bg-darker);
    overflow-x: auto;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Inline code */
.page-article code:not(.hljs) {
    background: var(--bg-secondary);
    color: var(--error-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* Alerts and Callouts */
.alert {
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border-left: 4px solid;
}

.alert h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.alert ul {
    margin-bottom: 0;
}

.alert-info {
    background: #eff6ff;
    border-color: var(--primary-color);
    color: #1e40af;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-success {
    background: #ecfdf5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border-color: var(--error-color);
    color: #991b1b;
}

.callout {
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border: 1px solid;
}

.callout h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.callout-primary {
    background: #eff6ff;
    border-color: var(--primary-color);
    color: #1e40af;
}

.callout-success {
    background: #ecfdf5;
    border-color: var(--success-color);
    color: #065f46;
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.feature-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.feature-content h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.feature-content p {
    margin: 0;
    color: var(--text-secondary);
}

/* Limitations Grid */
.limitations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.limitation {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.limitation h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.limitation p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Chapter Navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.chapter-navigation .nav-prev {
    text-align: left;
}

.chapter-navigation .nav-next {
    text-align: right;
    margin-left: auto;
}

/* Tables */
.page-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.page-article th,
.page-article td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.page-article th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.page-article td {
    color: var(--text-secondary);
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .page-container {
        grid-template-columns: 200px 1fr;
        gap: 2rem;
    }
    
    .page-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .page-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .page-sidebar {
        position: static;
        order: 1;
    }
    
    .page-article {
        order: 2;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1.125rem;
    }
    
    .page-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .features-list .feature {
        flex-direction: column;
        text-align: center;
    }
    
    .limitations-grid {
        grid-template-columns: 1fr;
    }
    
    .chapter-navigation {
        flex-direction: column;
    }
    
    .chapter-navigation .nav-next {
        margin-left: 0;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 2rem 0;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-container {
        padding: 0 1rem;
    }
    
    .code-block pre {
        padding: 1rem;
    }
    
    .alert,
    .callout {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .page-sidebar,
    .chapter-navigation,
    .footer {
        display: none;
    }
    
    .page-content {
        margin-top: 0;
    }
    
    .page-container {
        grid-template-columns: 1fr;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .page-header {
        background: none;
        color: black;
    }
    
    .alert,
    .callout {
        border: 1px solid #ccc;
        background: #f9f9f9;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus management */
.page-article :target {
    scroll-margin-top: 90px;
}

/* Skip to content */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1001;
    border-radius: 4px;
}

.skip-to-content:focus {
    top: 6px;
}

/* Quiz Styles */
.quiz-section {
    margin-top: 4rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.quiz-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.quiz-form {
    margin-top: 2rem;
}

.quiz-question {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.quiz-question h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.quiz-option input[type="radio"] {
    margin-right: 0.75rem;
    accent-color: var(--primary-color);
}

.quiz-option span {
    color: var(--text-primary);
    font-weight: 500;
}

.quiz-submit-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 1rem;
}

.quiz-submit-btn:hover {
    background: var(--primary-dark);
}

.quiz-submit-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.quiz-results {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.quiz-score {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

.quiz-score.excellent {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.quiz-score.good {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.quiz-score.needs-improvement {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.quiz-feedback {
    margin-bottom: 1.5rem;
}

.question-feedback {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.question-feedback.correct {
    background: #dcfce7;
    border-left-color: #16a34a;
}

.question-feedback.incorrect {
    background: #fee2e2;
    border-left-color: #dc2626;
}

.question-feedback h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.question-feedback.correct h4 {
    color: #166534;
}

.question-feedback.incorrect h4 {
    color: #dc2626;
}

.question-feedback p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.question-feedback.correct p {
    color: #166534;
}

.question-feedback.incorrect p {
    color: #dc2626;
}

.quiz-retake-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.quiz-retake-btn:hover {
    background: #0ea5e9;
}