/* ========================================================================
   Anna – Documentation Page Styles
   Extends pages.css with docs-specific layout (sidebar + content area).
   ======================================================================== */

/* ── Docs Layout (sidebar + content) ───────────────────────────────── */
.docs-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 64px);
}

/* ── Docs Sidebar ──────────────────────────────────────────────────── */
.docs-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-mid);
    padding: 32px 0;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,200,162,0.15) transparent;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,200,162,0.15);
    border-radius: 2px;
}

/* Sidebar search */
.docs-sidebar__search {
    padding: 0 20px 20px;
    position: relative;
}

.docs-sidebar__search-input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.docs-sidebar__search-input::placeholder {
    color: var(--text-tertiary);
}

.docs-sidebar__search-input:focus {
    border-color: var(--border-warm);
    box-shadow: 0 0 0 3px rgba(255,200,162,0.08);
}

.docs-sidebar__search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(calc(-50% - 10px));
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Sidebar category */
.docs-sidebar__category {
    margin-bottom: 8px;
}

.docs-sidebar__category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    user-select: none;
}

.docs-sidebar__category-icon {
    width: 14px;
    height: 14px;
    color: var(--anna-warm);
    opacity: 0.6;
}

/* Sidebar nav items */
.docs-sidebar__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px 9px 28px;
    font-size: 13.5px;
    font-weight: 450;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all .15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.docs-sidebar__item:hover {
    color: var(--text-primary);
    background: rgba(255,200,162,0.04);
}

.docs-sidebar__item.active {
    color: var(--anna-warm);
    background: rgba(255,200,162,0.06);
    border-left-color: var(--anna-warm);
    font-weight: 550;
}

.docs-sidebar__item-emoji {
    font-size: 15px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.docs-sidebar__item--hidden {
    display: none;
}

/* ── Docs Content Area ─────────────────────────────────────────────── */
.docs-content {
    flex: 1;
    min-width: 0;
    max-width: 860px;
    margin: 0 auto;
    padding: 48px clamp(24px, 5vw, 64px) 80px;
}

/* Breadcrumb */
.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.docs-breadcrumb a {
    color: var(--text-tertiary);
    transition: color .2s;
}

.docs-breadcrumb a:hover { color: var(--anna-warm); }

.docs-breadcrumb__sep {
    font-size: 10px;
    opacity: 0.5;
}

/* Loading state */
.docs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-tertiary);
    font-size: 14px;
    gap: 10px;
}

.docs-loading__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--anna-warm);
    border-radius: 50%;
    animation: docs-spin .8s linear infinite;
}

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

/* ── Docs Prose (rendered markdown) ────────────────────────────────── */
.docs-prose {
    font-size: 15px;
    line-height: 1.85;
    color: var(--text-secondary);
}

.docs-prose h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 24px;
    letter-spacing: -0.3px;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--anna-soft) 0%, var(--anna-warm) 50%, var(--anna-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

:root[data-theme="light"] .docs-prose h1 {
    background: linear-gradient(135deg, #D4622A 0%, #E07A3A 50%, #F0A070 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.docs-prose h2 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: -0.2px;
}

.docs-prose h2:first-child { margin-top: 0; }

.docs-prose h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 12px;
}

.docs-prose h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 10px;
}

.docs-prose p {
    margin-bottom: 16px;
}

.docs-prose ul, .docs-prose ol {
    padding-left: 24px;
    margin-bottom: 18px;
}

.docs-prose li {
    margin-bottom: 8px;
}

.docs-prose li > ul, .docs-prose li > ol {
    margin-top: 8px;
    margin-bottom: 0;
}

.docs-prose strong {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-prose em {
    color: var(--anna-warm);
    font-style: normal;
}

.docs-prose a {
    color: var(--anna-warm);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255,200,162,0.3);
    transition: text-decoration-color .2s;
}

.docs-prose a:hover {
    text-decoration-color: var(--anna-warm);
}

/* Code */
.docs-prose code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.88em;
    padding: 2px 7px;
    background: rgba(255,200,162,0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    color: var(--anna-warm);
}

.docs-prose pre {
    margin: 20px 0;
    padding: 18px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow-x: auto;
}

.docs-prose pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
}

/* Blockquote */
.docs-prose blockquote {
    margin: 20px 0;
    padding: 16px 20px;
    background: rgba(255,200,162,0.04);
    border-left: 3px solid var(--anna-warm);
    border-radius: 0 10px 10px 0;
    color: var(--text-primary);
    font-size: 14px;
}

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

/* Tables */
.docs-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}

.docs-prose thead {
    background: var(--bg-card);
}

.docs-prose th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.docs-prose td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

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

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

/* Images */
.docs-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    margin: 20px 0;
    display: block;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    transition: transform .2s, box-shadow .2s;
}

.docs-prose img:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

/* Horizontal rule */
.docs-prose hr {
    border: none;
    height: 1px;
    background: var(--border-subtle);
    margin: 36px 0;
}

/* ── Docs Prev/Next Nav ────────────────────────────────────────────── */
.docs-nav-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
}

.docs-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    text-decoration: none;
    transition: all .2s;
    flex: 1;
    max-width: 48%;
}

.docs-nav-link:hover {
    border-color: var(--border-warm);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.docs-nav-link--next {
    text-align: right;
    margin-left: auto;
}

.docs-nav-link__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.docs-nav-link__title {
    font-size: 14px;
    font-weight: 550;
    color: var(--anna-warm);
}

/* ── Docs Welcome (landing state) ─────────────────────────────────── */
.docs-welcome {
    text-align: center;
    padding: 80px 20px;
}

.docs-welcome__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,200,162,0.1) 0%, rgba(255,158,108,0.05) 100%);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.docs-welcome__title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.docs-welcome__desc {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* Feature cards grid on welcome */
.docs-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    max-width: 640px;
    margin: 0 auto;
    text-align: left;
}

.docs-feature-card {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    color: inherit;
}

.docs-feature-card:hover {
    border-color: var(--border-warm);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    color: inherit;
}

.docs-feature-card__emoji {
    font-size: 22px;
    margin-bottom: 10px;
    display: block;
}

.docs-feature-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.docs-feature-card__desc {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* ── Mobile Responsive ─────────────────────────────────────────────── */
.docs-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--anna-warm), var(--anna-glow));
    color: #08090E;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255,158,108,0.3);
    transition: transform .2s;
}

.docs-mobile-toggle:hover { transform: scale(1.05); }

.docs-sidebar__close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

@media (max-width: 768px) {
    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 200;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .docs-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0,0,0,0.3);
    }

    .docs-sidebar__close { display: flex; }
    .docs-mobile-toggle { display: flex; }

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

    .docs-nav-footer {
        flex-direction: column;
    }
    .docs-nav-link { max-width: 100%; }
}

/* ── Docs Mobile Overlay ───────────────────────────────────────────── */
.docs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

.docs-overlay.open { display: block; }

/* ── Image Lightbox ────────────────────────────────────────────────── */
.docs-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 40px;
}

.docs-lightbox.open {
    display: flex;
    animation: docs-fade-in .2s ease;
}

@keyframes docs-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.docs-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
    cursor: default;
}

.docs-lightbox__close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.docs-lightbox__close:hover {
    background: rgba(255,255,255,0.2);
}
