/* ── Material Symbols ── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── App layout ── */
.app-container {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 60px 1fr;
}

.main-content {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* ── Docs layout ── */
.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── TOC Sidebar ── */
.docs-toc {
    position: sticky;
    top: 0;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 24px 16px 24px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

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

.docs-toc-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    padding-left: 12px;
}

.docs-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.docs-toc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    border-left: 2px solid transparent;
    line-height: 1.4;
}

.docs-toc-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.docs-toc-item.active {
    color: #10B981;
    background: rgba(16, 185, 129, 0.08);
    border-left-color: #10B981;
    font-weight: 600;
}

.docs-toc-icon {
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s;
    width: 14px;
    height: 14px;
}

.docs-toc-item.active .docs-toc-icon { opacity: 1; }
.docs-toc-item:hover .docs-toc-icon { opacity: 0.75; }

.docs-toc-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--text-tertiary);
    padding: 14px 12px 4px;
}

/* ── Content area ── */
.docs-content {
    overflow-y: auto;
    padding: 32px 40px 80px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.docs-content::-webkit-scrollbar { width: 6px; }
.docs-content::-webkit-scrollbar-track { background: transparent; }
.docs-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.docs-section {
    margin-bottom: 48px;
    scroll-margin-top: 20px;
}

.docs-section:last-child {
    margin-bottom: 0;
}

.docs-h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, #a1a1a1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.docs-h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 32px;
    padding-left: 14px !important;
    border-left: 3px solid #10B981;
    margin-left: 0;
}

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

.docs-h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    margin-top: 24px;
}

.docs-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.docs-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.docs-list li {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.docs-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
}

/* ── Step timeline ── */
.docs-steps {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.docs-steps::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 44px;
    bottom: 30px;
    width: 2px;
    background: linear-gradient(to bottom, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.03));
    border-radius: 1px;
    pointer-events: none;
}

.docs-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.docs-step-num {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.docs-step-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

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

/* ── Tip & Warning ── */
.docs-tip,
.docs-warning {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 16px 0;
}

.docs-tip {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.docs-warning {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.docs-tip-icon,
.docs-warning-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.docs-tip-icon { color: #10B981; }
.docs-warning-icon { color: #EF4444; }

.docs-tip-label,
.docs-warning-label {
    font-weight: 700;
}

.docs-tip-label { color: #10B981; }
.docs-warning-label { color: #EF4444; }

.docs-kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 12px;
    font-family: monospace;
    color: var(--text-primary);
}

.docs-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 32px 0;
}

/* ── Feature cards ── */
.docs-features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.docs-feature {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.docs-feature:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.04);
}

.docs-feature:hover .docs-feature-icon {
    background: rgba(16, 185, 129, 0.22);
}

.docs-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

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

/* ── FAQ ── */
.faq-item {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.faq-item.open {
    border-color: rgba(16, 185, 129, 0.15);
}

.faq-question {
    padding: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
    transition: background 0.15s;
}

.faq-question:hover {
    background: rgba(16, 185, 129, 0.04) !important;
}

.faq-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.faq-item.open .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    display: block !important;
    padding: 0 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height 0.3s ease, padding 0.2s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
    padding-bottom: 16px;
}

/* ── Reading progress bar ── */
.docs-progress-wrap {
    position: sticky;
    top: 0;
    height: 2px;
    background: transparent;
    z-index: 10;
    flex-shrink: 0;
}

.docs-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10B981 0%, #8CA8FF 100%);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.08s linear;
    border-radius: 0 1px 1px 0;
}

/* ── Intro hero block ── */
.docs-hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.07) 0%, rgba(140, 168, 255, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 28px;
}

.docs-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 14px;
}

.docs-hero-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.docs-hero-quicklinks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.docs-hero-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.docs-hero-link:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #10B981;
}

/* ── Mobile TOC toggle ── */
.docs-toc-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin: 12px 12px 0;
    font-family: inherit;
}

.docs-toc-toggle svg {
    transition: transform 0.2s;
}

.docs-toc-toggle.open svg {
    transform: rotate(180deg);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    body {
        padding: 0;
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .app-container {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto 1fr !important;
        gap: 0;
        border-radius: 0;
    }

    .header-bar {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    .main-content {
        grid-column: 1 !important;
        grid-row: 2 !important;
        overflow-y: auto;
    }

    .docs-layout {
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .docs-toc-toggle {
        display: flex;
    }

    .docs-toc {
        position: static;
        height: auto;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 0 16px 16px;
        display: none;
    }

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

    .docs-content {
        padding: 20px 16px 80px;
        overflow: visible;
    }

    .docs-h1 { font-size: 22px; }
    .docs-h2 { font-size: 18px; }
    .docs-step { padding: 12px; }
    .docs-features { grid-template-columns: 1fr; }
}
