/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background-color: #fafafa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Full Width */
.site-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo a {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-icon {
    font-size: 2rem;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.15);
}

.nav-link.active {
    background-color: rgba(255,255,255,0.25);
    font-weight: 600;
}

.nav-link-github {
    margin-left: 1rem;
    background-color: rgba(255,255,255,0.1);
}

.external-icon {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Layout Wrapper - Full Width with Sidebar */
.layout-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 100%;
}

body.has-sidebar .layout-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
}

/* Sidebar */
.sidebar {
    background: white;
    border-right: 1px solid #e5e7eb;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    overflow-y: auto;
}

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

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

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 1rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 0;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-size: 0.95rem;
    margin: 0.125rem 0;
}

.sidebar-link:hover {
    background-color: #f3f4f6;
    color: #667eea;
    text-decoration: none;
}

.sidebar-link.active {
    background-color: #ede9fe;
    color: #667eea;
    font-weight: 600;
    border-left: 3px solid #667eea;
    padding-left: calc(1rem - 3px);
}

/* Main content - Full Width */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 100%;
    background: white;
}

body:not(.has-sidebar) .main-content {
    margin: 0;
}

body.has-sidebar .main-content {
    padding: 3rem 4rem;
    max-width: 1400px;
}

.page-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #111827;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.page-header time {
    color: #6b7280;
    font-style: italic;
    font-size: 0.95rem;
}

.content {
    max-width: 100%;
}

body:not(.has-sidebar) .content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 2rem 0 1rem 0;
    color: #111827;
    line-height: 1.3;
    font-weight: 600;
}

h1 { font-size: 2.5rem; }
h2 {
    font-size: 1.875rem;
    padding-bottom: 0.5rem;
    margin-top: 3rem;
}
h3 {
    font-size: 1.5rem;
    color: #374151;
}
h4 {
    font-size: 1.25rem;
    color: #374151;
}

p {
    margin: 1rem 0;
    color: #374151;
    line-height: 1.7;
}

a {
    color: #667eea;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.content h1 a,
.content h2 a,
.content h3 a,
.content h4 a {
    color: inherit;
}

.content h1 a:hover,
.content h2 a:hover,
.content h3 a:hover,
.content h4 a:hover {
    text-decoration: none;
}

/* Lists */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
    color: #374151;
}

li {
    margin: 0.5rem 0;
    line-height: 1.7;
}

/* Code blocks */
pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

code {
    background: #f1f3f5;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 0.875em;
    color: #e83e8c;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid #d1d5db;
}

tr:hover {
    background-color: #f9fafb;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #6b7280;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6rem 2rem;
    text-align: center;
}

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

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: white;
    line-height: 1.2;
}

.hero-description {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 1rem;
    display: inline-block;
}

.btn-primary {
    background: white;
    color: #667eea;
}

.btn-primary:hover {
    background: #f9fafb;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

/* Features Section */
.features {
    padding: 5rem 2rem;
    background: white;
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #111827;
}

.feature-description {
    font-size: 1rem;
    line-height: 1.7;
    color: #6b7280;
}

/* Posts Section */
.posts-section {
    padding: 5rem 2rem;
    background: #fafafa;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: #111827;
}

.posts-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.post-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.2s;
}

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

.post-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.post-card h3 a {
    color: #111827;
}

.post-card h3 a:hover {
    color: #667eea;
    text-decoration: none;
}

.post-card time {
    color: #6b7280;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 1rem;
}

.post-card .excerpt {
    margin: 1rem 0;
    color: #6b7280;
    line-height: 1.7;
}

.post-card .read-more {
    color: #667eea;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
}

/* Home page specific */
.page.home .content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Post previews */
.post-preview {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 1.5rem 0;
    transition: box-shadow 0.2s;
}

.post-preview:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-preview h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.post-preview time {
    color: #6b7280;
    font-size: 0.875rem;
}

