:root {
    --bg-color: #0f111a;
    --sidebar-bg: #151822;
    --text-main: #94a3b8;
    --text-heading: #f8fafc;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-color: #1e293b;
    --code-bg: #1e212b;
    --hover-bg: #1e2433;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
#sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

#sidebar h1 {
    font-size: 1.25rem;
    color: var(--text-heading);
    margin-bottom: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    background-color: var(--hover-bg);
    color: var(--text-heading);
    transform: translateX(4px);
}

.nav-link.active {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    box-shadow: inset 20px 0 20px -20px var(--accent-glow);
    font-weight: 500;
}

/* Main Content Styling */
#main-content {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 3rem 4rem;
    scroll-behavior: smooth;
}

.content-wrapper {
    margin: 0 auto;
}

.heading-note {
    font-weight: normal;
    font-size: 0.7em;
    font-style: italic;
    padding-left: 1.5rem;
}

ul.status-codes {
    margin-left: 1rem;
}

ul.status-codes li {
    color: #b15b15;
    font-family: "Fira Code", monospace, "Lucida Console", Courier, monospace;
    padding: 0.5rem 0 0 0;
}

ul.status-codes li code:first-child {
    color: #c5d121;
    font-size: 1.2em;
    font-weight: bold;
}

h1,
h2,
h3,
h4 {
    color: var(--text-heading);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
}
h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 4rem;
}
h3 {
    font-size: 1.25rem;
    color: #e2e8f0;
}

p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Code and Pre blocks */
code {
    font-family: "Fira Code", monospace;
    font-size: 0.875rem;
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #38bdf8;
}

pre {
    background-color: var(--code-bg) !important;
    padding: 1.25rem !important;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem !important;
    border: 1px solid var(--border-color);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background-color: var(--sidebar-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
td:first-child {
    white-space: nowrap;
    width: 20%;
}
td:first-child code {
    font-weight: bold;
    font-size: 1.2em;
    line-height: 1.5;
    color: #3ba394;
}

th {
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-heading);
}

tr:last-child td {
    border-bottom: none;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1.5rem;
    color: #cbd5e1;
    background-color: rgba(59, 130, 246, 0.05);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

hr {
    border: 1px solid var(--border-color);
    margin-top: 3rem;
    margin-bottom: 3rem;
}

/* Search Mechanism */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    transition: color 0.2s ease;
}

#api-search {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    background-color: rgba(15, 17, 26, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-heading);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#api-search::placeholder {
    color: #64748b;
}

#api-search:focus {
    border-color: var(--accent-color);
    background-color: rgba(15, 17, 26, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#api-search:focus ~ .search-icon {
    color: var(--accent-color);
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 380px;
    overflow-y: auto;
    background-color: #1a1e2d;
    border: 1px solid #2d3748;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    z-index: 50;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-results-dropdown.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-8px);
}

.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}
.search-results-dropdown::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-decoration: none;
    transition: background-color 0.15s ease;
    cursor: pointer;
    text-align: left;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: rgba(59, 130, 246, 0.12);
}

.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-heading);
}

.search-result-badge {
    font-family: "Fira Code", monospace;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-get { background-color: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-post { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-delete { background-color: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-docs { background-color: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-param { background-color: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.3); }
.badge-field { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

.search-result-path {
    font-family: "Fira Code", monospace;
    font-size: 0.72rem;
    color: #38bdf8;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-desc {
    font-size: 0.75rem;
    color: var(--text-main);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-breadcrumb {
    color: #a78bfa;
}

.search-no-results {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* Row highlight animation when navigating to a param/field search result */
@keyframes row-flash {
    0%   { background-color: rgba(59, 130, 246, 0.35); }
    60%  { background-color: rgba(59, 130, 246, 0.20); }
    100% { background-color: transparent; }
}

tr.row-highlight {
    animation: row-flash 1.8s ease-out forwards;
}

/* Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
    }
    #main-content {
        padding: 1.5rem;
    }
}
