:root {
    --bs-primary: #7952b3;
}

.hero-section {
    background: linear-gradient(135deg, #7952b3 0%, #563d7c 100%) !important;
}

.feature-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
}

.feature-icon {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(121, 82, 179, 0.1);
}

.docs-sidebar .nav-link {
    padding: .5rem .75rem;
    border-radius: .375rem;
    margin-bottom: .25rem;
    font-size: .9rem;
    transition: all .2s ease;
}

.docs-sidebar .nav-link:hover {
    background-color: rgba(121, 82, 179, .08);
    color: var(--bs-primary) !important;
}

.docs-sidebar .nav-link.active {
    background-color: rgba(121, 82, 179, .12);
    color: var(--bs-primary) !important;
}

.docs-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.5rem;
    font-weight: 700;
}

.docs-content h3 {
    margin-top: 1.5rem;
    margin-bottom: .75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.docs-content p {
    line-height: 1.8;
    margin-bottom: 1rem;
}

.docs-content pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: .5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    position: relative;
}

.docs-content code {
    font-size: .875em;
}

.docs-content p code {
    background: rgba(121, 82, 179, .1);
    color: #7952b3;
    padding: .2em .4em;
    border-radius: .25rem;
}

.docs-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.docs-content ul li {
    margin-bottom: .5rem;
    line-height: 1.8;
}

.docs-content table {
    margin-bottom: 1.5rem;
}

.content-body h2:first-of-type {
    margin-top: 0;
}

/* Dark mode overrides */
[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #5a3d85 0%, #3d2b5a 100%) !important;
}

[data-bs-theme="dark"] .card {
    background-color: #2b3035;
    border-color: #373b3e;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #212529 !important;
}

[data-bs-theme="dark"] .docs-content h2 {
    border-bottom-color: #373b3e;
}

[data-bs-theme="dark"] .docs-content p code {
    background: rgba(121, 82, 179, .2);
}

[data-bs-theme="dark"] .table {
    color: #dee2e6;
}

[data-bs-theme="dark"] .table-light {
    background-color: #343a40;
    color: #dee2e6;
}

[data-bs-theme="dark"] .table-bordered {
    border-color: #373b3e;
}

[data-bs-theme="dark"] .table-bordered td,
[data-bs-theme="dark"] .table-bordered th {
    border-color: #373b3e;
}

[data-bs-theme="dark"] .icon-box {
    border-color: #373b3e !important;
}

[data-bs-theme="dark"] .icon-box:hover {
    border-color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .navbar-toggler {
    border-color: rgba(255,255,255,0.3);
}

[data-bs-theme="dark"] .search-highlight {
    background-color: rgba(121, 82, 179, 0.3);
    padding: 0 .1em;
    border-radius: .15em;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #212529 !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-bottom-color: #373b3e !important;
}

[data-bs-theme="dark"] .card-header.bg-dark {
    background-color: #1a1d21 !important;
}

[data-bs-theme="dark"] pre code {
    color: #d4d4d4;
}

/* Components page dark mode */
[data-bs-theme="dark"] .comp-card {
    background-color: #2b3035;
    border-color: #373b3e !important;
}

[data-bs-theme="dark"] .code-block {
    background: #1a1d21 !important;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .list-group-item {
    background-color: #2b3035;
    border-color: #373b3e;
    color: #dee2e6;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #343a40;
}

[data-bs-theme="dark"] .search-comp {
    background-color: #212529;
    border-color: #373b3e;
    color: #dee2e6;
}

[data-bs-theme="dark"] .search-comp::placeholder {
    color: #6c757d;
}

[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #212529 !important;
}

/* Skip-to-content link */
.visually-hidden-focusable:focus {
    clip: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    padding: .5rem 1rem !important;
    position: fixed !important;
    white-space: normal !important;
    width: auto !important;
    z-index: 1060 !important;
}

/* Back to top button */
#backToTop {
    opacity: 0.85;
    transition: opacity .2s, transform .2s;
    box-shadow: 0 .25rem .5rem rgba(0,0,0,.3);
}
#backToTop:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Cookie consent */
#cookieConsent a:hover {
    text-decoration: underline !important;
}

