/* wezlo/filament-docs — UI + prose styles.
 * Hand-rolled vanilla CSS so it works without Tailwind Typography.
 *
 * Layout: a 2-column grid (sidebar + article) with the sidebar pinned
 * (position: sticky) and its content scrolling independently.
 */

/* --------------------------------------------------------- */
/* Layout                                                    */
/* --------------------------------------------------------- */

.fi-docs-layout {
    display: grid;
    grid-template-columns: 18rem 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .fi-docs-layout {
        grid-template-columns: 16rem 1fr;
    }
}

@media (max-width: 768px) {
    .fi-docs-layout {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------- */
/* Sidebar (sticky)                                          */
/* --------------------------------------------------------- */

.fi-docs-sidebar {
    position: sticky;
    top: 5rem;
    align-self: start;
    z-index: 1;
}

@media (max-width: 768px) {
    .fi-docs-sidebar {
        position: relative;
        top: 0;
    }
}

.fi-docs-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100vh - 6rem);
    padding: 1rem;
    background: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.dark .fi-docs-sidebar-inner {
    background: rgb(24 24 27);
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-inline: -0.5rem;
    padding-inline: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgb(209 213 219) transparent;
}

.dark .fi-docs-sidebar-scroll {
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.fi-docs-sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.fi-docs-sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: rgb(209 213 219);
    border-radius: 999px;
}

.dark .fi-docs-sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
}

/* --------------------------------------------------------- */
/* Search                                                    */
/* --------------------------------------------------------- */

.fi-docs-search {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fi-docs-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.fi-docs-search-icon {
    position: absolute;
    inset-inline-start: 0.625rem;
    width: 1rem;
    height: 1rem;
    color: rgb(156 163 175);
    pointer-events: none;
}

.fi-docs-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
    background: rgb(249 250 251);
    color: rgb(17 24 39);
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

[dir="rtl"] .fi-docs-search-input {
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
}

.fi-docs-search-input::placeholder {
    color: rgb(156 163 175);
}

.fi-docs-search-input:focus {
    outline: none;
    border-color: rgb(245 158 11);
    background: rgb(255 255 255);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.dark .fi-docs-search-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgb(229 231 235);
}

.dark .fi-docs-search-input::placeholder {
    color: rgb(107 114 128);
}

.dark .fi-docs-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
}

.fi-docs-search-spinner {
    position: absolute;
    inset-inline-end: 0.625rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgb(229 231 235);
    border-top-color: rgb(245 158 11);
    border-radius: 999px;
    animation: fi-docs-spin 0.7s linear infinite;
}

@keyframes fi-docs-spin {
    to { transform: rotate(360deg); }
}

.fi-docs-search-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgb(75 85 99);
    cursor: pointer;
    user-select: none;
}

.dark .fi-docs-search-toggle {
    color: rgb(156 163 175);
}

.fi-docs-search-toggle input[type="checkbox"] {
    accent-color: rgb(245 158 11);
}

/* --------------------------------------------------------- */
/* Locale switcher                                           */
/* --------------------------------------------------------- */

.fi-docs-locale-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgb(243 244 246);
    border-radius: 0.5rem;
}

.dark .fi-docs-locale-switcher {
    background: rgba(255, 255, 255, 0.04);
}

.fi-docs-locale-btn {
    flex: 1 1 auto;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(75 85 99);
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.dark .fi-docs-locale-btn {
    color: rgb(156 163 175);
}

.fi-docs-locale-btn:hover {
    color: rgb(17 24 39);
}

.dark .fi-docs-locale-btn:hover {
    color: rgb(255 255 255);
}

.fi-docs-locale-btn-active {
    background: rgb(255 255 255);
    color: rgb(17 24 39);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
}

.dark .fi-docs-locale-btn-active {
    background: rgba(255, 255, 255, 0.08);
    color: rgb(255 255 255);
}

/* --------------------------------------------------------- */
/* Sidebar nav                                               */
/* --------------------------------------------------------- */

.fi-docs-nav[data-root="true"] {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    font-size: 0.875rem;
}

.fi-docs-section {
    margin-top: 0.75rem;
}

.fi-docs-section[data-depth="0"]:first-child {
    margin-top: 0;
}

.fi-docs-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(107 114 128);
}

