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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #ffffff;
    --sidebar-bg: #f8fafc;
    --text-color: #334155;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --hover-color: #f1f5f9;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #94a3b8;
    --background-color: #0f172a;
    --sidebar-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-light: #cbd5e1;
    --border-color: #334155;
    --card-bg: #1e293b;
    --hover-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Ad slot styling (site-wide placeholders) */
.ad-slot {
    border: 1px dashed var(--border-color);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
    padding: 12px 10px;
    margin: 14px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px; /* reduced default banner height */
    color: var(--muted-color, #9aa0a6);
    font-size: 13px;
}
.ad-slot .ad-placeholder{
    max-width: 860px;
    width: 100%;
    text-align: center;
}

/* Compact ad utility: use this on particularly small placements */
.ad-slot.ad-compact {
    min-height: 44px;
    padding: 8px 8px;
    font-size: 12px;
}

/* Hide certain ads on smaller screens to avoid large visual impact */
.ad-hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .ad-hide-mobile { display: none !important; }
}

/* Ensure top/bottom ad wrappers don't force oversized spacing */
.top-ad, .bottom-ad { margin: 12px 0; }
.top-ad .adsbygoogle, .bottom-ad .adsbygoogle {
    max-height: 140px; /* keep a reasonable cap */
    overflow: hidden;
}

/* Responsive: stack and reduce size on small screens */
@media (max-width: 600px) {
    .ad-slot { min-height: 60px; padding: 12px; font-size: 13px; }
}
/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.5rem;
}

.main-nav {
    display: flex;
    gap: 2rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

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

.header-actions {
    display: flex;
    gap: 1rem;
}

.search-btn, .theme-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.3s;
}

.search-btn:hover, .theme-btn:hover {
    background-color: var(--hover-color);
}

/* Theme icon animation */
.theme-btn i, .theme-icon {
    display: inline-block; /* needed for transform animations */
    transform-origin: center;
}

.theme-icon.icon-animate {
    animation: theme-icon-toggle 480ms cubic-bezier(.2,.8,.2,1);
}

@keyframes theme-icon-toggle {
    0% {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 1;
    }
    25% {
        transform: translateY(-8px) rotate(-18deg) scale(1.15);
        opacity: 0.9;
    }
    60% {
        transform: translateY(8px) rotate(18deg) scale(0.95);
        opacity: 0.7;
    }
    100% {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 1;
    }
}

/* Main Layout */
.main-layout {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 2rem 0;
}

.sidebar-nav {
    padding: 0 1.5rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    margin-bottom: 0.5rem;
}

.nav-section a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 0.5rem;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-section a:hover {
    background-color: var(--hover-color);
    color: var(--primary-color);
}

.nav-section a.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-section a i {
    width: 1rem;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

.content-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Doc Hero */
.doc-hero {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 3rem;
}

.doc-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.doc-hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    display: flex;
    max-width: 400px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.hero-search input {
    flex: 1;
    border: none;
    padding: 1rem 1.5rem;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
}

.hero-search input:focus {
    outline: none;
}

.hero-search button {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.hero-search button:hover {
    background: var(--primary-dark);
}

/* Quick Start */
.quick-start {
    margin-bottom: 3rem;
}

.quick-start h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.25rem;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s;
}

.card-link:hover {
    gap: 0.75rem;
}

/* Documentation Sections */
.doc-section {
    margin-bottom: 3rem;
}

.doc-section h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.articles-grid {
    display: grid;
    gap: 1.5rem;
}

.article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.article:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.article h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article h3 i {
    color: var(--primary-color);
}

.article p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.reading-time {
    color: var(--text-light);
}

.difficulty {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Ad Section */
.ad-section {
    margin: 3rem 0;
}

.ad-placeholder {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: white;
}

.ad-content i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.ad-content h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Updates Section */
.updates-section h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.updates-list {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.update-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.update-item:last-child {
    border-bottom: none;
}

.update-item:hover {
    background-color: var(--hover-color);
}

.update-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.update-text {
    flex: 1;
    font-weight: 500;
}

.update-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Ensure footer content aligns with main content when sidebar is fixed */
@media (min-width: 1025px) {
    .footer {
        margin-left: 280px; /* same width as .sidebar to prevent overlap */
    }
    .footer-container {
        max-width: 800px; /* match .content-container width for alignment */
        margin-left: 0; /* keep container centered within the shifted footer */
    }
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    padding: 3rem 0;
}

.footer-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section p {
    color: var(--text-light);
    line-height: 1.6;
}

.footer-section a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

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

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-container {
        padding: 0 1rem;
    }
    
    .main-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .doc-hero h1 {
        font-size: 2rem;
    }
    
    .doc-hero p {
        font-size: 1.125rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .content-container {
        max-width: 100%;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.25rem;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* Theme switch styles */
.theme-switch {
    --switch-width: 48px;
    --switch-height: 26px;
    --knob-size: 20px;
    width: var(--switch-width);
    height: var(--switch-height);
    background: var(--hover-color);
    border-radius: var(--switch-height);
    position: relative;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    transition: background 0.25s;
    border: 1px solid var(--border-color);
}

.theme-switch[data-on="true"] {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-color: transparent;
}

.theme-switch .knob {
    position: absolute;
    top: 50%;
    left: 3px;
    width: var(--knob-size);
    height: var(--knob-size);
    background: white;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: left 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.theme-switch[data-on="true"] .knob {
    left: calc(100% - var(--knob-size) - 3px);
}

.theme-switch .knob i {
    font-size: 0.75rem;
    display: block;
    line-height: var(--knob-size);
    text-align: center;
    color: var(--text-color);
}