/* =============================================
   JSON-LD Graph Visualization — Styles
   ============================================= */

/* ── Fonts ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

/* ── Design Tokens (Light Theme — default) ──── */

:root {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f8fafc;
    --bg-hover: #f1f5f9;
    --bg-active: #dbeafe;
    --bg-graph: #f8fafc;

    --text-primary: #1e293b;
    --text-heading: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-on-accent: #ffffff;

    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-subtle: #f1f5f9;
    --border-width: 1px;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-bg: #dbeafe;
    --accent-border: #93c5fd;
    --accent-text: #1e3a8a;

    --success: #22c55e;
    --success-text: #166534;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;

    --error: #ef4444;
    --error-text: #991b1b;
    --error-bg: #fef2f2;
    --error-border: #fecaca;

    --node-muted: #d1d5db;
    --edge-muted: #e5e7eb;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-tooltip: 0 18px 32px -24px rgba(15, 23, 42, 0.55), 0 8px 16px -12px rgba(15, 23, 42, 0.35);
    --shadow-ui-tooltip: 0 12px 28px -24px rgba(15, 23, 42, 0.65), 0 6px 16px -14px rgba(15, 23, 42, 0.4);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.2);

    --label-bg: rgba(255, 255, 255, 0.85);
    --badge-stroke: #ffffff;
    --overlay-bg: rgba(15, 23, 42, 0.4);

    --tooltip-bg: rgba(255, 255, 255, 0.97);
    --modal-bg: #ffffff;

    --marquee-bg: #f1f5f9;
    --marquee-text: #475569;
    --marquee-border: #e2e8f0;
    --marquee-highlight: #3b82f6;

    --glow: none;
    --glow-subtle: none;
    --control-glow: none;

    --transition-speed: 0.2s;

    /* CodeMirror node highlights */
    --cm-node-line: rgba(59, 130, 246, 0.16);
    --cm-node-ref-line: rgba(14, 165, 233, 0.14);

    /* Font stack */
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;

    /* Texture (none for light) */
    --bg-texture: none;
}

/* ── Dark Sci-Fi Theme ────────────────────────── */

[data-theme="dark"] {
    --bg-body: #0d0d0d;
    --bg-surface: #1a1a1a;
    --bg-surface-alt: #151515;
    --bg-hover: #2a2a2a;
    --bg-active: rgba(201, 162, 39, 0.15);
    --bg-graph: #0d0d0d;

    --text-primary: #e0e0e0;
    --text-heading: #f0e6c8;
    --text-secondary: #999999;
    --text-muted: #666666;
    --text-on-accent: #0d0d0d;

    --border-default: rgba(201, 162, 39, 0.25);
    --border-strong: rgba(201, 162, 39, 0.4);
    --border-subtle: rgba(201, 162, 39, 0.08);
    --border-width: 2px;

    --accent: #d4af37;
    --accent-hover: #e6c44b;
    --accent-bg: rgba(201, 162, 39, 0.15);
    --accent-border: rgba(201, 162, 39, 0.5);
    --accent-text: #e6c44b;

    --success: #22c55e;
    --success-text: #4ade80;
    --success-bg: rgba(34, 197, 94, 0.1);
    --success-border: rgba(34, 197, 94, 0.3);

    --error: #ef4444;
    --error-text: #f87171;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.3);

    --node-muted: #333333;
    --edge-muted: #2a2a2a;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.5);
    --shadow-tooltip: 0 18px 32px -12px rgba(0, 0, 0, 0.8);
    --shadow-ui-tooltip: 0 12px 28px -12px rgba(0, 0, 0, 0.8);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7);

    --label-bg: rgba(13, 13, 13, 0.85);
    --badge-stroke: #1a1a1a;
    --overlay-bg: rgba(0, 0, 0, 0.7);

    --tooltip-bg: rgba(26, 26, 26, 0.97);
    --modal-bg: #1a1a1a;

    --marquee-bg: #0a0a0a;
    --marquee-text: #d4af37;
    --marquee-border: rgba(201, 162, 39, 0.35);
    --marquee-highlight: #e6c44b;

    --glow: 0 0 8px rgba(201, 162, 39, 0.3);
    --glow-subtle: 0 0 4px rgba(201, 162, 39, 0.15);
    --control-glow: 0 0 6px rgba(201, 162, 39, 0.25);

    --cm-node-line: rgba(212, 175, 55, 0.16);
    --cm-node-ref-line: rgba(212, 175, 55, 0.10);

    /* Hacky monospace font */
    --font-body: 'Share Tech Mono', 'Fira Code', 'Courier New', monospace;

    /* Vintage CRT/noise texture via CSS gradient */
    --bg-texture:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(201, 162, 39, 0.015) 2px,
            rgba(201, 162, 39, 0.015) 4px),
        repeating-linear-gradient(90deg,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.06) 3px,
            rgba(0, 0, 0, 0.06) 4px);
}