.dark .fi-docs-section-header {
    color: rgb(156 163 175);
}

.fi-docs-section-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.fi-docs-section-children {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    border-inline-start: 1px solid rgb(229 231 235);
    margin-inline-start: 0.875rem;
    padding-inline-start: 0.5rem;
}

.dark .fi-docs-section-children {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: rgb(55 65 81);
    font-size: 0.875rem;
    text-align: start;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.dark .fi-docs-nav-item {
    color: rgb(209 213 219);
}

.fi-docs-nav-item:hover {
    background: rgb(243 244 246);
    color: rgb(17 24 39);
}

.dark .fi-docs-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgb(255 255 255);
}

.fi-docs-nav-item-bullet {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 999px;
    background: rgb(209 213 219);
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}

.dark .fi-docs-nav-item-bullet {
    background: rgb(75 85 99);
}

.fi-docs-nav-item:hover .fi-docs-nav-item-bullet {
    background: rgb(156 163 175);
}

.fi-docs-nav-item-active {
    background: rgb(254 243 199);
    color: rgb(146 64 14);
    font-weight: 600;
}

.dark .fi-docs-nav-item-active {
    background: rgba(245, 158, 11, 0.15);
    color: rgb(252 211 77);
}

.fi-docs-nav-item-active .fi-docs-nav-item-bullet {
    background: rgb(245 158 11);
    transform: scale(1.4);
}

.fi-docs-nav-item-active:hover {
    background: rgb(254 243 199);
    color: rgb(146 64 14);
}

.dark .fi-docs-nav-item-active:hover {
    background: rgba(245, 158, 11, 0.2);
    color: rgb(252 211 77);
}

.fi-docs-nav-item-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------- */
/* Search results panel                                      */
/* --------------------------------------------------------- */

.fi-docs-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.fi-docs-search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.fi-docs-search-clear {
    background: none;
    border: none;
    color: rgb(107 114 128);
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: underline;
}

.fi-docs-search-clear:hover {
    color: rgb(245 158 11);
}

