/**
 * undoRT.css - Shared stylesheet for project documentation pages
 * Version: 1.0.0
 * Used by: st2cpp, undoCore, undoPLC, undoBUS
 * Self-contained - does not depend on any other CSS
 */

/* ============================================================================
   ROOT VARIABLES
   ============================================================================ */
:root {
    --bg-main:        #030712;
    --bg-card:        #0b1329;
    --bg-sidebar:     #080f22;
    --border:         #1c2541;
    --cyan:           #00b4d8;
    --cyan-dim:       rgba(0, 180, 216, 0.15);
    --lavender:       #b0a8cc;
    --text:           #f3f4f6;
    --text-muted:     #9ca3af;
    --green:          #34d399;
    --yellow:         #fbbf24;
    --red:            #f87171;
    --sidebar-width:  260px;
    --header-h:       56px;
    --font-family:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-main);
    color: var(--text);
    font-family: var(--font-family);
    line-height: 1.7;
    scroll-behavior: smooth;
}

a {
    color: var(--cyan);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* ============================================================================
   TOP BAR
   ============================================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    z-index: 1000;
}

.topbar-logo {
    height: 28px;
    width: auto;
}

.topbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
}

.topbar-product {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cyan);
    text-decoration: none;
    white-space: nowrap;
}

.topbar-product:hover {
    color: var(--cyan);
    text-decoration: none;
}

.topbar-version {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--cyan-dim);
    color: var(--cyan);
    border: 1px solid rgba(0, 180, 216, 0.2);
    font-weight: 600;
    white-space: nowrap;
}

.topbar-version.placeholder {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-muted);
    border-color: rgba(156, 163, 175, 0.2);
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.topbar-links {
    margin-left: auto;
    display: flex;
    gap: 20px;
    align-items: center;
}

.topbar-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.topbar-links a:hover {
    color: var(--text);
    text-decoration: none;
}

.topbar-links a.gh {
    color: var(--lavender);
    border: 1px solid rgba(176, 168, 204, 0.3);
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 600;
}

.topbar-links a.gh:hover {
    background: var(--lavender);
    color: var(--bg-main);
    text-decoration: none;
}

/* ============================================================================
   DROPDOWN
   ============================================================================ */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    font-family: inherit;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.dropdown-open .nav-dropdown-toggle {
    color: var(--text);
}

.nav-dropdown-toggle .chevron {
    width: 11px;
    height: 11px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-dropdown.dropdown-open .nav-dropdown-toggle .chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 16px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
}

.nav-dropdown.dropdown-open .nav-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
}

.nav-dropdown-menu a strong {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
}

.nav-dropdown-menu a span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.nav-dropdown-menu a:hover strong {
    color: var(--cyan);
}

.nav-dropdown-menu a.current strong::after {
    content: 'Current';
    margin-left: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--green);
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    padding: 2px 6px;
    border-radius: 8px;
    vertical-align: middle;
}

.nav-dropdown-soon {
    padding: 10px 12px 6px;
    font-size: 0.74rem;
    color: #4b5563;
    font-style: italic;
}

/* ============================================================================
   MOBILE TOGGLES
   ============================================================================ */
.topbar-actions {
    display: none;
    margin-left: auto;
    align-items: center;
    gap: 8px;
}

.toc-toggle,
.nav-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toc-toggle:hover,
.toc-toggle.active,
.nav-toggle:hover,
.nav-toggle.active {
    color: var(--text);
    border-color: var(--cyan);
}

.toc-toggle .chevron {
    width: 10px;
    height: 10px;
    transition: transform 0.2s ease;
}

.toc-toggle.active .chevron {
    transform: rotate(180deg);
}

.nav-toggle {
    flex-direction: column;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    gap: 4px;
}

.nav-toggle-bar {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease, background 0.2s ease;
}

.nav-toggle.active .nav-toggle-bar { background: var(--text); }
.nav-toggle.active .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.active .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================================
   LAYOUT
   ============================================================================ */
.layout {
    display: flex;
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 28px 0 40px;
}

.sidebar-section-title {
    padding: 0 20px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #4b5563;
    margin-top: 24px;
}

.sidebar-section-title:first-child { margin-top: 0; }

.sidebar a {
    display: block;
    padding: 6px 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
}

.sidebar a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
}

.sidebar a.active {
    color: var(--cyan);
    border-left-color: var(--cyan);
    background: var(--cyan-dim);
}

/* ============================================================================
   CONTENT
   ============================================================================ */
.content {
    flex: 1;
    max-width: 860px;
    padding: 52px 64px 100px;
    min-width: 0;
}

.content h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #fff;
}

.content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 52px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: #fff;
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 28px 0 10px;
    color: var(--cyan);
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.content p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.content p strong {
    color: var(--text);
}

.content .lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    border-left: 3px solid var(--cyan);
    padding-left: 16px;
    margin-bottom: 36px;
}

/* ============================================================================
   CODE
   ============================================================================ */
