html {
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f7fb;
    color: #0f172a;
}

* {
    box-sizing: border-box;
}

.doc-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.doc-create-box {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 240px;
    padding: 0.75rem;
    border-radius: 0.85rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    z-index: 600;
}

.doc-create-title {
    margin-bottom: 0.55rem;
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
}

.doc-create-input {
    width: 100%;
    height: 2.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.55rem;
    padding: 0 0.65rem;
    font-size: 0.85rem;
    outline: none;
}

    .doc-create-input:focus {
        border-color: #2563eb;
    }

.doc-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.doc-create-primary,
.doc-create-secondary {
    border: 0;
    border-radius: 0.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.doc-create-primary {
    background: #2563eb;
    color: #ffffff;
}

.doc-create-secondary {
    background: #e2e8f0;
    color: #334155;
}

.doc-action-button {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 0.65rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

    .doc-action-button:hover {
        background: #dbeafe;
    }

.doc-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.doc-editor-panel,
.doc-preview-panel {
    min-width: 0;
}

.doc-editor-panel {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.doc-editor-toolbar {
    height: 52px;
    padding: 0 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}

.doc-editor-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-editor-primary,
.doc-editor-secondary {
    border: 0;
    border-radius: 0.55rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.doc-editor-primary {
    background: #2563eb;
    color: #ffffff;
}

    .doc-editor-primary:hover {
        background: #1d4ed8;
    }

.doc-editor-secondary {
    background: #e2e8f0;
    color: #334155;
}

    .doc-editor-secondary:hover {
        background: #cbd5e1;
    }

.doc-editor {
    width: 100%;
    min-height: calc(100vh - 260px);
    resize: vertical;
    border: 0;
    outline: none;
    padding: 1rem;
    font-family: Consolas, "JetBrains Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #0f172a;
    background: #ffffff;
}

@media (max-width: 1200px) {
    .doc-editor-layout {
        grid-template-columns: 1fr;
    }
}

/* Layout */

.frodi-layout {
    display: flex;
    min-height: 100vh;
    background: #f4f7fb;
}

.frodi-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f4f7fb;
}

.frodi-content {
    flex: 1;
    padding: 2rem;
}

/* Sidebar */

.frodi-sidebar {
    width: 280px;
    min-width: 280px;
    min-height: 100vh;
    background: #0b1220;
    color: #e5e7eb;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
}

.frodi-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.4rem 1rem;
}

.frodi-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    background: #38bdf8;
    color: #020617;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.frodi-brand-text {
    min-width: 0;
}

.frodi-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #f8fafc;
}

.frodi-subtitle {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #93c5fd;
}

.frodi-search {
    padding: 0.5rem 1rem 1rem;
}

    .frodi-search input {
        width: 100%;
        height: 2.35rem;
        border-radius: 0.6rem;
        border: 1px solid #334155;
        background: #020617;
        color: #e5e7eb;
        padding: 0 0.8rem;
        font-size: 0.85rem;
        outline: none;
    }

        .frodi-search input::placeholder {
            color: #64748b;
        }

        .frodi-search input:focus {
            border-color: #38bdf8;
        }

/* Sidebar Tree */

.frodi-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem 1.5rem;
}

.doc-tree,
.doc-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-tree-children {
    margin-left: 0.8rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(148, 163, 184, 0.22);
}

.doc-tree-node {
    position: relative;
    margin: 0.15rem 0;
}

.doc-tree-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 2rem;
}

.doc-tree-toggle,
.doc-tree-spacer {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 1.5rem;
}

