:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --text-color: #1e293b;
    --bg-color: #f8fafc;
    --border-color: #e2e8f0;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header .lead {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sidebar Styles */
.sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar .accordion-button {
    background: transparent;
    border: none;
    font-weight: 500;
    color: var(--text-color);
    padding: 1rem 1.25rem;
}

.sidebar .accordion-button:not(.collapsed) {
    background: var(--primary-color);
    color: white;
}

.sidebar .accordion-button:focus {
    box-shadow: none;
    border: none;
}

.sidebar .accordion-body {
    padding: 0;
}

.sidebar .nav-link {
    color: var(--secondary-color);
    padding: 0.75rem 1.25rem;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
    border-radius: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--bg-color);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 16px;
}

/* Main Content Styles */
.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.main-content h1 {
    color: var(--primary-color);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.main-content h2,
.main-content h3,
.main-content h4 {
    color: var(--text-color);
    font-weight: 600;
    margin: 2rem 0 1rem 0;
}

.main-content h2 {
    font-size: 1.875rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.main-content h3 {
    font-size: 1.5rem;
}

.main-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Video Styles */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1);
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Code Block Styles */
pre {
    background: var(--code-bg) !important;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 1.5rem !important;
    margin: 1.5rem 0;
    position: relative;
    overflow-x: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

pre:before {
    content: attr(data-lang);
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Inline code */
p code, li code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Article Meta */
.article-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--secondary-color);
    flex-wrap: wrap;
}

.article-meta i {
    margin-right: 0.5rem;
}

/* Footer Styles */
.footer {
    background: var(--text-color);
    color: white;
    padding: 3rem 0 1rem 0;
    margin-top: 4rem;
}

.footer h5 {
    color: white;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: white;
}

.footer .social-links a {
    display: inline-block;
    margin-right: 1rem;
    font-size: 1.25rem;
}

.footer .copyright {
    border-top: 1px solid #374151;
    padding-top: 1rem;
    margin-top: 2rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
}

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

.footer ul li {
    margin-bottom: 0.5rem;
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .main-content h1 {
        font-size: 1.875rem;
    }
    
    .sidebar {
        margin-bottom: 2rem;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .footer .row > div {
        margin-bottom: 2rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 1rem;
    }
    
    .header {
        padding: 1.5rem 0;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header .lead {
        font-size: 1rem;
    }
    
    pre {
        padding: 1rem !important;
        font-size: 0.8rem;
    }
    
    pre:before {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.accordion-button:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sidebar,
    .footer,
    .header {
        display: none;
    }
    
    .main-content {
        box-shadow: none;
        padding: 0;
    }
    
    .container {
        max-width: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f1f5f9;
        --bg-color: #0f172a;
        --border-color: #334155;
    }
    
    .main-content {
        background: #1e293b;
    }
    
    .sidebar {
        background: #1e293b;
    }
    
    .article-meta {
        background: #0f172a;
    }
}

/* Animations */
.main-content {
    animation: fadeInUp 0.6s ease-out;
}

.sidebar {
    animation: fadeInLeft 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-body {
    background-color: #fff !important;
    color: #212529 !important;
}