/* SHEAF Tutorial styles — supplements ../styles.css */

:root {
    --tutorial-nav-width: 280px;
    --content-max-width: 860px;
    --bg: #000040;
    --bg-lighter: #000060;
    --bg-panel: #00003a;
    --text-color: #7FFF00;
    --text-dim: #5faa00;
    --text-muted: #3a7700;
    --line-color: #333380;
    --border-light: #4444aa;
    --white: #e0e0e0;
    --error: #ff4444;
    --font: 'Courier Prime', 'Courier New', monospace;
}

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

html, body {
    background: var(--bg);
    color: var(--text-color);
    font-family: var(--font);
    font-size: 14px;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

/* ── Navigation ─────────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--tutorial-nav-width);
    height: 100vh;
    background: var(--bg-lighter);
    border-right: 1px solid var(--line-color);
    overflow-y: auto;
    z-index: 50;
}

.navbar-content {
    padding: 40px 16px 40px;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section .nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding: 0 12px;
}

.nav-link {
    display: block;
    padding: 6px 12px;
    margin-bottom: 2px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
}

.nav-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    opacity: 1;
    background: rgba(127, 255, 0, 0.1);
    border-left: 2px solid var(--text-color);
    padding-left: 10px;
}

.nav-back {
    display: block;
    padding: 8px 12px;
    margin-bottom: 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
    opacity: 0.6;
    border: 1px solid var(--line-color);
    border-radius: 6px;
    text-align: center;
}

.nav-back:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

/* ── Hamburger toggle (mobile) ──────────────────────────── */
.navbar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    background: var(--bg-lighter);
    border: 1px solid var(--line-color);
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

.navbar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-color);
}

/* ── Main content area ──────────────────────────────────── */
.tutorial-main {
    margin-left: var(--tutorial-nav-width);
    padding: 40px 40px 120px;
    max-width: calc(var(--content-max-width) + var(--tutorial-nav-width) + 80px);
}

.tutorial-section {
    margin-bottom: 80px;
    scroll-margin-top: 20px;
}

.tutorial-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-color);
    border-bottom: 1px solid var(--line-color);
    padding-bottom: 8px;
}

.tutorial-section h3 {
    font-size: 18px;
    margin: 30px 0 12px;
    color: var(--text-color);
}

.tutorial-prose {
    line-height: 1.7;
    font-size: 15px;
    max-width: var(--content-max-width);
    margin-bottom: 16px;
    opacity: 0.85;
    color: var(--white);
}

.tutorial-prose a {
    color: var(--text-color);
    text-decoration: underline;
}

.tutorial-prose code {
    background: rgba(127, 255, 0, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 14px;
    color: var(--text-color);
}

.tutorial-prose em {
    font-style: italic;
    color: var(--text-color);
}

.tutorial-prose strong {
    color: var(--text-color);
}

/* ── Try-it SHEAF widget ────────────────────────────────── */
.try-it {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--line-color);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0 24px;
    max-width: var(--content-max-width);
}

.try-it-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.try-it-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--line-color);
    border-radius: 6px;
    color: var(--text-color);
    font-family: var(--font);
    font-size: 14px;
    resize: vertical;
    line-height: 1.5;
}

.try-it-input::placeholder {
    opacity: 0.4;
}

.try-it-btn {
    padding: 10px 20px;
    background: rgba(127, 255, 0, 0.15);
    border: 1px solid var(--text-color);
    border-radius: 6px;
    color: var(--text-color);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    align-self: flex-start;
}

.try-it-btn:hover {
    background: rgba(127, 255, 0, 0.25);
}

.try-it-btn:disabled {
    opacity: 0.4;
    cursor: wait;
}

/* ── Results rendering ──────────────────────────────────── */
.try-it-result {
    min-height: 20px;
}

.result-binding {
    margin-bottom: 16px;
    border: 1px solid var(--line-color);
    border-radius: 4px;
    overflow: hidden;
}

.result-binding-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--line-color);
}

.result-binding-name {
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
}

.result-binding-type {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-binding-value {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-color);
    overflow-x: auto;
}

.result-binding-value pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font);
    font-size: 13px;
}

.result-binding-value .inline-val {
    font-size: 15px;
}

.result-tree-container {
    min-height: 200px;
    overflow-x: auto;
}

.result-tree-container .tree-wrapper {
    width: 100%;
}

.result-error {
    background: rgba(255, 68, 68, 0.1);
    border-left: 3px solid var(--error);
    padding: 8px 12px;
    margin-bottom: 6px;
    color: var(--error);
    font-size: 13px;
}

.result-timing {
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 8px;
}

/* ── Code blocks with tabs ──────────────────────────────── */
.code-example {
    max-width: var(--content-max-width);
    margin: 20px 0 24px;
    border: 1px solid var(--line-color);
    border-radius: 8px;
    overflow: hidden;
}

.code-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--line-color);
    overflow-x: auto;
}

.code-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    opacity: 0.5;
    white-space: nowrap;
    transition: opacity 0.2s, background 0.2s;
    border-bottom: 2px solid transparent;
}

.code-tab:hover {
    opacity: 0.8;
}

.code-tab.active {
    opacity: 1;
    border-bottom-color: var(--text-color);
    background: rgba(127, 255, 0, 0.05);
}

.code-panel {
    display: none;
    position: relative;
}

.code-panel.active {
    display: block;
}

.code-panel pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.15);
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: rgba(127, 255, 0, 0.1);
    border: 1px solid var(--line-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    opacity: 1;
}

/* ── Type / operation tables ────────────────────────────── */
.type-table {
    max-width: var(--content-max-width);
    margin: 16px 0 24px;
    overflow-x: auto;
}

.type-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.type-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--line-color);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(51, 51, 128, 0.5);
    color: var(--white);
}

.type-table td code {
    background: rgba(127, 255, 0, 0.1);
    padding: 1px 4px;
    border-radius: 2px;
    color: var(--text-color);
    font-size: 13px;
}

/* ── Tooltip (for tree viz) ─────────────────────────────── */
.node-tooltip {
    position: fixed;
    background: rgba(0, 0, 40, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 12px;
    color: var(--white);
    pointer-events: auto;
    z-index: 1000;
    max-width: 300px;
    display: none;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--line-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ── reCAPTCHA badge hide ───────────────────────────────── */
.grecaptcha-badge {
    visibility: hidden !important;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .navbar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .navbar.visible {
        transform: translateX(0);
    }
    .tutorial-main {
        margin-left: 0;
        padding: 60px 20px 80px;
    }
    .navbar-toggle {
        display: flex !important;
    }
}