.fi-docs-search-result {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    text-align: start;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.fi-docs-search-result:hover {
    background: rgb(249 250 251);
    border-color: rgb(229 231 235);
}

.dark .fi-docs-search-result:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-search-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.fi-docs-search-result-title {
    font-weight: 500;
    color: rgb(17 24 39);
}

.dark .fi-docs-search-result-title {
    color: rgb(255 255 255);
}

.fi-docs-search-result-locale {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgb(156 163 175);
    background: rgb(243 244 246);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.dark .fi-docs-search-result-locale {
    background: rgba(255, 255, 255, 0.06);
}

.fi-docs-search-result-snippet {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: rgb(107 114 128);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .fi-docs-search-result-snippet {
    color: rgb(156 163 175);
}

.fi-docs-search-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

/* --------------------------------------------------------- */
/* Article                                                   */
/* --------------------------------------------------------- */

.fi-docs-article {
    min-width: 0;
}

.fi-docs-article-inner {
    background: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
    padding: 2rem 2.25rem;
    transition: opacity 0.15s;
}

.dark .fi-docs-article-inner {
    background: rgb(24 24 27);
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-loading {
    opacity: 0.55;
    pointer-events: none;
}

@media (max-width: 640px) {
    .fi-docs-article-inner {
        padding: 1.25rem 1rem;
    }
}

.fi-docs-article-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .fi-docs-article-header {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-title {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgb(17 24 39);
    letter-spacing: -0.01em;
}

.dark .fi-docs-title {
    color: rgb(255 255 255);
}

/* --------------------------------------------------------- */
/* Breadcrumbs                                               */
/* --------------------------------------------------------- */

.fi-docs-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0 0 1rem 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: rgb(107 114 128);
}

.fi-docs-breadcrumbs-sep svg {
    width: 0.75rem;
    height: 0.75rem;
    color: rgb(209 213 219);
}

[dir="rtl"] .fi-docs-breadcrumbs-sep svg {
    transform: scaleX(-1);
}

.fi-docs-breadcrumbs-link {
    background: none;
    border: none;
    padding: 0;
    color: rgb(107 114 128);
    cursor: pointer;
    transition: color 0.15s;
}

.fi-docs-breadcrumbs-link:hover {
    color: rgb(245 158 11);
}

.fi-docs-breadcrumbs-current {
    color: rgb(55 65 81);
    font-weight: 500;
}

.dark .fi-docs-breadcrumbs-current {
    color: rgb(229 231 235);
}

/* --------------------------------------------------------- */
/* Fallback banner                                           */
/* --------------------------------------------------------- */

.fi-docs-fallback-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgb(254 243 199);
    border: 1px solid rgb(252 211 77);
    border-radius: 0.5rem;
    color: rgb(120 53 15);
    font-size: 0.8125rem;
}

.dark .fi-docs-fallback-banner {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: rgb(252 211 77);
}

.fi-docs-fallback-banner svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    margin-top: 0.0625rem;
}

/* --------------------------------------------------------- */
/* Empty state                                               */
/* --------------------------------------------------------- */

.fi-docs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 1rem;
    color: rgb(107 114 128);
    text-align: center;
}

.fi-docs-empty svg {
    width: 3rem;
    height: 3rem;
    color: rgb(209 213 219);
}

.dark .fi-docs-empty svg {
    color: rgba(255, 255, 255, 0.15);
}

.fi-docs-empty p {
    margin: 0;
    font-size: 0.875rem;
}

/* --------------------------------------------------------- */
/* Prose                                                     */
/* --------------------------------------------------------- */

.fi-docs-prose {
    color: rgb(31 41 55);
    line-height: 1.75;
    font-size: 0.95rem;
    max-width: 72ch;
    word-wrap: break-word;
}

.dark .fi-docs-prose {
    color: rgb(229 231 235);
}

.fi-docs-prose > :first-child { margin-top: 0; }
.fi-docs-prose > :last-child { margin-bottom: 0; }

.fi-docs-prose h1,
.fi-docs-prose h2,
.fi-docs-prose h3,
.fi-docs-prose h4,
.fi-docs-prose h5,
.fi-docs-prose h6 {
    color: rgb(17 24 39);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2.25em;
    margin-bottom: 0.75em;
    scroll-margin-top: 6rem;
    letter-spacing: -0.01em;
}

.dark .fi-docs-prose h1,
.dark .fi-docs-prose h2,
.dark .fi-docs-prose h3,
.dark .fi-docs-prose h4,
.dark .fi-docs-prose h5,
.dark .fi-docs-prose h6 {
    color: rgb(255 255 255);
}

.fi-docs-prose h1 { font-size: 1.875rem; }
.fi-docs-prose h2 {
    font-size: 1.5rem;
    padding-bottom: 0.4em;
    border-bottom: 1px solid rgb(229 231 235);
}
.dark .fi-docs-prose h2 { border-color: rgba(255, 255, 255, 0.08); }
.fi-docs-prose h3 { font-size: 1.25rem; }
.fi-docs-prose h4 { font-size: 1.05rem; }

.fi-docs-prose p {
    margin: 1em 0;
}

.fi-docs-prose a {
    color: rgb(217 119 6);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color 0.15s;
}

.dark .fi-docs-prose a {
    color: rgb(252 211 77);
}

.fi-docs-prose a:hover {
    color: rgb(180 83 9);
    text-decoration-thickness: 2px;
}

.dark .fi-docs-prose a:hover {
    color: rgb(254 240 138);
}

.fi-docs-prose ul,
.fi-docs-prose ol {
    margin: 1em 0;
    padding-inline-start: 1.5em;
}

.fi-docs-prose ul { list-style: disc; }
.fi-docs-prose ol { list-style: decimal; }

.fi-docs-prose li {
    margin: 0.4em 0;
}

.fi-docs-prose li::marker {
    color: rgb(156 163 175);
}

.fi-docs-prose li > p {
    margin: 0.4em 0;
}

.fi-docs-prose blockquote {
    margin: 1.5em 0;
    padding: 0.875em 1.125em;
    border-inline-start: 3px solid rgb(245 158 11);
    color: rgb(75 85 99);
    background: rgb(254 252 232);
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
}

[dir="rtl"] .fi-docs-prose blockquote {
    border-radius: 0.5rem 0 0 0.5rem;
}

.dark .fi-docs-prose blockquote {
    border-color: rgb(245 158 11);
    color: rgb(229 231 235);
    background: rgba(245, 158, 11, 0.06);
}

.fi-docs-prose blockquote p:first-child { margin-top: 0; }
.fi-docs-prose blockquote p:last-child { margin-bottom: 0; }

.fi-docs-prose code {
    background: rgb(243 244 246);
    color: rgb(146 64 14);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    border: 1px solid rgb(229 231 235);
}

.dark .fi-docs-prose code {
    background: rgba(245, 158, 11, 0.08);
    color: rgb(252 211 77);
    border-color: rgba(245, 158, 11, 0.15);
}

.fi-docs-prose pre {
    position: relative;
    margin: 1.5em 0;
    padding: 1em 1em 1em 1em;
    background: rgb(15 23 42);
    color: rgb(226 232 240);
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    line-height: 1.6;
    border: 1px solid rgb(30 41 59);
}

.fi-docs-prose pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
}