pre {
    background: #060e1e;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;
    overflow-x: auto;
    margin: 16px 0 24px;
    font-size: 0.855rem;
    line-height: 1.6;
}

code {
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.9em;
    color: #d4d4d4;
}

p code,
li code {
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--cyan);
}

/* ============================================================================
   TABLES
   ============================================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 28px;
    font-size: 0.88rem;
}

th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(28, 37, 65, 0.6);
    color: var(--text-muted);
    vertical-align: top;
}

td:first-child {
    color: var(--text);
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   CALLOUTS
   ============================================================================ */
.callout {
    padding: 14px 18px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 0.9rem;
}

.callout.info {
    background: rgba(0, 180, 216, 0.07);
    border: 1px solid rgba(0, 180, 216, 0.2);
    color: #7dd3fc;
}

.callout.warn {
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.callout.success {
    background: rgba(52, 211, 153, 0.07);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--green);
}

.callout.placeholder {
    background: rgba(156, 163, 175, 0.05);
    border: 1px dashed rgba(156, 163, 175, 0.25);
    color: var(--text-muted);
}

/* ============================================================================
   STATUS PILLS
   ============================================================================ */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
    vertical-align: middle;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pill.available {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--green);
}

.status-pill.available::before {
    background: var(--green);
    box-shadow: 0 0 5px var(--green);
}

.status-pill.in-development {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-pill.in-development::before {
    background: #fbbf24;
    box-shadow: 0 0 5px #fbbf24;
}

.status-pill.release {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.status-pill.release::before {
    background: #34d399;
    box-shadow: 0 0 5px #34d399;
}

.status-pill.next-release {
    background: rgba(174, 0, 255, 0.1);
    border: 1px solid rgba(243, 9, 255, 0.2);
    color: #f975e9;
}

.status-pill.next-release::before {
    background: #f975e9;
    box-shadow: 0 0 5px #f975e9;
}

/* ============================================================================
   FEATURE LIST
   ============================================================================ */
.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    margin: 16px 0 24px;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.feature-list li::before {
    content: '✓';
    color: var(--green);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ============================================================================
   COMING SOON BANNER
   ============================================================================ */
.coming-soon-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 12px;
    padding: 20px 28px;
    margin: 32px 0 24px;
}

.coming-soon-banner-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.coming-soon-banner h3 {
    color: #fbbf24;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.coming-soon-banner p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
footer {
    text-align: center;
    padding: 60px 20px;
    color: #4b5563;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    margin-top: 100px;
}

/* ============================================================================
   RESPONSIVE - Mobile
   ============================================================================ */
@media (max-width: 768px) {
    .topbar { padding: 0 16px; gap: 12px; }
    .topbar-sep { display: none; }

    .content { padding: 32px 24px 80px; }
    .feature-list { grid-template-columns: 1fr; }

    .topbar-actions { display: flex; }

    .sidebar {
        display: block;
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        width: auto;
        height: auto;
        max-height: 0;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: var(--bg-sidebar);
        transition: max-height 0.3s ease;
        z-index: 999;
        padding: 0;
    }

    .sidebar.toc-open {
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px 0 24px;
    }

    .topbar-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(3, 7, 18, 0.97);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .topbar-links.nav-open {
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .topbar-links > a,
    .topbar-links > .nav-dropdown > .nav-dropdown-toggle {
        width: 100%;
        padding: 14px 24px;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        justify-content: space-between;
    }

    .topbar-links > a.gh {
        margin: 12px 24px 16px;
        width: auto;
        text-align: center;
        justify-content: center;
        border-bottom: none;
    }

    .nav-dropdown { width: 100%; }

    .nav-dropdown-menu {
        position: static;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        max-height: 0;
        overflow: hidden;
        border: none;
        border-radius: 0;
        padding: 0;
        background: rgba(255, 255, 255, 0.02);
        box-shadow: none;
        transition: max-height 0.25s ease;
    }

    .nav-dropdown.dropdown-open .nav-dropdown-menu {
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 0 8px 24px;
    }

    .nav-dropdown-menu a,
    .nav-dropdown-soon {
        padding: 10px 24px 10px 0;
        border-bottom: none;
    }
}

@media (max-width: 420px) {
    .topbar-version { display: none; }
}

/* ============================================================================
   PRINT
   ============================================================================ */
@media print {
    body { background: #fff !important; color: #000 !important; }
    .topbar { background: #fff !important; border-color: #ccc !important; }
    .topbar-product { color: #000 !important; }
    .topbar-version { color: #666 !important; border-color: #ccc !important; }
    .topbar-links { display: none !important; }
    .sidebar { display: none !important; }
    .content { padding: 20px !important; max-width: 100% !important; }
    .callout { border: 1px solid #ccc !important; background: #f5f5f5 !important; color: #000 !important; }
    pre { background: #f5f5f5 !important; border: 1px solid #ccc !important; }
    .feature-list li::before { color: #000 !important; }
    footer { margin-top: 40px !important; border-top: 1px solid #ccc !important; color: #666 !important; }
}