/* ── Reset ─────────────────────────────────────── */

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

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    background-image: var(--bg-texture);
    color: var(--text-primary);
    transition: background var(--transition-speed), color var(--transition-speed);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* ── Marquee Banner ───────────────────────────── */

#marquee-banner {
    background: var(--marquee-bg);
    background-image: var(--bg-texture);
    border-bottom: var(--border-width) solid var(--marquee-border);
    overflow: hidden;
    white-space: nowrap;
    height: 32px;
    line-height: 32px;
    font-size: 12px;
    color: var(--marquee-text);
    flex-shrink: 0;
    position: relative;
}

/* Light track visible by default, dark track hidden */
#marquee-banner .marquee-light {
    display: inline-block;
}

#marquee-banner .marquee-dark {
    display: none;
}

[data-theme="dark"] #marquee-banner .marquee-light {
    display: none;
}

[data-theme="dark"] #marquee-banner .marquee-dark {
    display: inline-block;
}

#marquee-banner .marquee-track {
    display: inline-block;
    animation: marquee-scroll 45s linear infinite;
    padding-left: 100%;
}

#marquee-banner .marquee-track:hover {
    animation-play-state: paused;
}

#marquee-banner .marquee-sep {
    display: inline-block;
    margin: 0 24px;
    color: var(--marquee-highlight);
    font-weight: 700;
}

#marquee-banner .marquee-link {
    color: var(--marquee-highlight);
    text-decoration: none;
    font-weight: 700;
}

#marquee-banner .marquee-link:hover {
    text-decoration: underline;
}

[data-theme="dark"] #marquee-banner .marquee-link {
    text-shadow: 0 0 6px rgba(201, 162, 39, 0.5);
}

/* Fixed right badge */
#marquee-badge {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 16px 0 24px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--text-secondary);
    background: linear-gradient(90deg, transparent, var(--marquee-bg) 20%);
    z-index: 5;
}

[data-theme="dark"] #marquee-badge {
    color: #d4af37;
    text-shadow: 0 0 8px rgba(201, 162, 39, 0.6);
    background: linear-gradient(90deg, transparent, #0a0a0a 20%);
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.12em;
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ── Dark mode: thicker gold borders + vintage texture on panels ── */

[data-theme="dark"] #sidebar,
[data-theme="dark"] #jsonld-editor-wrapper,
[data-theme="dark"] #data-panel,
[data-theme="dark"] #stats,
[data-theme="dark"] #tooltip,
[data-theme="dark"] #ui-tooltip,
[data-theme="dark"] #info-modal {
    background-image: var(--bg-texture);
}

[data-theme="dark"] #sidebar {
    border-right-width: 2px;
}

[data-theme="dark"] #jsonld-editor-wrapper {
    border-right-width: 2px;
}

[data-theme="dark"] #data-panel {
    border-top-width: 2px;
}

[data-theme="dark"] .sidebar-section {
    border-bottom-width: 2px;
}

[data-theme="dark"] #sidebar-header {
    border-bottom-width: 2px;
}

[data-theme="dark"] #search-container {
    border-bottom-width: 2px;
}


