/* ============================================
   FrameForge — Documentation Styles (V6)
   ============================================ */

/* ── Layout ──────────────────────────────────── */
.docs-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
    padding-top: 80px;
    position: relative;
}

.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 32px 0 40px;
    border-right: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    height: calc(100vh - 80px);
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.docs-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px;
}

.docs-sidebar-header h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 0;
}

.docs-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
}

.docs-sidebar-close:hover {
    color: var(--text);
}

/* ── Sidebar Search ───────────────────────────── */
.docs-search-wrapper {
    margin: 0 16px 24px;
    position: relative;
}

.docs-search-wrapper>i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.docs-search-input {
    width: 100%;
    background: rgb(255 255 255 / 3%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px 9px 38px;
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.docs-search-input:focus {
    border-color: var(--primary);
    background: rgb(99 102 241 / 4%);
    outline: none;
    box-shadow: 0 0 0 3px rgb(99 102 241 / 12%);
}

.docs-search-input::placeholder {
    color: var(--text-muted);
}

/* ── Sidebar Nav ──────────────────────────────── */
.docs-nav {
    list-style: none;
    padding: 0 8px;
    margin: 0;
    flex: 1;
}

.docs-nav li {
    margin-bottom: 2px;
}

.docs-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

.docs-nav a .material-symbols-rounded {
    font-size: 18px;
    flex-shrink: 0;
}

.docs-nav a:hover {
    background: rgb(255 255 255 / 4%);
    color: var(--text-secondary);
}

.docs-nav a.active {
    background: rgb(99 102 241 / 10%);
    color: var(--primary-light);
}

.docs-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

/* ── Table of Contents (sidebar) ─────────────── */
.docs-toc {
    margin: 24px 8px 0;
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.docs-toc-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 10px;
    padding-left: 4px;
}

.docs-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-toc ul li {
    margin-bottom: 2px;
}

.docs-toc ul li a {
    display: block;
    padding: 5px 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 1.4;
}

.docs-toc ul li a:hover {
    color: var(--text-secondary);
    background: rgb(255 255 255 / 4%);
}

/* ── Main Area ────────────────────────────────── */
.docs-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.docs-content {
    flex: 1;
    padding: 48px 64px 100px;
    max-width: 860px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Mobile Top Bar ───────────────────────────── */
.docs-mobile-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: rgb(10 10 16 / 60%);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 60px;
    z-index: 90;
}

.docs-menu-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    padding: 6px;
    line-height: 1;
    flex-shrink: 0;
}

.docs-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.docs-mobile-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile overlay */
.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 50%);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.25s;
}

.docs-overlay.visible {
    opacity: 1;
}

/* ── Pro Typography ───────────────────────── */
.docs-content h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin: 0 0 36px;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, #fff 40%, #a5b4fc);
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.15;
}

.docs-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 48px 0 20px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.docs-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 32px 0 12px;
    color: var(--text-secondary);
}

.docs-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-content p {
    margin: 0 0 20px;
    color: var(--text-secondary);
    line-height: 1.85;
    font-size: 1rem;
}

.docs-content a {
    color: var(--primary-light);
    text-decoration: none;
    border-bottom: 1px solid rgb(129 140 248 / 30%);
    transition: border-color 0.15s, color 0.15s;
}

.docs-content a:hover {
    color: #c7d2fe;
    border-bottom-color: rgb(199 210 254 / 60%);
}

.docs-content strong {
    color: var(--text);
}

/* ── Lists ────────────────────────────────────── */
.docs-content ul,
.docs-content ol {
    padding-left: 28px;
    margin: 0 0 24px;
}