.post-preview .excerpt {
    margin: 1rem 0;
    color: #6b7280;
    line-height: 1.7;
}

.read-more {
    color: #667eea;
    font-weight: 500;
}

/* Post navigation */
.post-nav {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.back-home {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.back-home:hover {
    text-decoration: underline;
}

/* Footer */
.site-footer {
    background: #1f2937;
    color: #d1d5db;
    padding: 3rem 2rem;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-info p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    color: #d1d5db;
    text-decoration: none;
}

.footer-links a:hover {
    color: #667eea;
}

.separator {
    opacity: 0.5;
}

/* Responsive design */
@media (max-width: 1024px) {
    body.has-sidebar .layout-wrapper {
        grid-template-columns: 240px 1fr;
    }

    body.has-sidebar .main-content {
        padding: 2rem 3rem;
    }
}

@media (max-width: 768px) {
    .header-wrapper {
        padding: 0 1rem;
        height: auto;
        min-height: 60px;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .main-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    body.has-sidebar .layout-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    body.has-sidebar .main-content {
        padding: 2rem 1.5rem;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .content {
        padding: 0;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    table {
        font-size: 0.85rem;
    }

    pre {
        padding: 1rem;
        font-size: 0.8rem;
    }

    /* Hero responsive */
    .hero {
        padding: 4rem 1.5rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1.125rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    /* Features responsive */
    .features {
        padding: 3rem 1.5rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Posts responsive */
    .posts-section {
        padding: 3rem 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* API Navigation Styles */
.api-submenu {
    list-style: none;
    padding-left: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 2px solid #e5e7eb;
}

.api-category-item {
    margin: 0.25rem 0;
}

.api-category-label {
    display: block;
    padding: 0.25rem 0.5rem;
    color: #9ca3af;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.125rem;
}

.api-category-list {
    list-style: none;
    padding-left: 0.5rem;
    margin: 0 0 0.5rem 0;
}

.api-submenu-item {
    margin: 0;
}

.api-link {
    display: block;
    padding: 0.25rem 0.5rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 0.25rem;
    transition: all 0.15s;
    margin: 0.0625rem 0;
}

.api-link:hover {
    color: #667eea;
    background-color: #f9fafb;
    text-decoration: none;
}

.api-link.active {
    color: #667eea;
    background-color: #ede9fe;
    font-weight: 600;
}

/* API Reference Page Styles */
.config-category {
    margin: 3rem 0;
}

.category-title {
    font-size: 1.75rem;
    color: #111827;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
    text-transform: capitalize;
}

.api-item {
    margin: 2rem 0;
    padding: 1.5rem;
    border-left: 3px solid #e5e7eb;
    background: #fafafa;
    border-radius: 0.5rem;
    transition: all 0.2s;
    scroll-margin-top: 100px;
}

.api-item:target {
    border-left-color: #667eea;
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.api-item h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.api-item h4 code {
    font-size: 1.1rem;
    color: #667eea;
    background: white;
    padding: 0.25rem 0.5rem;
    border: 1px solid #e5e7eb;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.required {
    background: #fee2e2;
    color: #991b1b;
}

.api-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.api-meta dt {
    font-weight: 600;
    color: #6b7280;
}

.api-meta dd {
    margin: 0;
    color: #374151;
}

.api-meta code {
    font-size: 0.85rem;
}

.api-description {
    color: #374151;
    line-height: 1.7;
}

.api-description p:first-child {
    margin-top: 0;
}

.api-description p:last-child {
    margin-bottom: 0;
}

.api-link-out {
    color: #667eea;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.api-link-out:hover {
    text-decoration: underline;
}

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

/* Responsive API styles */
@media (max-width: 768px) {
    .api-item {
        padding: 1rem;
        scroll-margin-top: 80px;
    }

    .api-item h4 {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .api-meta {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .api-meta dt {
        margin-top: 0.5rem;
    }

    .api-meta dt:first-child {
        margin-top: 0;
    }
}
