:root {
    --theme-color: #D4AF37;
    --base-background-color: #0f0f0f;
    --content-max-width: 100%;
    --base-font-family: 'Inter', sans-serif;
    --sidebar-width: 320px;
}

.sidebar {
    background-color: #151515 !important;
    position: fixed !important;
    left: 0 !important;
    right: auto !important;
    top: 62px !important;
    bottom: 0 !important;
    width: 320px !important;
    margin: 0 !important;
    transform: none !important;
    border-right: 1px solid #D4AF37 !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
    scrollbar-color: #D4AF37 transparent !important;
    box-sizing: border-box !important;
    padding-bottom: 100px !important;
}

.sidebar::-webkit-scrollbar {
    width: 10px !important;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent !important;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #D4AF37 !important;
    border-radius: 5px !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #E5C158 !important;
}

.markdown-section {
    max-width: 100% !important;
    padding: 30px 40px !important;
    margin: 0 !important;
}

/* sidebar nav */
.sidebar-nav {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
}

.sidebar-nav > ul {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 6px 30px !important;
    width: 100% !important;
    padding: 0 12px !important;
    margin: 10px 0 !important;
    list-style: none !important;
    box-sizing: border-box !important;
}

.sidebar-nav li {
    box-sizing: border-box !important;
}

.sidebar-nav > ul:not(:first-of-type) > li {
    flex: 0 0 auto !important;
    width: fit-content !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar-nav li a {
    display: block !important;
    width: auto !important;
    background: #222 !important;
    border: 1px solid #333 !important;
    color: #eee !important;
    font-family: 'Monaco', monospace, sans-serif !important;
    font-size: 0.72rem !important;
    text-align: center !important;
    padding: 6px 8px !important;
    border-radius: 3px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
}

.sidebar-nav li a:hover {
    background: #2a2a2a !important;
    border-color: #D4AF37 !important;
    color: #D4AF37 !important;
}

.sidebar-nav li.active > a {
    background: #D4AF37 !important;
    color: #000 !important;
    font-weight: bold !important;
    pointer-events: none !important;
}

.sidebar-nav > ul:first-of-type li {
    width: 100% !important;
    margin-bottom: 4px !important;
}

.sidebar-nav > ul:first-of-type li a {
    width: 100% !important;
    font-family: 'Orbitron', sans-serif !important;
    text-align: left !important;
    padding: 12px 15px !important;
    border-left: 4px solid #D4AF37 !important;
    font-size: 0.85rem !important;
    white-space: normal !important;
}

/* Section headings */
.sidebar-nav strong {
    display: block !important;
    color: #D4AF37 !important;
    font-family: 'Orbitron', sans-serif !important;
    font-size: 0.8rem !important;
    margin: 20px 0 8px 10px !important;
    text-transform: uppercase !important;
}

/* Top navigation */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 10000;
    height: 62px;
    background: #151515;
    border-bottom: 2px solid #D4AF37;
    box-sizing: border-box;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 30px;
}

.top-nav > a {
    justify-self: start;
}

.nav-links {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 25px;
    white-space: nowrap;
}

.nav-links a {
    display: inline-block;
    color: #b8b8b8 !important;
    text-decoration: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Orbitron', sans-serif !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-links a:hover {
    color: #e2e2e2 !important;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.35);
}

.nav-links a.current-page {
    background: #D4AF37 !important;
    color: #111 !important;
    border: 1px solid #D4AF37;
    border-radius: 3px;
    padding: 7px 9px !important;
    cursor: default;
    pointer-events: none;
}

.nav-links a.current-page:hover {
    color: #111 !important;
    text-shadow: none;
}

/* Search bar */
#search-target {
    width: 600px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    justify-self: center;
}

.custom-search {
    width: 600px;
    position: relative;
    z-index: 20000;
}

#repo-search {
    display: block;
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    padding: 7px 42px 7px 15px;
    background: #0a0a0a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    outline: none;
    box-shadow: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    line-height: 20px;
}

#repo-search:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

#repo-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

#repo-search::-ms-clear {
    display: none;
}

#search-clear {
    position: absolute;
    right: 10px;
    top: 18px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    display: none;
    background: transparent;
    border: none;
    color: #D4AF37;
    font-family: Arial, sans-serif;
    font-size: 21px;
    font-weight: bold;
    line-height: 24px;
    cursor: pointer;
    z-index: 2;
}

#search-clear:hover {
    color: #f5c644;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    background: #151515;
    border: 1px solid #D4AF37;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    box-sizing: border-box;
}

.search-results.visible {
    display: block;
}

.search-result {
    display: block;
    padding: 11px 14px;
    color: #eee;
    text-decoration: none;
    border-bottom: 1px solid #292929;
    box-sizing: border-box;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: #2a2a2a;
    color: #D4AF37;
}

.search-result-title {
    color: #D4AF37;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0;
}

.search-result-match {
    margin-top: 4px;
    color: #888;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
}

.search-no-results {
    padding: 14px;
    color: #888;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    text-align: center;
}

.search-page-result .search-result-title {
    color: #D4AF37 !important;
    font-weight: 600;
}

.search-page-result .search-result-match {
    color: #9a9a9a !important;
}

.search-target-result .search-result-title {
    color: #ddd !important;
}

.search-target-result .search-result-match {
    color: #777 !important;
}

.search-result:hover .search-result-title {
    color: #fff !important;
}

.search-page-result:hover .search-result-title {
    color: #D4AF37 !important;
}

@media screen and (max-width: 767px) {
    .top-nav {
        width: 100%;
        max-width: 100vw;
        height: 62px;
        padding: 0 10px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        gap: 10px;
        overflow: visible;
    }

    .top-nav > a {
        flex: 0 0 auto;
    }

    .top-nav > a span {
        display: none !important;
    }

    #search-target {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: stretch;
    }

    .custom-search {
        width: 100%;
        min-width: 0;
    }

    .nav-links {
        display: none !important;
    }

    #repo-search {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #app,
    main {
        position: static !important;
        z-index: auto !important;
    }

    body.mobile-sidebar-open {
        overflow: hidden !important;
    }

    .sidebar {
        top: 62px !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 280px !important;
        transform: translateX(-100%) !important;
        transition: transform 0.25s ease !important;
        z-index: 10001 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.mobile-sidebar-open .sidebar {
        transform: translateX(0) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #mobile-sidebar-toggle {
        position: fixed;
        top: 76px;
        left: 0;
        width: 42px;
        height: 42px;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        background: #151515;
        border: 1px solid #D4AF37;
        border-left: none;
        border-radius: 0 4px 4px 0;
        cursor: pointer;
        z-index: 10002;
        transition: left 0.25s ease;
    }

    body.mobile-sidebar-open #mobile-sidebar-toggle {
        left: 280px;
    }

    #mobile-sidebar-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: #D4AF37;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    #mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 62px 0 0 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 10000;
    }

    body.mobile-sidebar-open #mobile-sidebar-overlay {
        display: block;
    }

    .markdown-section {
        max-width: 100% !important;
        padding: 20px 15px !important;
        margin: 0 !important;
    }
}