@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');

/* Ensures section titles aren't hidden behind the 110px fixed headers when clicking TOC links */
section[section-title] {
    scroll-margin-top: 130px;
    /* 60px (Nav) + 50px (Subheader) + 20px (Buffer) */
}

/* --- Base Typography --- */
body {
    font-family: Inter, Roboto, Helvetica, Arial, sans-serif;
    color: #374151;
    line-height: 1.6;
    margin: 0;
}

#main-content {
    max-width: 850px;
    margin: 0 auto;
    padding: 1.8rem;
}

h1 {
    color: #111827;
    font-weight: 800;
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

h2 {
    color: #1f2937;
    font-weight: 700;
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

h3 {
    color: #2563eb;
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

/* --- Components: Headers & Badges --- */
.doc-header {
    margin-bottom: 0.5rem;
}

.meta-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.badge-new {
    background-color: #dcfce7;
    color: #166534;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* --- Components: Highlights & Lists --- */
.highlight-box {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 4px 4px 0;
}

.feature-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-list li {
    margin-bottom: 0.5rem;
}

/* --- Components: Cards & Grids --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.card-text {
    font-size: 0.875rem;
    color: #4b5563;
    margin: 0;
}

/* --- Components: Code/Stats Box --- */
.stats-code-box {
    background-color: #111827;
    color: #f3f4f6;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    list-style: none;
    margin: 0;
}

.stats-code-box li {
    margin-bottom: 0.25rem;
}

/* --- Components: Tags --- */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tag {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    background-color: #dbeafe;
    color: #1e40af;
}

.tag.gray {
    background-color: #f3f4f6;
    color: #374151;
}

/* --- Components: Instructions --- */
.instruction-box {
    background-color: #fefce8;
    border: 1px solid #fef9c3;
    border-radius: 0.5rem;
    padding: 1.5rem;
    color: #854d0e;
}

.instruction-list {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

/* --- Utility Icons --- */
.icon-green {
    color: #22c55e;
}

.icon-orange {
    color: #f97316;
}

.icon-blue {
    color: #3b82f6;
}

.icon-purple {
    color: #a855f7;
}

/* --- 1. Main Navbar (Fixed Top) - DARK THEME --- */
.docs-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background: #111827;
    border-bottom: 1px solid #374151;
    /* Dark Background */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Invert logo to white if it's black text */
.nav-logo {
    height: 25px;
    width: auto;
    filter: brightness(0) invert(1);
}

.nav-app-category {
    border-left: 1px solid #4b5563;
    padding-left: 15px;
    color: #e5e7eb;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    height: 24px;
    display: flex;
    align-items: center;
}

.nav-app-category.app-link {
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-app-category.app-link:hover {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- 2. Subheader (Fixed Below Navbar) --- */
.docs-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 50px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
}

.subheader-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.subheader-title {
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    display: flex;
}

.menu-toggle:hover {
    color: #111827;
}

/* --- Search Bar (Expanding) --- */
.search-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    width: 300px;
}

.search-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    z-index: 2;
    display: flex;
}

.search-input {
    position: absolute;
    right: 0;
    width: 0;
    opacity: 0;
    padding: 6px 35px 6px 10px;
    transition: all 0.3s ease;
    pointer-events: none;
    border: none;
}

.search-container.expanded .search-input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    background: transparent;
    outline: none;
    padding: 8px;
    margin-left: 30px;
    border: none;
}

/* --- Search Results Dropdown (New) --- */
.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    display: none;
    margin-top: 5px;
}

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

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease;
}

.search-result-item:hover {
    background-color: #f9fafb;
}

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

.search-result-type {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 700;
    margin-bottom: 4px;
}

.search-result-text {
    display: block;
    font-size: 0.85rem;
    color: #374151;
    line-height: 1.4;
}

/* Matching Text Highlight */
.search-match {
    background-color: #fef08a;
    /* Yellow-200 */
    color: #854d0e;
    /* Yellow-900 */
    font-weight: 600;
    border-radius: 2px;
}

/* Animation for clicking a result */
@keyframes highlight-pulse {
    0% {
        background-color: rgba(250, 204, 21, 0.4);
    }

    100% {
        background-color: transparent;
    }
}

.highlight-target {
    animation: highlight-pulse 2s ease-out;
}

/* --- Layout Spacing --- */
/* Margin top accounts for Navbar (60px) + Subheader (50px) + Extra space */
.docs-layout-wrapper {
    margin-top: 110px;
    display: flex;
}

.docs-sidebar {
    width: 250px;
    height: calc(100vh - 110px);
    position: fixed;
    top: 110px;
    left: 0;
    overflow-y: auto;
    background: white;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
}

.docs-sidebar.open {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.docs-main {
    flex: 1;
    padding: 20px;
    margin-left: 0;
    max-width: 100%;
}

@media (min-width: 1024px) {
    .docs-sidebar {
        transform: translateX(0);
    }

    .docs-main {
        margin-left: 250px;
    }

    .docs-footer {
        margin-left: 250px;
    }

    /* FIX: Shifts footer to right on desktop */
    .menu-toggle {
        display: none;
    }

    /* Hide menu toggle on desktop */
}

/* --- Settings Dropdown --- */
/* Updated for Dark Navbar visibility */
.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #e5e7eb;
    display: flex;
    align-items: center;
}

.doc-header h1 {
    margin-top: 0px;
    font-family: Inter;
    line-height: 1.2;
}

.settings-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    width: 180px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.settings-menu.show {
    display: block;
}

.settings-menu a,
.settings-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: #4b5563;
    font-size: 0.85rem;
}

.settings-menu button {
    background: none;
    border: none;
    font-family: inherit;
    width: 100%;
}

.settings-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 4px 0;
}

.settings-menu a:hover,
.settings-menu button:hover {
    background-color: #f3f4f6;
    color: #111827;
}

/* --- Footer - DARK THEME --- */
.docs-footer {
    margin-top: 4rem;
    padding: 3rem 1rem;
    background-color: #111827;
    border-top: 1px solid #374151;
    color: #d1d5db;
}

.footer-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.footer-col h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #f3f4f6;
}

.footer-col a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: #ffffff;
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    color: #6b7280;
    font-size: 0.8rem;
}

a.brand-logo {
    display: flex;
    align-items: center;
}

.footer-col a {
    border-bottom: 1px dashed;
    padding-bottom: 3px;
}