/* Hide the main page title when hero is present */
body:has(.hero-container) .bd-page-width>.bd-content>.bd-article-container h1:first-of-type {
    display: none;
}

/* Hide right sidebar (table of contents) on index page */
body:has(.hero-container) .bd-sidebar-secondary {
    display: none !important;
}

/* Make main content full width when right sidebar is hidden */
body:has(.hero-container) .bd-page-width {
    max-width: none;
}

body:has(.hero-container) .bd-container-fluid {
    max-width: 100%;
}

/* Navigation sidebar overlay styles - work with theme's native behavior */
@media (min-width: 960px) {

    /* On desktop, make sidebar overlay on main index page */
    body.main-index-page .bd-sidebar-primary {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        width: 350px;
        background: var(--pst-color-surface);
    }

    /* Show sidebar when checkbox is checked */
    body.main-index-page #__primary:checked~.bd-container .bd-sidebar-primary {
        transform: translateX(0);
    }

    /* Ensure main content takes full width on index page */
    body.main-index-page .bd-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Center the main content container */
    body.main-index-page .bd-article-container {
        margin: 0 auto !important;
        max-width: 1600px !important;
        width: 100% !important;
        padding: 0 2rem !important;
    }

    /* Ensure the main content area is properly centered */
    body.main-index-page .bd-main {
        margin: 0 auto !important;
        max-width: 100% !important;
    }

    /* Center all content sections on the index page */
    body.main-index-page .bd-article>section,
    body.main-index-page .bd-article>.section {
        max-width: 1600px;
        margin: 0 auto;
        padding: 0 2rem;
    }

    /* Add overlay when sidebar is open on index page */
    body.main-index-page #__primary:checked~.bd-container::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        pointer-events: none;
    }
}

/* Fix navbar layout and alignment */
.bd-navbar {
    display: flex !important;
    align-items: center !important;
    min-height: 3rem !important;
}

.bd-navbar .navbar-brand {
    display: flex !important;
    align-items: center !important;
}

.bd-navbar .navbar-nav {
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
}

.bd-navbar .navbar-nav .nav-item {
    display: flex !important;
    align-items: center !important;
    margin-left: 0.5rem !important;
}

/* Fix sidebar toggle button alignment */
.bd-navbar .sidebar-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    padding: 0 !important;
    border-radius: 0.375rem !important;
}

/* Fix dark/light mode switch alignment */
.theme-switch-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.25rem !important;
    margin: 0 !important;
    border-radius: 0.375rem !important;
}

/* Ensure theme toggle is properly aligned in navbar */
.bd-navbar .navbar-nav .nav-item .theme-switch-button {
    height: auto !important;
    min-height: 2rem !important;
    vertical-align: middle !important;
}

/* Fix navbar item alignment */
.bd-navbar .navbar-nav {
    align-items: center !important;
}

.bd-navbar .navbar-nav .nav-item {
    display: flex !important;
    align-items: center !important;
}

/* Responsive adjustments for mobile sidebar */
@media (max-width: 959px) {

    /* Let theme handle mobile sidebar naturally */
    body.main-index-page .bd-sidebar-primary {
        position: relative;
        transform: none;
        width: auto;
    }

    /* Ensure content is centered on mobile too */
    body.main-index-page .bd-article-container {
        margin: 0 auto !important;
        padding: 0 1rem !important;
    }
}

/* Hero container with proper sidebar handling */
.hero-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    margin: 0 calc(-1 * var(--bd-content-padding-x)) 3rem calc(-1 * var(--bd-content-padding-x));
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    /* Use CSS variables to respect theme padding */
    width: calc(100% + 2 * var(--bd-content-padding-x));
}

/* Responsive hero container */
@media (max-width: 1200px) {
    .hero-container {
        padding: 3rem 0;
    }
}

@media (max-width: 768px) {
    .hero-container {
        padding: 2rem 0;
    }
}

.hero-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #fff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-highlight {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #fbbf24;
    color: #1f2937;
}

.btn-primary:hover {
    background: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(251, 191, 36, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.hero-demo {
    position: relative;
}

.code-example {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.code-dots {
    display: flex;
    gap: 0.5rem;
}

.code-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.code-dots span:nth-child(1) {
    background: #ff5f56;
}

.code-dots span:nth-child(2) {
    background: #ffbd2e;
}

.code-dots span:nth-child(3) {
    background: #27ca3f;
}

.code-example pre {
    margin: 0;
    padding: 1.5rem;
    background: transparent;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
}

.code-example code {
    color: #e5e7eb;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* Product offerings grid styling with theme-aware colors */
.product-offerings {
    margin: 3rem auto;
    max-width: 1600px;
    padding: 0 2rem;
}

.product-offerings .sd-card {
    text-align: center;
    padding: 2rem 1rem;
    border: none !important;
    box-shadow: none !important;
}

.product-offerings .sd-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    /* Theme-aware text color */
    color: var(--pst-color-text-base, #374151);
}

/* Dark mode support for product offerings */
[data-theme="dark"] .product-offerings .sd-card-title,
html[data-theme="dark"] .product-offerings .sd-card-title {
    color: var(--pst-color-text-base, #e5e7eb);
}

.product-offerings .sd-card-text {
    line-height: 1.6;
    /* Theme-aware text color */
    color: var(--pst-color-text-muted, #6b7280);
}

/* Dark mode support for product offerings text */
[data-theme="dark"] .product-offerings .sd-card-text,
html[data-theme="dark"] .product-offerings .sd-card-text {
    color: var(--pst-color-text-muted, #9ca3af);
}

/* Color cards grid styling */
.color-cards {
    margin: 2rem auto;
    gap: 2rem;
    max-width: 1600px;
    padding: 0 2rem;
}

.color-cards .sd-card {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.color-cards .sd-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: white;
}

.color-cards .installation {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.color-cards .getting-started {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.color-cards .user-guides {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.color-cards .sd-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.color-cards .sd-card-text {
    font-size: 0.9rem;
    opacity: 0.9;
    color: white;
}

.color-cards .material-icons {
    font-size: 2em;
    margin-bottom: 1rem;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .code-example {
        margin-top: 2rem;
    }

    .hero-buttons {
        justify-content: center;
    }
}

/* Ensure grids work properly with the theme */
.sd-container-fluid {
    max-width: 100%;
}

.sd-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

/* Fix for sidebar interaction - remove the old conflicting rules */
.sd-col {
    flex: 0 0 auto;
    padding: 0 0.5rem;
}