.docs-content li {
    margin-bottom: 10px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.docs-content ul li::marker {
    color: var(--primary-light);
}

.docs-content ol li::marker {
    color: var(--primary-light);
    font-weight: 700;
}

/* ── Horizontal Rule ──────────────────────────── */
.docs-content hr,
.docs-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* ── Callouts / Alerts ────────────────────────── */
.doc-callout {
    display: flex;
    gap: 14px;
    padding: 18px 22px;
    border-radius: 14px;
    margin: 24px 0 28px;
    border: 1px solid transparent;
    backdrop-filter: var(--glass-blur);
}

.doc-callout>i.material-symbols-rounded {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.doc-callout-content {
    flex: 1;
    min-width: 0;
}

.doc-callout-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 6px;
}

.doc-callout-body p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* NOTE — indigo */
.doc-callout.note {
    background: rgb(99 102 241 / 6%);
    border-color: rgb(99 102 241 / 15%);
}

.doc-callout.note>i,
.doc-callout.note .doc-callout-title {
    color: #818cf8;
}

.doc-callout.note .doc-callout-body p {
    color: #c7d2fe;
}

/* WARNING — amber */
.doc-callout.warning {
    background: rgb(245 158 11 / 6%);
    border-color: rgb(245 158 11 / 20%);
}

.doc-callout.warning>i,
.doc-callout.warning .doc-callout-title {
    color: #fbbf24;
}

.doc-callout.warning .doc-callout-body p {
    color: #fde68a;
}

/* TIP — emerald */
.doc-callout.tip {
    background: rgb(16 185 129 / 6%);
    border-color: rgb(16 185 129 / 15%);
}

.doc-callout.tip>i,
.doc-callout.tip .doc-callout-title {
    color: #34d399;
}

.doc-callout.tip .doc-callout-body p {
    color: #a7f3d0;
}

/* CAUTION — orange */
.doc-callout.caution {
    background: rgb(249 115 22 / 6%);
    border-color: rgb(249 115 22 / 20%);
}

.doc-callout.caution>i,
.doc-callout.caution .doc-callout-title {
    color: #fb923c;
}

.doc-callout.caution .doc-callout-body p {
    color: #fed7aa;
}

/* IMPORTANT — rose */
.doc-callout.important {
    background: rgb(244 63 94 / 6%);
    border-color: rgb(244 63 94 / 20%);
}

.doc-callout.important>i,
.doc-callout.important .doc-callout-title {
    color: #fb7185;
}

.doc-callout.important .doc-callout-body p {
    color: #fecdd3;
}

/* ── Interactive Code Blocks ──────────────────── */
.code-block-wrapper {
    position: relative;
    margin: 8px 0 28px;
    border-radius: 14px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    overflow: hidden;
}

.code-header {
    background: rgb(255 255 255 / 2.5%);
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgb(255 255 255 / 6%);
}

.code-lang {
    font-size: 0.68rem;
    color: rgb(255 255 255 / 30%);
    text-transform: uppercase;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    letter-spacing: 1.5px;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgb(255 255 255 / 10%);
    color: rgb(255 255 255 / 40%);
    font-size: 0.72rem;
    font-family: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn .material-symbols-rounded {
    font-size: 14px;
}

.copy-btn:hover {
    background: rgb(255 255 255 / 6%);
    border-color: var(--primary);
    color: var(--primary-light);
}

.copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
}

.docs-content pre {
    padding: 22px 24px;
    margin: 0;
    overflow-x: auto;
    background: none;
    border: none;
    scrollbar-width: thin;
    scrollbar-color: rgb(255 255 255 / 10%) transparent;
}

.docs-content code {
    background: rgb(129 140 248 / 10%);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.88em;
    color: #a5b4fc;
}

.docs-content pre code {
    background: none;
    padding: 0;
    color: #cbd5e1;
    font-size: 0.875rem;
    line-height: 1.7;
}

/* ── Tables ───────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    margin: 8px 0 28px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.docs-table th {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgb(255 255 255 / 2%);
    border-bottom: 1px solid var(--border);
}

.docs-table td {
    padding: 11px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgb(42 42 58 / 30%);
    vertical-align: top;
}

.docs-table tbody tr:last-child td {
    border-bottom: none;
}

.docs-table tbody tr:nth-child(even) td {
    background: rgb(255 255 255 / 1.5%);
}

.docs-table code {
    font-size: 0.82em;
}

/* ── Skeleton Loader ──────────────────────────── */
.skeleton-loader {
    padding: 8px 0;
    animation: skeleton-fade 1.4s ease-in-out infinite;
}

.skeleton-line {
    height: 18px;
    background: rgb(255 255 255 / 5%);
    border-radius: 6px;
    margin-bottom: 16px;
}

.skeleton-line.w40 {
    width: 40%;
}

.skeleton-line.w50 {
    width: 50%;
}

.skeleton-line.w60 {
    width: 60%;
}

.skeleton-line.w70 {
    width: 70%;
}

.skeleton-line.w80 {
    width: 80%;
}

.skeleton-line.w90 {
    width: 90%;
}

@keyframes skeleton-fade {
    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ── Reading Progress ─────────────────────────── */
.reading-progress-container {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 1000;
    background: transparent;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent), #a78bfa);
    width: 0%;
    transition: width 0.08s linear;
}

/* ── API Endpoint Cards ───────────────────────── */
.api-endpoint {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 24px;
    margin: 28px 0;
    transition: border-color 0.2s, transform 0.2s;
}

.api-endpoint:hover {
    transform: translateX(4px);
    border-color: rgb(99 102 241 / 30%);
}

.endpoint-method {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.method-get {
    background: rgb(16 185 129 / 12%);
    color: #34d399;
}

.method-post {
    background: rgb(99 102 241 / 12%);
    color: #818cf8;
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (width <= 1100px) {
    .docs-content {
        padding: 40px 40px 80px;
    }
}

@media (width <= 900px) {
    .docs-layout {
        padding-top: 60px;
    }

    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100%;
        padding-top: 80px;
        background: #0a0a10;
    }

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

    .docs-sidebar-close {
        display: flex;
    }

    .docs-overlay {
        display: block;
        pointer-events: none;
    }

    .docs-overlay.visible {
        pointer-events: auto;
    }

    .docs-mobile-bar {
        display: flex;
    }

    .docs-content {
        padding: 28px 20px 80px;
    }

    .docs-content h1 {
        font-size: 2.1rem;
    }

    .docs-content h2 {
        font-size: 1.4rem;
    }
}

@media (width <= 480px) {
    .docs-content h1 {
        font-size: 1.75rem;
        letter-spacing: -0.5px;
    }

    .docs-content {
        padding: 24px 16px 80px;
    }
}