.fi-docs-prose pre .fi-docs-copy-btn {
    position: absolute;
    top: 0.5em;
    inset-inline-end: 0.5em;
    padding: 0.25em 0.6em;
    font-size: 0.7em;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.08);
    color: rgb(203 213 225);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.fi-docs-prose pre:hover .fi-docs-copy-btn,
.fi-docs-prose pre:focus-within .fi-docs-copy-btn {
    opacity: 1;
}

.fi-docs-prose pre .fi-docs-copy-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: rgb(255 255 255);
}

.fi-docs-prose pre .fi-docs-copy-btn[data-copied="true"] {
    background: rgb(34 197 94);
    color: rgb(255 255 255);
    border-color: rgb(22 163 74);
}

.fi-docs-prose table {
    margin: 1.5em 0;
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9em;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
    overflow: hidden;
}

.dark .fi-docs-prose table {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-prose th,
.fi-docs-prose td {
    padding: 0.625em 0.875em;
    border-bottom: 1px solid rgb(229 231 235);
    text-align: start;
}

.dark .fi-docs-prose th,
.dark .fi-docs-prose td {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-prose tr:last-child td {
    border-bottom: none;
}

.fi-docs-prose thead th {
    border-bottom-width: 2px;
    font-weight: 600;
    background: rgb(249 250 251);
    color: rgb(17 24 39);
}

.dark .fi-docs-prose thead th {
    background: rgba(255, 255, 255, 0.04);
    color: rgb(255 255 255);
}

.fi-docs-prose tbody tr:hover {
    background: rgb(249 250 251);
}

.dark .fi-docs-prose tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.fi-docs-prose hr {
    margin: 2.5em 0;
    border: none;
    border-top: 1px solid rgb(229 231 235);
}

.dark .fi-docs-prose hr {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.25em 0;
    border: 1px solid rgb(229 231 235);
}

.dark .fi-docs-prose img {
    border-color: rgba(255, 255, 255, 0.08);
}

.fi-docs-prose .fi-docs-anchor {
    color: rgb(156 163 175);
    text-decoration: none;
    margin-inline-end: 0.4em;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.fi-docs-prose h1:hover .fi-docs-anchor,
.fi-docs-prose h2:hover .fi-docs-anchor,
.fi-docs-prose h3:hover .fi-docs-anchor,
.fi-docs-prose h4:hover .fi-docs-anchor {
    opacity: 1;
}

.fi-docs-prose .fi-docs-anchor:hover {
    color: rgb(245 158 11);
}

/* --------------------------------------------------------- */
/* GFM task lists                                            */
/* --------------------------------------------------------- */

.fi-docs-prose ul.contains-task-list {
    list-style: none;
    padding-inline-start: 0;
}

.fi-docs-prose .task-list-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.fi-docs-prose .task-list-item input[type="checkbox"] {
    accent-color: rgb(245 158 11);
}
