/* HTML Documentation Stylesheet for Loopshore */

:root {
    --loopshore-green: #3ae287;
    --loopshore-green-hover: #2fd175;
    --text-dark: #1a1a1a;
    --text-gray: #666;
    --text-light: #888;
    --border-color: #e5e5e5;
    --bg-light: #f8f9fa;
    --sidebar-width: 280px;
    --header-height: 88px; /* logo (56px min) + padding (32px) */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: #fff;
}

/* Header - matches portal style */
.doc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    flex-shrink: 0;
}

.logo {
    height: clamp(56px, 6vw, 84px);
    box-shadow: none;
    margin: 0;
    border-radius: 0;
}

/* Breadcrumb navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-left: 1.5rem;
    flex: 1;
    min-width: 0;
}

.breadcrumb a {
    color: #0066cc;
    text-decoration: none;
    white-space: nowrap;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #999;
    flex-shrink: 0;
}

.breadcrumb-current {
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
}

.lang-link {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-gray);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.lang-link:hover {
    border-color: var(--loopshore-green);
    color: var(--text-dark);
}

.lang-link.active {
    background: var(--loopshore-green);
    border-color: var(--loopshore-green);
    color: var(--text-dark);
}

/* TOC Toggle Button (mobile & collapsed state) */
.toc-toggle {
    position: fixed;
    top: calc(var(--header-height) + 1rem);
    left: 1rem;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.toc-toggle:hover {
    border-color: var(--loopshore-green);
    background: var(--bg-light);
}

/* TOC Sidebar */
.toc-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: #fff;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 80;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.toc-sidebar.collapsed {
    transform: translateX(-100%);
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
    position: sticky;
    top: 0;
}

.toc-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.toc-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-gray);
    border-radius: 4px;
    transition: all 0.2s;
}

.toc-close:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.toc-nav {
    padding: 1rem;
}

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

.toc-nav > ul > li {
    margin-bottom: 0.5rem;
}

.toc-nav ul ul {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.toc-nav a {
    display: block;
    padding: 0.4rem 0.5rem;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.toc-nav a:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.toc-nav a.active {
    background: rgba(58, 226, 135, 0.15);
    color: var(--text-dark);
    font-weight: 500;
}

/* Main Content */
.doc-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem 3rem 4rem;
    max-width: 900px;
    transition: margin-left 0.3s ease;
}

.doc-content.no-toc {
    margin-left: auto;
    margin-right: auto;
}

.toc-sidebar.collapsed ~ .doc-content {
    margin-left: 0;
}

.doc-title-block {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--loopshore-green);
}

.doc-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.doc-subtitle {
    font-size: 1.1rem;
    color: var(--text-gray);
}

/* Typography */
h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 2rem 0 0.75rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 1.5rem 0 0.5rem;
}

p {
    margin: 1rem 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

img.small {
    max-width: 400px;
}

figure {
    margin: 1.5rem 0;
}

figcaption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-top: 0.5rem;
}

/* Installation steps (side-by-side small images with captions) */
.install-steps {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    align-items: flex-start;
    justify-content: center;
}

.install-steps figure {
    flex: 0 1 auto;
    text-align: center;
    margin: 0;
}

.install-steps img {
    max-height: 160px;
    max-width: 120px;
    margin: 0 auto 0.5rem auto;
    box-shadow: none;
}

.install-steps figcaption {
    font-size: 0.85rem;
    line-height: 1.3;
    max-width: 150px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: var(--loopshore-green);
    color: var(--text-dark);
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: var(--bg-light);
}

/* Code */
pre, code {
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 0.9rem;
}

code {
    background: var(--bg-light);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: #d63384;
}

pre {
    background: #1a1a1a;
    color: #f8f8f2;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Lists */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
}

li > ul, li > ol {
    margin: 0.5rem 0;
}

/* Links */
a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Blockquotes */
blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--loopshore-green);
    background: var(--bg-light);
    font-style: italic;
    color: var(--text-gray);
}

blockquote p {
    margin: 0;
}

/* Horizontal rule */
hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* Footer */
.doc-footer {
    background: var(--text-dark);
    color: #fff;
    padding: 1.5rem 2rem;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

.doc-footer.no-toc {
    margin-left: 0;
}

.toc-sidebar.collapsed ~ .doc-content ~ .doc-footer,
.toc-sidebar.collapsed ~ .doc-footer {
    margin-left: 0;
}

.footer-inner {
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    color: var(--loopshore-green);
    font-weight: bold;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--loopshore-green);
    text-decoration: none;
}

.footer-copyright {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .doc-content {
        padding: 2rem 2rem 4rem;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }

    .breadcrumb {
        margin-left: 0;
        font-size: 0.8rem;
        justify-content: center;
        flex-wrap: wrap;
    }

    .breadcrumb-current {
        max-width: 200px;
    }

    .lang-switcher {
        justify-content: center;
    }

    .toc-sidebar {
        width: 100%;
        max-width: 320px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
    }

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

    .doc-content {
        margin-left: 0;
        padding: 1.5rem 1rem 3rem;
        margin-top: 180px; /* Header height on mobile (stacked layout: logo + breadcrumbs + lang) */
    }

    .doc-footer {
        margin-left: 0;
    }

    .doc-title {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .toc-toggle {
        display: flex;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (min-width: 769px) {
    .toc-toggle {
        display: none;
    }

    .toc-sidebar:not(.collapsed) ~ .doc-content .toc-toggle {
        display: none;
    }

    .toc-sidebar.collapsed ~ .doc-content .toc-toggle,
    .toc-sidebar.collapsed ~ .toc-toggle {
        display: flex;
    }
}

/* Overlay for mobile when TOC is open */
.toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 70;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.toc-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* API Status Badges */
.badge-stable,
.badge-draft {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 0.5em;
}

.badge-stable {
    background-color: var(--loopshore-green);
    color: var(--text-dark);
}

.badge-draft {
    background-color: #f0ad4e;
    color: var(--text-dark);
}

/* Print styles */
@media print {
    .doc-header,
    .toc-sidebar,
    .toc-toggle,
    .doc-footer {
        display: none;
    }

    .doc-content {
        margin: 0;
        padding: 0;
        max-width: none;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--text-gray);
    }
}
