/* Interactive Documentation Viewer Styles */

:root {
    --sidebar-width: 280px;
    --header-height: 60px;
}

/* Interactive Viewer Layout */
.interactive-viewer {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Navigation */
.docs-sidebar {
    width: var(--sidebar-width);
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    flex-shrink: 0;
}

.docs-sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.docs-sidebar-header h2 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.docs-sidebar-header .back-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.docs-sidebar-header .back-link:hover {
    text-decoration: underline;
}

.docs-nav {
    padding: 1rem 0;
}

.docs-nav-section {
    margin-bottom: 1.5rem;
}

.docs-nav-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.docs-nav-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    min-height: 44px; /* Touch target */
    display: flex;
    align-items: center;
}

.docs-nav-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.docs-nav-item.active {
    background: #eef2ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

.docs-nav-item svg {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Main Content Area */
.docs-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Bar */
.docs-topbar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.docs-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    min-height: 44px; /* Touch target */
}

.view-btn:hover {
    background: #f9fafb;
    border-color: #667eea;
}

.view-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.view-btn svg {
    width: 16px;
    height: 16px;
}

/* Split View Container */
.split-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.split-pane {
    flex: 1;
    overflow: auto;
    position: relative;
}

.split-pane.docs-pane {
    background: white;
    border-right: 1px solid #e5e7eb;
}

.split-pane.app-pane {
    background: #f9fafb;
}

.split-pane.hidden {
    display: none;
}

/* Resizer */
.resizer {
    width: 5px;
    background: #e5e7eb;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
}

.resizer:hover {
    background: #667eea;
}

.resizer::before {
    content: '';
    position: absolute;
    left: -5px;
    right: -5px;
    top: 0;
    bottom: 0;
}

/* Documentation Content */
.docs-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.docs-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #111827;
}

.docs-content h2 {
    font-size: 1.875rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.docs-content h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #374151;
}

.docs-content h4 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

.docs-content p {
    margin-bottom: 1rem;
    line-height: 1.75;
    color: #4b5563;
}

.docs-content a {
    color: #667eea;
    text-decoration: none;
}

.docs-content a:hover {
    text-decoration: underline;
}

.docs-content code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    color: #dc2626;
}

.docs-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

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

.docs-content ul,
.docs-content ol {
    margin: 1rem 0 1rem 2rem;
    color: #4b5563;
}

.docs-content li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
}

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.docs-content th,
.docs-content td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
}

.docs-content th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
}

.docs-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #6b7280;
    font-style: italic;
}

.docs-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

/* App Frame */
.app-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.app-frame-container {
    padding: 2rem;
    height: 100%;
}

.app-placeholder {
    background: white;
    border: 2px dashed #e5e7eb;
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    color: #6b7280;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.app-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.app-placeholder h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.app-placeholder p {
    margin-bottom: 1.5rem;
}

/* Mobile Sidebar Toggle */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .docs-content {
        padding: 2rem 1.5rem;
    }

    .split-container.split-view .split-pane {
        flex: none;
        width: 100%;
    }

    .split-container.split-view .resizer {
        display: none;
    }
}

@media (max-width: 768px) {
    .interactive-viewer {
        flex-direction: column;
    }

    .docs-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        z-index: 999;
        transition: left 0.3s;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .docs-sidebar.open {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .docs-topbar {
        padding: 0 1rem;
    }

    .docs-title {
        font-size: 1rem;
    }

    .view-controls {
        gap: 0.25rem;
    }

    .view-btn {
        padding: 0.5rem;
        font-size: 0;
        min-height: 44px;
        min-width: 44px;
    }

    .view-btn svg {
        margin: 0;
    }

    .docs-content {
        padding: 1.5rem 1rem;
    }

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

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

    .docs-content h3 {
        font-size: 1.25rem;
    }

    .docs-content pre {
        padding: 1rem;
        font-size: 0.8rem;
        margin: 1rem -1rem;
        border-radius: 0;
    }

    .docs-content table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .split-pane.docs-pane {
        border-right: none;
    }

    .app-frame-container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .docs-sidebar-header {
        padding: 1rem 0.75rem;
    }

    .docs-nav-item {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }

    .docs-content {
        padding: 1rem 0.75rem;
    }

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

    .docs-content h2 {
        font-size: 1.375rem;
        margin-top: 2rem;
    }

    .docs-content h3 {
        font-size: 1.125rem;
        margin-top: 1.5rem;
    }

    .docs-content pre {
        font-size: 0.75rem;
    }

    .mobile-menu-btn {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* Loading State */
.docs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
}

.docs-loading svg {
    animation: spin 1s linear infinite;
    width: 48px;
    height: 48px;
}

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

/* Table of Contents */
.toc {
    position: sticky;
    top: 2rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 2rem 0;
}

.toc h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 0 0 0.75rem 0;
}

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

.toc li {
    margin: 0;
}

.toc a {
    display: block;
    padding: 0.5rem 0;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.875rem;
}

.toc a:hover {
    color: #667eea;
}

.toc a.active {
    color: #667eea;
    font-weight: 500;
}