/* ── Sidebar ───────────────────────────────── */

#sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease, background var(--transition-speed);
    flex-shrink: 0;
}

#sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

#sidebar.collapsed>* {
    display: none;
}

#sidebar-wrapper {
    position: relative;
    display: flex;
}

#sidebar-toggle {
    position: absolute;
    left: 320px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 50px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-secondary);
    z-index: 100;
    transition: left 0.3s ease, background-color var(--transition-speed);
    box-shadow: var(--shadow-sm);
}

#sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-heading);
    box-shadow: var(--control-glow);
}

#sidebar-toggle.sidebar-collapsed {
    left: 0;
}

#sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-default);
}

#sidebar-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}

[data-theme="dark"] #sidebar-header h1 {
    text-shadow: 0 0 12px rgba(201, 162, 39, 0.3);
}

#sidebar-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-header-action {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.sidebar-header-action:hover {
    background: var(--bg-hover);
    color: var(--text-heading);
    border-color: var(--border-strong);
    box-shadow: var(--control-glow);
}

/* ── Search ────────────────────────────────── */

#search-container {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
}

#search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: var(--glow-subtle);
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.search-result {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.search-result:hover {
    background: var(--bg-hover);
}

.search-result-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ── Collapsible sidebar sections ──────────── */

.sidebar-section {
    border-bottom: 1px solid var(--border-default);
    overflow: hidden;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-surface-alt);
    transition: background var(--transition-speed);
}

.sidebar-section-header:hover {
    background: var(--bg-hover);
}

.sidebar-section-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.sidebar-section-toggle {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.sidebar-section.collapsed .sidebar-section-toggle {
    transform: rotate(-90deg);
}

.sidebar-section-content {
    padding: 12px 20px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 500px;
    opacity: 1;
}

.sidebar-section.collapsed .sidebar-section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* ── Resize handle ─────────────────────────── */

.sidebar-resize-handle {
    height: 6px;
    background: transparent;
    cursor: ns-resize;
    position: relative;
    border-bottom: 1px solid var(--border-default);
}

.sidebar-resize-handle:hover {
    background: var(--bg-hover);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 3px;
    border-radius: 2px;
    background: var(--border-strong);
}

/* ── Filters ───────────────────────────────── */

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
}

.filter-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

.filter-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.filter-label {
    font-size: 14px;
    color: var(--text-primary);
}

.filter-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Legend ─────────────────────────────────── */

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-primary);
}

.legend-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

/* ── Node details ──────────────────────────── */

#details-container {
    flex: 1;
    overflow-y: auto;
}

#details-placeholder {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

#node-details {
    display: none;
}

#node-details.active {
    display: block;
}

#node-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
    color: var(--text-heading);
}

#node-type {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 16px;
}

#node-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.node-action-btn {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.node-action-btn:hover:not(:disabled) {
    background: var(--accent-bg);
    color: var(--accent-text);
    border-color: var(--accent-border);
    box-shadow: var(--control-glow);
}

.node-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.property-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.property-key {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.property-value {
    font-size: 13px;
    word-break: break-word;
    color: var(--text-primary);
}

.property-value a {
    color: var(--accent);
    text-decoration: none;
}

.property-value a:hover {
    text-decoration: underline;
}

/* ── JSON-LD editor panel ──────────────────── */

#jsonld-editor-wrapper {
    position: relative;
    display: flex;
    width: 440px;
    min-width: 440px;
    border-right: 1px solid var(--border-default);
    background: var(--bg-surface);
    transition: width 0.3s ease, min-width 0.3s ease, border-color 0.3s ease, background var(--transition-speed);
    flex-shrink: 0;
    z-index: 30;
}

#jsonld-editor-wrapper.collapsed {
    width: 0;
    min-width: 0;
    border-right-color: transparent;
}

#jsonld-editor-panel {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

#jsonld-editor-wrapper.collapsed #jsonld-editor-panel {
    opacity: 0;
    pointer-events: none;
}

