/* ─── FONTS ─── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Ubuntu+Mono:wght@400;700&display=swap');

/* ─── PURE BLACK ON WHITE DESIGN SYSTEM ─── */
:root {
    --bg-page: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #ecfdf5;

    --border: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-hover: #cbd5e1;
    --border-focus: #0f172a;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    --accent-r: #10b981;
    --accent-blue: #0284c7;
    --accent-highlight: #fef08a;
    --accent-highlight-text: #854d0e;

    --code-bg: #ffffff;
    --code-border: #e2e8f0;
    --code-text: #0f172a;
    --inline-code-bg: #f8fafc;
    --inline-code-border: #e2e8f0;

    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Ubuntu Mono', Consolas, Monaco, 'Courier New', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --transition: all 0.15s ease-in-out;
}

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

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-y: scroll;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ─── NAVBAR & LAYOUT ─── */
.navbar { background: #ffffff; border-bottom: 1px solid var(--border); padding: 14px 24px; }
.navbar-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-icon { width: 30px; height: 30px; border-radius: 6px; background: #ffffff; border: 1.5px solid var(--border-hover); color: var(--accent-r); display: inline-flex; align-items: center; justify-content: center; }
.brand-logo-text { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; color: var(--text-primary); line-height: 1; }
.brand-r { color: var(--accent-r); }

.lang-switch { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.lang-btn { background: transparent; border: none; color: var(--text-faint); cursor: pointer; padding: 3px 6px; border-radius: 4px; transition: var(--transition); font-family: inherit; font-size: inherit; }
.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active { color: var(--text-primary); background: var(--bg-hover); font-weight: 700; }
.lang-sep { color: var(--border-hover); user-select: none; }
.top-nav-actions { display: flex; align-items: center; gap: 6px; }
.info-btn { background: transparent; border: none; color: var(--accent-r); font-family: var(--font-sans); font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.info-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal-backdrop.open { display: flex; }
.modal-card { background: #ffffff; border: 1px solid var(--border); border-radius: 12px; max-width: 480px; width: 100%; padding: 24px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); position: relative; text-align: left; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.modal-title svg { color: var(--accent-r); }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; font-size: 18px; }

/* Main Grid */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.main-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.sidebar { position: sticky; top: 24px; }
.card { background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.config-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.input-text { width: 100%; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-primary); outline: none; transition: var(--transition); }
.input-text:focus { border-color: var(--border-focus); }
.btn-reset { display: inline-flex; align-items: center; justify-content: center; margin-top: 4px; background: transparent; border: none; padding: 4px; color: var(--accent-r); cursor: pointer; align-self: flex-start; opacity: 0.85; }

/* Tree & Content Area */
.content-area { display: flex; flex-direction: column; gap: 16px; min-width: 0; width: 100%; }
.search-box { position: relative; display: flex; align-items: center; width: 100%; }
.search-icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 38px 10px 36px; font-family: var(--font-sans); font-size: 14px; color: var(--text-primary); outline: none; }
.search-input:focus { border-color: var(--border-focus); }
.search-clear { position: absolute; right: 12px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; display: none; font-size: 16px; }

.tree-container { display: flex; flex-direction: column; gap: 0; background: #ffffff; width: 100%; }

/* Section Group Headers (Cyber Kill Chain & Extra) */
.section-group-header {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 16px 14px 6px 14px;
    border-bottom: none;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.section-group-header.extra-header-spacing {
    margin-top: 24px;
}

.category-card { background: transparent; border: none; border-radius: 0; overflow: visible; }
.node { display: flex; flex-direction: column; width: 100%; min-width: 0; }
.node-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px; cursor: pointer; user-select: none; transition: background 0.12s; }
.node-row:hover { background: var(--bg-hover); }

.node-row.top-level { 
    background: #ffffff; 
    padding: 13px 16px; 
    border-bottom: none; 
}
.node-row.top-level .node-label { 
    font-weight: 700; 
    font-size: 14px; 
    color: #334155; 
}

.children {
    display: none;
    padding-left: 20px;
    margin-left: 20px;
    margin-top: 2px;
    margin-bottom: 6px;
}
.children.visible { display: block; }

.node-toggle { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.node-toggle svg { width: 13px; height: 13px; transition: transform 0.15s ease; }
.node-row.expanded .node-toggle svg { transform: rotate(90deg); color: var(--text-primary); }

.node-check-wrap { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.node-chk { appearance: none; width: 15px; height: 15px; border: 1.5px solid var(--border-hover); border-radius: 3px; background: #ffffff; cursor: pointer; position: relative; margin: 0; }
.node-chk:checked { background: var(--accent-r); border-color: var(--accent-r); }
.node-chk:checked::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 7px; border: solid #ffffff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.node-label { flex-grow: 1; font-size: 13px; font-weight: 500; color: var(--text-primary); }


/* ─── CODE BOX CONTAINER ─── */
.code-container {
    margin: 4px 14px 12px 34px;
    background: transparent;
    border: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
}
.code-container.hidden { display: none; }

.code-header { display: none; }
.code-header-badge { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-muted); }

.btn-copy {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--font-sans); font-size: 11px; font-weight: 500;
    padding: 3px 8px; border-radius: 4px; background: #ffffff;
    border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer;
    transition: var(--transition);
}
.btn-copy:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-copy.copied { background: var(--accent-r); border-color: var(--accent-r); color: #ffffff; }

/* ─── PRE & TERMINAL FORMATTING ─── */
pre {
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--code-text);
    white-space: pre-wrap;
    word-break: break-all;
    background: var(--code-bg);
    margin: 0;
}

pre code {
    font-family: var(--font-mono);
    font-size: inherit;
    background: transparent !important;
    border: none;
    color: inherit;
}

.code-intro {
    display: block;
    font-family: var(--font-sans);
    font-size: 12.5px;
    line-height: 1.5;
    font-weight: 500;
    color: var(--accent-r);
    margin: 0 0 10px 0;
    white-space: normal;
    word-break: normal;
}

.code-h1 {
    display: inline;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    color: var(--text-primary);
    background: none;
    border-left: none;
}

.code-h2 {
    display: inline;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-left: 2ch;
}

.code-h2::before {
    content: "• ";
    color: var(--accent-r);
    font-weight: 700;
}

.code-line {
    margin-left: 4ch;
    font-family: var(--font-mono);
}

pre a {
    display: inline-block;
    color: var(--accent-blue);
    font-weight: 500;
    margin: 2px 0;
    font-family: var(--font-mono);
}
pre a:hover {
    text-decoration: underline;
}

.inline-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--inline-code-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    margin: 3px 0;
    user-select: all;
    transition: background 0.1s;
}
.inline-code:hover {
    background: #e2e8f0;
    border-color: var(--border-hover);
}
.code-prompt {
    color: var(--accent-r);
    font-weight: 700;
    user-select: none;
    font-family: var(--font-mono);
}

/* Search Highlight */
.highlight {
    background: var(--accent-highlight);
    color: var(--accent-highlight-text);
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 2px;
}

/* Toast Notification */
.toast {
    position: fixed; bottom: 20px; right: 20px; z-index: 9999;
    display: flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: #0f172a; color: #ffffff; font-size: 12px; font-weight: 500;
    border-radius: 6px; opacity: 0; transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 800px) {
    .main-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .container { padding: 16px; }
}