.doc-tree-toggle {
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

    .doc-tree-toggle:hover {
        background: rgba(148, 163, 184, 0.14);
        color: #f8fafc;
    }

.doc-tree-link,
.doc-tree-label {
    width: 100%;
    min-height: 1.9rem;
    display: flex;
    align-items: center;
    border-radius: 0.5rem;
    padding: 0.25rem 0.55rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.88rem;
}

.doc-tree-label {
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-weight: 700;
    color: #f8fafc;
}

    .doc-tree-link:hover,
    .doc-tree-label:hover {
        background: rgba(148, 163, 184, 0.14);
        color: #ffffff;
    }

.doc-tree-link.active {
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    font-weight: 700;
}

/* Context Menu */

.doc-context-menu {
    position: absolute;
    top: 2rem;
    left: 2rem;
    min-width: 160px;
    padding: 0.35rem;
    border-radius: 0.75rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    z-index: 500;
}

    .doc-context-menu button {
        width: 100%;
        min-height: 2.25rem;
        border: 0;
        border-radius: 0.55rem;
        background: transparent;
        color: #0f172a;
        font-size: 0.88rem;
        font-weight: 600;
        text-align: left;
        padding: 0 0.75rem;
        cursor: pointer;
    }

        .doc-context-menu button:hover {
            background: #eff6ff;
            color: #1d4ed8;
        }

/* Topbar */

.frodi-topbar {
    height: 72px;
    min-height: 72px;
    padding: 0 2rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.frodi-topbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.frodi-user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

    .frodi-user-menu:hover .frodi-user-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

.frodi-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.frodi-user-text {
    text-align: right;
    line-height: 1.2;
}

.frodi-user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.frodi-user-role {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: #64748b;
}

.frodi-avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.frodi-user-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    min-width: 180px;
    padding: 0.5rem;
    border-radius: 0.9rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 100;
}

.frodi-logout-button {
    width: 100%;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    padding: 0 0.85rem;
    border-radius: 0.7rem;
    text-decoration: none;
    color: #dc2626;
    font-size: 0.88rem;
    font-weight: 600;
}

    .frodi-logout-button:hover {
        background: #fef2f2;
    }

/* Pages */

.frodi-page {
    width: 100%;
}

.hero {
    margin-bottom: 2rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 0.8rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.hero h1 {
    margin: 1rem 0 0.75rem;
    font-size: 3rem;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
}

.hero p {
    max-width: 700px;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #475569;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    display: block;
    padding: 1.5rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
    transition: 0.15s ease;
}

    .dashboard-card:hover {
        transform: translateY(-2px);
        border-color: #bfdbfe;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    }

    .dashboard-card h3 {
        margin: 0 0 0.75rem;
        font-size: 1rem;
        font-weight: 700;
        color: #0f172a;
    }

    .dashboard-card p {
        margin: 0;
        line-height: 1.6;
        color: #64748b;
    }

/* Docs */

.doc-header {
    margin-bottom: 1.5rem;
}

.doc-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

    .doc-breadcrumbs a {
        color: #2563eb;
        text-decoration: none;
        font-weight: 500;
    }

        .doc-breadcrumbs a:hover {
            color: #1d4ed8;
            text-decoration: underline;
        }

.doc-breadcrumb-disabled {
    color: #64748b;
    font-weight: 500;
}

.doc-breadcrumb-separator {
    color: #94a3b8;
}

.doc-header h1 {
    margin: 0;
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
}

.doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 3rem;
    align-items: start;
}

.doc-content {
    width: 100%;
    padding: 2.25rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    min-width: 0;
}

    .doc-content h1,
    .doc-content h2,
    .doc-content h3 {
        scroll-margin-top: 96px;
    }

    .doc-content h1 {
        font-size: 2rem;
        margin: 0 0 1.5rem;
    }

    .doc-content h2 {
        font-size: 1.45rem;
        margin: 2rem 0 0.75rem;
        padding-bottom: 0.4rem;
        border-bottom: 1px solid #e2e8f0;
    }

    .doc-content h3 {
        font-size: 1.15rem;
        margin: 1.5rem 0 0.5rem;
    }

    .doc-content p,
    .doc-content li {
        color: #334155;
        line-height: 1.75;
    }

    .doc-content a {
        color: #2563eb;
        font-weight: 500;
        text-decoration: none;
    }

        .doc-content a:hover {
            text-decoration: underline;
        }

    .doc-content code {
        padding: 0.15rem 0.35rem;
        border-radius: 0.35rem;
        background: #f1f5f9;
        color: #be123c;
        font-size: 0.9em;
    }

    .doc-content pre {
        overflow-x: auto;
        padding: 1rem;
        border-radius: 0.85rem;
        background: #0f172a;
        color: #e2e8f0;
    }

        .doc-content pre code {
            padding: 0;
            background: transparent;
            color: inherit;
        }

    .doc-content blockquote {
        margin: 1.25rem 0;
        padding: 0.75rem 1rem;
        border-left: 4px solid #3b82f6;
        background: #eff6ff;
        color: #1e3a8a;
        border-radius: 0.5rem;
    }

    .doc-content table {
        width: 100%;
        border-collapse: collapse;
        margin: 1.25rem 0;
    }

    .doc-content th,
    .doc-content td {
        padding: 0.7rem 0.85rem;
        border: 1px solid #e2e8f0;
        text-align: left;
    }

    .doc-content th {
        background: #f8fafc;
        font-weight: 700;
    }

    .doc-content img {
        max-width: 100%;
        border-radius: 0.8rem;
        border: 1px solid #e2e8f0;
    }

.doc-empty {
    max-width: 720px;
    padding: 2rem;
    border-radius: 1rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

/* Docs Outline */

.doc-outline {
    position: sticky;
    top: 25px;
    align-self: start;
    max-height: calc(100vh - 50px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.doc-outline-card {
    padding: 0.9rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.doc-outline-title {
    margin-bottom: 0.65rem;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.doc-outline-link {
    display: block;
    padding: 0.22rem 0.35rem;
    margin: 0.05rem 0;
    border-radius: 0.4rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.25;
}

    .doc-outline-link:hover {
        background: #eff6ff;
        color: #1d4ed8;
    }

    .doc-outline-link.level-1 {
        margin-top: 0.35rem;
        font-weight: 800;
        color: #334155;
    }

    .doc-outline-link.level-2 {
        padding-left: 0.85rem;
        font-weight: 500;
    }

    .doc-outline-link.level-3 {
        padding-left: 1.45rem;
        font-size: 0.78rem;
        color: #64748b;
    }

/* Blazor Error UI */

#blazor-error-ui {
    background: #fef2f2;
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 1rem;
        top: 0.75rem;
    }

/* Responsive */

@media (max-width: 1200px) {
    .doc-layout {
        grid-template-columns: 1fr;
    }

    .doc-outline {
        display: none;
    }
}

@media (max-width: 900px) {
    .frodi-layout {
        flex-direction: column;
    }

    .frodi-sidebar {
        width: 100%;
        min-width: 100%;
        min-height: auto;
    }

    .frodi-topbar {
        height: auto;
        min-height: 64px;
        padding: 1rem;
        gap: 1rem;
    }

    .frodi-content {
        padding: 1.25rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }
}