#jsonld-editor-toggle {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 50px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-secondary);
    z-index: 120;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-speed), color var(--transition-speed);
}

#jsonld-editor-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-heading);
    box-shadow: var(--control-glow);
}

#jsonld-editor-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#jsonld-editor-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

#jsonld-editor-actions {
    display: flex;
    gap: 6px;
}

.jsonld-action-btn {
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 9px;
    cursor: pointer;
    transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.jsonld-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-heading);
    box-shadow: var(--control-glow);
}

#jsonld-editor-toolbar {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    display: flex;
    align-items: center;
    gap: 8px;
}

.jsonld-toolbar-btn {
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 9px;
    cursor: pointer;
    transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.jsonld-toolbar-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-heading);
}

.jsonld-toolbar-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

.jsonld-toolbar-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#jsonld-editor-status {
    min-height: 36px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-default);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-surface-alt);
}

#jsonld-editor-status.success {
    color: var(--success-text);
    background: var(--success-bg);
    border-bottom-color: var(--success-border);
}

#jsonld-editor-status.error {
    color: var(--error-text);
    background: var(--error-bg);
    border-bottom-color: var(--error-border);
}

#jsonld-editor-container {
    flex: 1;
    min-height: 0;
    display: flex;
    min-width: 0;
}

#jsonld-editor-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

#jsonld-editor-textarea {
    width: 100%;
    height: 100%;
}

#jsonld-editor-container .CodeMirror {
    height: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror {
    background: var(--bg-surface);
    color: var(--text-primary);
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror-gutters {
    background: var(--bg-surface-alt);
    border-right-color: var(--border-default);
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror-linenumber {
    color: var(--text-muted);
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror-cursor {
    border-left-color: var(--accent);
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror-selected {
    background: var(--accent-bg) !important;
}

[data-theme="dark"] #jsonld-editor-container .CodeMirror-activeline-background {
    background: rgba(201, 162, 39, 0.06);
}

/* syntax colors for dark theme */
[data-theme="dark"] .CodeMirror .cm-string {
    color: #e6c44b;
}

[data-theme="dark"] .CodeMirror .cm-number {
    color: #4ade80;
}

[data-theme="dark"] .CodeMirror .cm-property {
    color: #93c5fd;
}

[data-theme="dark"] .CodeMirror .cm-atom {
    color: #f97316;
}

[data-theme="dark"] .CodeMirror .cm-keyword {
    color: #c084fc;
}

#jsonld-editor-container .cm-node-line {
    background: var(--cm-node-line);
}

#jsonld-editor-container .cm-node-ref-line {
    background: var(--cm-node-ref-line);
}

#jsonld-minimap {
    width: 64px;
    min-width: 64px;
    border-left: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    position: relative;
    display: none;
    cursor: pointer;
}

#jsonld-minimap.visible {
    display: block;
}

#jsonld-minimap-track {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.08));
}

[data-theme="dark"] #jsonld-minimap-track {
    background: linear-gradient(to bottom, rgba(201, 162, 39, 0.08), rgba(201, 162, 39, 0.03));
}

#jsonld-minimap-markers {
    position: absolute;
    inset: 0;
}

.minimap-marker {
    position: absolute;
    left: 8px;
    right: 8px;
    min-height: 2px;
    border-radius: 2px;
    opacity: 0.95;
}

.minimap-marker-node {
    background: rgba(37, 99, 235, 0.95);
}

[data-theme="dark"] .minimap-marker-node {
    background: rgba(212, 175, 55, 0.9);
}

.minimap-marker-ref {
    background: rgba(14, 116, 144, 0.85);
}

[data-theme="dark"] .minimap-marker-ref {
    background: rgba(212, 175, 55, 0.5);
}

#jsonld-minimap-viewport {
    position: absolute;
    left: 4px;
    right: 4px;
    border: 1px solid rgba(100, 116, 139, 0.6);
    background: rgba(148, 163, 184, 0.16);
    border-radius: 4px;
    pointer-events: none;
    min-height: 10px;
}

