/* DollarFlow — Phase 3A: Bot Builder terminal interior */

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

:root {
    --dft-void: #0a0e14;
    --dft-void-soft: #0c0f1a;
    --dft-cyan: #00e5ff;
    --dft-magenta: #ff2d87;
    --dft-text: #f0f4ff;
    --dft-muted: #8b95b0;
    --dft-glass: rgba(12, 15, 26, 0.92);
    --dft-glass-border: rgba(0, 229, 255, 0.18);
    --dft-grid: rgba(0, 229, 255, 0.1);
}

/* Theme is opt-in; see `app.html` query/localStorage gate. */

/* ── Workspace shell ─────────────────────────────────────────── */

html.dft-bot-builder-active .bot-builder--active {
    background: var(--dft-void) !important;
}

html.dft-bot-builder-active .bot-builder--active .injectionDiv {
    background: var(--dft-void);
}

/* Blockly canvas */
html.dft-bot-builder-active .bot-builder--active .blocklyMainBackground {
    fill: var(--dft-void) !important;
}

html.dft-bot-builder-active .bot-builder--active .blocklyGrid line,
html.dft-bot-builder-active .bot-builder--active .blocklyGrid > line {
    stroke: var(--dft-grid) !important;
}

html.dft-bot-builder-active .bot-builder--active .blocklySelected > .blocklyPath {
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.55));
}

/* Block input fields on dark canvas */
html.dft-bot-builder-active .bot-builder--active .zelos-renderer .blocklyEditableText > rect:not(.blocklyDropdownRect),
html.dft-bot-builder-active .bot-builder--active .zelos-renderer .blocklyNonEditableText > rect:not(.blocklyDropdownRect),
html.dft-bot-builder-active .bot-builder--active .zelos-renderer rect.blocklyFieldRect.blocklyDropdownRect {
    fill: #1a2030 !important;
}

html.dft-bot-builder-active .bot-builder--active .zelos-renderer .blocklyText:not(.blocklyTextRootBlockHeader) {
    fill: #dce4f8 !important;
}

html.dft-bot-builder-active .bot-builder--active .blocklyScrollbarHandle {
    fill: rgba(0, 229, 255, 0.35) !important;
}

html.dft-bot-builder-active .bot-builder--active .blocklyScrollbarBackground {
    fill: rgba(255, 255, 255, 0.04) !important;
}

/* ── Left toolbox (glass) ────────────────────────────────────── */

html.dft-bot-builder-active .bot-builder--active .db-toolbox {
    background: var(--dft-glass) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--dft-glass-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

html.dft-bot-builder-active .bot-builder--active .db-toolbox__title {
    color: var(--dft-text);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
}

html.dft-bot-builder-active .bot-builder--active .db-toolbox .dc-accordion__item-title {
    color: var(--dft-muted);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 1.2rem;
}

html.dft-bot-builder-active .bot-builder--active .db-toolbox .dc-accordion__item--active .dc-accordion__item-title {
    color: var(--dft-cyan);
}

html.dft-bot-builder-active .bot-builder--active .db-toolbox__search-field .dc-input__field,
html.dft-bot-builder-active .bot-builder--active .db-toolbox__search-field input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--dft-glass-border) !important;
    color: var(--dft-text) !important;
}

html.dft-bot-builder-active .bot-builder--active .db-toolbox__search-field .dc-input__leading-icon,
html.dft-bot-builder-active .bot-builder--active .db-toolbox__search-field svg {
    fill: var(--dft-muted) !important;
}

/* ── Flyout panel ────────────────────────────────────────────── */

html.dft-bot-builder-active .bot-builder--active .flyout {
    background: rgba(10, 14, 20, 0.96) !important;
    border: 1px solid var(--dft-glass-border);
    border-radius: 8px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.55),
        0 0 24px rgba(0, 229, 255, 0.06);
}

html.dft-bot-builder-active .bot-builder--active .flyout .blocklyMainBackground {
    fill: #0d1118 !important;
}

html.dft-bot-builder-active .bot-builder--active .flyout__content-disclaimer {
    background: rgba(255, 157, 58, 0.15) !important;
    border: 1px solid rgba(255, 157, 58, 0.35);
}

html.dft-bot-builder-active .bot-builder--active .flyout__content-disclaimer-text {
    color: #f5d9a8 !important;
}

/* ── Toolbar (save / load / undo) ────────────────────────────── */