/* Breadcrumb spacing */
.breadcrumb-container {
    padding-top: .75rem;
    padding-bottom: .25rem;
}
[data-bs-theme="dark"] .breadcrumb-container {
    border-bottom-color: #373b3e !important;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Page TOC */
#pageToc {
    position: fixed;
    top: 100px;
    right: max(calc((100vw - 1320px) / 2 - 220px), 10px);
    width: 200px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 100;
}
#pageToc .nav-link {
    padding: .2rem .5rem;
    border-radius: .25rem;
    transition: all .15s;
    font-size: .85rem;
    line-height: 1.5;
    border-left: 2px solid transparent;
}
#pageToc .nav-link:hover {
    color: var(--bs-primary) !important;
    border-left-color: var(--bs-primary);
}
#pageToc .nav-link.active {
    color: var(--bs-primary) !important;
    border-left-color: var(--bs-primary);
    background: rgba(121,82,179,.06);
}
@media (max-width: 1599.98px) { #pageToc { display: none; } }

/* CodePen button */
.codepen-btn {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 10;
    opacity: 0.7;
    transition: opacity .15s;
}
.codepen-btn:hover { opacity: 1; }

/* Search dropdown */
.search-dropdown {
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
}
.search-dropdown .dropdown-item {
    white-space: normal;
    border-radius: 0;
}
.search-dropdown .dropdown-item:hover {
    background-color: rgba(121,82,179,.08);
}
[data-bs-theme="dark"] .search-dropdown .dropdown-item:hover {
    background-color: rgba(121,82,179,.2);
}

/* Global search modal (Ctrl+K) */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}
.search-modal-dialog {
    width: min(600px,90vw);
    background: var(--bs-body-bg);
    border-radius: .75rem;
    box-shadow: 0 1rem 3rem rgba(0,0,0,.3);
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.search-modal-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    gap: .5rem;
}
.search-modal-header input {
    font-size: 1.1rem;
    background: transparent;
    color: var(--bs-body-color);
}
.search-modal-header input::placeholder { color: var(--bs-secondary-color); }
.search-modal-header input:focus { outline: none; }
.search-modal-results {
    overflow-y: auto;
    padding: .5rem 0;
    max-height: 50vh;
}
.search-modal-results .result-item {
    display: block;
    padding: .75rem 1.25rem;
    text-decoration: none;
    color: var(--bs-body-color);
    border-left: 3px solid transparent;
    transition: all .1s;
}
.search-modal-results .result-item:hover {
    background: rgba(121,82,179,.08);
    border-left-color: var(--bs-primary);
}
.search-modal-results .result-item .result-cat {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    display: inline-block;
    margin-bottom: .15rem;
}
.search-modal-results .result-item .result-title {
    font-weight: 600;
    margin-bottom: .15rem;
}
.search-modal-results .result-item .result-desc {
    font-size: .85rem;
    color: var(--bs-secondary-color);
}
.search-modal-results .result-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--bs-secondary-color);
}
[data-bs-theme="dark"] .search-modal-overlay { background: rgba(0,0,0,.7); }

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
    display: none;
    width: 100%;
    text-align: left;
    padding: .6rem 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    color: var(--bs-body-color);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
}
.docs-sidebar-toggle:hover { background: rgba(121,82,179,.06); }
.docs-sidebar-collapse { display: block; }
@media (max-width: 767.98px) {
    .docs-sidebar-toggle { display: flex; align-items: center; justify-content: space-between; }
    .docs-sidebar-collapse { display: none; }
    .docs-sidebar-collapse.show { display: block; }
    .docs-sidebar { position: static !important; }
}

/* Social share buttons */
.share-buttons {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.share-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
}

/* Version bar backgrounds */
.version-bar-v5 { background: rgba(121,82,179,.08) !important; }
.version-bar-v4 { background: rgba(13,202,240,.08) !important; }
.version-bar-v3 { background: rgba(13,110,253,.08) !important; }
.version-bar-default { background: var(--bs-body-bg,#f8f9fa); }

/* Version switcher in sidebar */
.docs-sidebar .btn-sm.text-start { font-size: .8rem; padding: .3rem .6rem; }
.docs-sidebar .btn-sm.text-start span { font-size: .7rem; }

/* Version tabs in navbar — pill style */
.ver-tabs { border-left: 1px solid rgba(255,255,255,.15); padding-left: .75rem; display: flex; align-items: center; gap: .15rem; }
.ver-tab { display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; padding: .2rem .5rem; font-size: .75rem; font-weight: 700; line-height: 1.4; border-radius: 1rem; text-decoration: none; color: rgba(255,255,255,.5); border: 1px solid transparent; transition: all .2s ease; letter-spacing: .02em; }
.ver-tab:hover { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); text-decoration: none; }
.ver-tab.active { color: #fff; border-color: transparent; cursor: default; }
.ver-tab.active.ver-5 { background: #7952b3; box-shadow: 0 0 0 1px rgba(121,82,179,.3); }
.ver-tab.active.ver-4 { background: #0d6efd; box-shadow: 0 0 0 1px rgba(13,110,253,.3); }
.ver-tab.active.ver-3 { background: #6c757d; box-shadow: 0 0 0 1px rgba(108,117,125,.3); }
[data-bs-theme="dark"] .ver-tab.active.ver-5 { background: #6f42c1; }
[data-bs-theme="dark"] .ver-tab.active.ver-4 { background: #0a58ca; }
[data-bs-theme="dark"] .ver-tab.active.ver-3 { background: #5c636a; }
@media (max-width: 991.98px) { .ver-tabs { border-left: none; padding-left: 0; margin: .5rem 0; } }

/* Color palette tool */
.palette-swatch {
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}
.palette-swatch:hover {
  transform: scale(1.05);
  box-shadow: 0 .25rem .5rem rgba(0,0,0,.2);
}
.palette-swatch .swatch-color {
  height: 48px;
  border-radius: .375rem .375rem 0 0;
}
.palette-swatch .swatch-label {
  font-size: .75rem;
  text-align: center;
  padding: .25rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-top: 0;
  border-radius: 0 0 .375rem .375rem;
  color: var(--bs-body-color);
  font-family: monospace;
}

/* Print styles */
@media print {
    nav, footer, #backToTop, #cookieConsent, #pageToc, .docs-sidebar,
    .search-modal-overlay, .breadcrumb, .navbar, .version-bar,
    .share-buttons, .btn, .codepen-btn, .position-absolute {
        display: none !important;
    }
    body { font-size: 12pt; }
    .container { max-width: 100%; }
    .docs-content h2 { border-bottom: 1px solid #000; }
    pre { background: #f5f5f5 !important; color: #000 !important; border: 1px solid #ddd; }
    a { color: #000 !important; text-decoration: underline; }
    .col-md-9 { width: 100% !important; flex: 0 0 100% !important; }
    @page { margin: 2cm; }
}