[data-theme="dark"] #jsonld-minimap-viewport {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.1);
}

/* ── Graph container ───────────────────────── */

#graph-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

#graph-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

#sigma-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-graph);
    transition: background var(--transition-speed);
}

/* ── Controls ──────────────────────────────── */

#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.control-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: var(--control-glow);
}

.control-btn.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: var(--glow);
}

/* ── Layout dropdown ───────────────────────── */

#layout-toggle-wrapper {
    position: relative;
}

#layout-menu {
    position: absolute;
    top: 0;
    right: 48px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 4px;
    z-index: 100;
    display: none;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-md);
}

#layout-menu.visible {
    display: flex;
}

.layout-menu-item {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
    text-align: left;
    white-space: nowrap;
}

.layout-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.layout-menu-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

/* ── Drag hint ─────────────────────────────── */

#drag-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

[data-theme="dark"] #drag-hint {
    background: rgba(201, 162, 39, 0.85);
    color: #0d0d0d;
}

#drag-hint.visible {
    opacity: 1;
}

/* ── Stats ─────────────────────────────────── */

#stats {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

#stats span {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Tooltip ───────────────────────────────── */

#tooltip {
    position: absolute;
    background: var(--tooltip-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow-tooltip);
    backdrop-filter: blur(6px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    max-width: 360px;
    z-index: 1000;
}

#tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#tooltip-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-heading);
}

#tooltip-type {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 8px;
}

#tooltip-edge {
    font-size: 12px;
    color: var(--text-secondary);
}

#tooltip-properties {
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border-default);
    padding-top: 8px;
    margin-top: 8px;
}

.tooltip-prop {
    padding: 3px 0;
    display: flex;
    gap: 8px;
}

.tooltip-prop-key {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 80px;
    flex-shrink: 0;
}

.tooltip-prop-value {
    color: var(--text-primary);
    word-break: break-word;
}

/* ── UI tooltip (control buttons) ──────────── */

#ui-tooltip {
    position: absolute;
    left: 0;
    top: 0;
    background: var(--tooltip-bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow-ui-tooltip);
    color: var(--text-heading);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    padding: 7px 10px;
    max-width: 280px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 1200;
}

#ui-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ── Data Panel (bottom) ───────────────────── */

#data-panel {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    transition: max-height 0.3s ease, background var(--transition-speed);
    max-height: 280px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
}

#data-panel.collapsed {
    max-height: 36px;
}

#data-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-default);
    cursor: pointer;
}

#data-panel-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

#data-panel-toggle {
    font-size: 18px;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

#data-panel.collapsed #data-panel-toggle {
    transform: rotate(180deg);
}

#data-panel-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    background: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-default);
    overflow-x: auto;
}

.data-tab {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.data-tab:hover {
    color: var(--text-primary);
}

.data-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.data-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.data-tab-count {
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    color: var(--text-primary);
}

#data-panel-content {
    height: 200px;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.data-table-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
}

.data-table {
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--bg-surface-alt);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    color: var(--text-primary);
}

.data-table tr {
    cursor: pointer;
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.data-table tr.selected {
    background: var(--accent-bg);
}

/* ── Info modal ────────────────────────────── */

#info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.25s ease;
}

#info-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#info-modal {
    background: var(--modal-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-modal);
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
}

[data-theme="dark"] #info-modal {
    border: 1px solid var(--border-default);
}

#info-modal h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 4px;
}

[data-theme="dark"] #info-modal h2 {
    text-shadow: 0 0 12px rgba(201, 162, 39, 0.3);
}

#info-modal .modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

#info-modal .feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

#info-modal .feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

#info-modal .feature-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

#info-modal .feature-title {
    font-weight: 600;
    color: var(--text-heading);
}

#info-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

#info-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-heading);
    box-shadow: var(--control-glow);
}

#info-dismiss-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-speed), box-shadow var(--transition-speed);
}

#info-dismiss-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--glow);
}

.kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 11px;
    font-family: monospace;
    background: var(--bg-hover);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    color: var(--text-secondary);
}