html.dft-bot-builder-active .bot-builder--active .toolbar {
    background: rgba(10, 14, 20, 0.88) !important;
    border-bottom: 1px solid var(--dft-glass-border);
    backdrop-filter: blur(10px);
}

html.dft-bot-builder-active .bot-builder--active .toolbar__btn {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.18) 0%, rgba(0, 100, 130, 0.25) 100%) !important;
    border: 1px solid var(--dft-glass-border) !important;
    box-shadow: 0 2px 12px rgba(0, 229, 255, 0.12) !important;
}

html.dft-bot-builder-active .bot-builder--active .toolbar__btn:hover {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.28) 0%, rgba(0, 120, 150, 0.35) 100%) !important;
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.2) !important;
}

/* ── Run / Stop (header — bot builder tab only) ──────────────── */

html.dft-bot-builder-active #db-animation__run-button,
html.dft-bot-builder-active .animation__run-button#db-animation__run-button {
    background: linear-gradient(135deg, var(--dft-cyan) 0%, #0099b8 100%) !important;
    color: #050508 !important;
    font-family: 'Space Grotesk', system-ui, sans-serif !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow:
        0 0 20px rgba(0, 229, 255, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.3) !important;
    transition:
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

html.dft-bot-builder-active #db-animation__run-button:hover,
html.dft-bot-builder-active .animation__run-button#db-animation__run-button:hover {
    background: linear-gradient(135deg, #33ecff 0%, #00b8d9 100%) !important;
    box-shadow:
        0 0 28px rgba(0, 229, 255, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.35) !important;
    transform: translateY(-1px);
}

html.dft-bot-builder-active #db-animation__stop-button,
html.dft-bot-builder-active .animation__stop-button#db-animation__stop-button {
    background: linear-gradient(135deg, var(--dft-magenta) 0%, #cc2268 100%) !important;
    box-shadow: 0 0 20px rgba(255, 45, 135, 0.4) !important;
}

html.dft-bot-builder-active .run-panel__info--bubble {
    background: var(--dft-glass) !important;
    border: 1px solid var(--dft-glass-border) !important;
    color: var(--dft-text) !important;
    backdrop-filter: blur(10px);
}

/* ── Onboarding / joyride tooltip ────────────────────────────── */

html.dft-bot-builder-active .react-joyride__tooltip,
html.dft-bot-builder-active [class*='react-joyride__tooltip'] {
    background: rgba(10, 14, 20, 0.97) !important;
    border: 1px solid var(--dft-glass-border) !important;
    border-radius: 12px !important;
    color: var(--dft-text) !important;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.5),
        0 0 32px rgba(0, 229, 255, 0.08) !important;
}

html.dft-bot-builder-active .react-joyride__tooltip-title,
html.dft-bot-builder-active .onboard__label {
    color: var(--dft-cyan) !important;
    font-family: 'Space Grotesk', system-ui, sans-serif !important;
    font-weight: 600 !important;
}

html.dft-bot-builder-active .joyride-content {
    color: var(--dft-muted) !important;
}

html.dft-bot-builder-active .react-joyride__button--primary,
html.dft-bot-builder-active button[data-testid='next-bot-builder-tour'],
html.dft-bot-builder-active button[data-testid='finish-bot-builder-tour'] {
    background: linear-gradient(135deg, var(--dft-cyan) 0%, #0099b8 100%) !important;
    color: #050508 !important;
    border: none !important;
    font-family: 'Space Grotesk', system-ui, sans-serif !important;
    font-weight: 600 !important;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.35) !important;
}

html.dft-bot-builder-active .react-joyride__button--back,
html.dft-bot-builder-active button[data-testid='prev-bot-builder-tour'] {
    color: var(--dft-muted) !important;
}

html.dft-bot-builder-active .react-joyride__spotlight {
    border-radius: 8px;
}

/* ── Blockly dropdowns (market / trade type) ─────────────────── */

html.dft-bot-builder-active .blocklyDropDownDiv {
    background-color: #1a2030 !important;
    border-color: var(--dft-glass-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

html.dft-bot-builder-active .blocklyDropDownDiv .blocklyMenuItem {
    color: var(--dft-text) !important;
}

html.dft-bot-builder-active .blocklyDropDownDiv .blocklyMenuItem.blocklyMenuItemHighlight {
    background-color: rgba(0, 229, 255, 0.15) !important;
}
