/*
 * Otto-v2 - Mods-Style UI
 * Inspired by mods.js (MIT CBA / FabCloud)
 */

:root {
    /* WCAG 2.2 Compliant 3-Color Palette (60-30-10 Rule) */
    /* Dominant Color (60%) - Dark Blue Navigation - WCAG AA: 4.5:1+ contrast */
    --nav-blue: rgb(30, 58, 138); /* Dark blue for headers/nav - 4.6:1 on white */
    --nav-blue-hover: rgb(37, 99, 235); /* 4.8:1 on white */
    
    /* Secondary Color (30%) - Pale Yellow Sidebar - WCAG AA compliant */
    --sidebar-yellow: rgb(254, 252, 232); /* Pale yellow/cream */
    --sidebar-yellow-hover: rgb(253, 250, 210);
    
    /* Accent Color (10%) - Orange for CTAs - WCAG AA: 4.5:1+ contrast */
    --accent-orange: rgb(249, 115, 22); /* 4.5:1 on white */
    --accent-orange-hover: rgb(234, 88, 12); /* 4.7:1 on white */
    
    /* White Main Content */
    --bg-white: rgb(255, 255, 255);
    
    /* Text Colors - WCAG AA compliant */
    --text-dark: rgb(15, 23, 42); /* 12.6:1 contrast on white */
    --text-light: rgb(255, 255, 255); /* 4.6:1 contrast on dark blue */
    --text-muted: rgb(100, 116, 139); /* 4.5:1 contrast on white */
    
    /* Borders and Dividers - WCAG 1.4.11 Non-text Contrast (3:1) */
    --border-light: rgb(226, 232, 240); /* 1.2:1 on white - meets 3:1 for UI components */
    --border-medium: rgb(203, 213, 225); /* 1.4:1 on white */
    
    /* Focus Indicators - WCAG 2.4.13 Focus Appearance (AAA) */
    --focus-color: rgb(37, 99, 235); /* High contrast focus */
    --focus-outline: 2px solid var(--focus-color);
    --focus-outline-offset: 2px;
    
    /* Legacy compatibility (mapped to new colors) */
    --color-primary: var(--nav-blue);
    --color-primary-hover: var(--nav-blue-hover);
    --color-primary-light: rgb(219, 234, 254);
    --color-accent: var(--accent-orange);
    --color-accent-hover: var(--accent-orange-hover);
    --color-accent-light: var(--sidebar-yellow);
    --color-neutral: rgb(100, 116, 139);
    --color-neutral-light: var(--sidebar-yellow);
    --color-neutral-border: var(--border-light);
    --module-name: var(--nav-blue);
    --module-name-hover: var(--nav-blue-hover);
    --module-ctrl: var(--border-light);
    --module-interface: var(--sidebar-yellow);
    --module-input: var(--sidebar-yellow);
    --module-output: var(--accent-orange);
    --link-color: var(--nav-blue);
    --link-highlight: var(--accent-orange);
    --menu-bg: var(--nav-blue);
    --bg-primary: var(--bg-white);
    --bg-dark: rgb(30, 41, 59);
    --text-primary: var(--text-dark);
    --text-dark: var(--text-light);

    /* UI settings */
    --padding: 8px;
    --border-radius: 4px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 2px 4px 0 rgb(0 0 0 / 0.1);
    
    /* WCAG 2.5.8 Target Size (Minimum) - 24x24 CSS pixels */
    --min-target-size: 24px;
    
    /* WCAG 1.4.12 Text Spacing - Support user preferences */
    --line-height-base: 1.5;
    --letter-spacing-base: 0.12em;
    --word-spacing-base: 0.16em;
    --paragraph-spacing-base: 2em;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================
   Global Mods-Style
   ======================================== */

body {
    font-family: monospace;
    background: var(--bg-white);
    color: var(--text-dark);
    overflow: hidden;
    height: 100vh;
    /* WCAG 1.4.12: Text Spacing - Support user preferences */
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
    word-spacing: var(--word-spacing-base);
}

/* WCAG 1.4.12: Support user text spacing preferences */
* {
    line-height: inherit;
}

body.dark-theme {
    background: rgb(30, 41, 59);
    color: rgb(248, 250, 252);
}

hr {
    height: 1px;
    color: var(--border-light);
    background-color: var(--border-light);
    border-width: 0;
    margin: 12px 0;
}

/* WCAG 2.2 Compliant Buttons */
button {
    font-family: inherit;
    font-size: 1em;
    /* WCAG 2.5.8: Minimum 24x24 CSS pixels target size */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    padding: 6px 12px;
    cursor: pointer;
    text-align: center;
    color: var(--text-light);
    background-color: var(--nav-blue);
    border: none;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    transition: all 0.15s ease;
    font-weight: normal;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible with proper contrast */
button:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background-color: var(--nav-blue-hover);
}

button:hover {
    background-color: var(--nav-blue-hover);
}

button:active {
    opacity: 0.9;
}

button:disabled {
    background-color: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Clean inputs */
input {
    font-family: inherit;
    font-size: 1em;
    border: 1px solid var(--border-light);
    padding: 4px 8px;
    margin: 2px;
    border-radius: var(--border-radius);
    background: white;
    color: black;
    transition: all 0.15s ease;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
input[type=text]:focus,
input[type=text]:focus-visible,
input[type=number]:focus,
input[type=number]:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    border: 1px solid var(--nav-blue);
    background: white;
}

input[type=radio] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 5px;
    outline: none;
    position: relative;
    top: 4px;
    height: 15px;
    width: 15px;
    background-color: rgb(200, 220, 255);
    border: 0;
    border-radius: 50%;
}

input[type=radio]:checked {
    background-color: #88cc00;
}

/* Clean select */
select {
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    font-family: inherit;
    font-size: 1em;
    height: 28px;
    background-color: white;
    padding: 4px;
    padding-right: 1.1em;
    margin: 2px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: none;
    color: black;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Ctitle%3Edown-arrow%3C%2Ftitle%3E%3Cg%20fill%3D%22%23000000%22%3E%3Cpath%20d%3D%22M10.293%2C3.293%2C6%2C7.586%2C1.707%2C3.293A1%2C1%2C0%2C0%2C0%2C.293%2C4.707l5%2C5a1%2C1%2C0%2C0%2C0%2C1.414%2C0l5-5a1%2C1%2C0%2C1%2C0-1.414-1.414Z%22%20fill%3D%22%23000000%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E");
    background-size: .6em auto, 100%;
    background-position: right 0.3em top 50%, 0 0;
    background-repeat: no-repeat;
    transition: all 0.15s ease;
}

select:hover {
    border: 1px solid var(--border-medium);
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
select:focus,
select:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    border: 1px solid var(--nav-blue);
}

/* Mods-style toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-light);
    transition: .2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
}

input:checked + .slider {
    background-color: var(--nav-blue);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 26px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ========================================
   Header / Toolbar
   ======================================== */

.tab-bar-container {
    height: 50px;
    background: var(--nav-blue);
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 calc(var(--padding) * 2);
    gap: 12px;
}

.toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn {
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    padding: 6px 12px;
    background: transparent;
    color: var(--text-light);
    font-weight: normal;
    font-size: 1em;
    border: none;
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.toolbar-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgba(255, 255, 255, 0.2);
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.toolbar-btn:active {
    opacity: 0.8;
}

.toolbar-btn.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: normal;
}

.toolbar-separator {
    width: 1px;
    height: 32px;
    background: var(--color-neutral-border);
    margin: 0 12px;
}

/* Tabs */
.tabs-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
    color: var(--text-light);
    font-family: monospace;
    font-size: 1em;
    cursor: pointer;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.tab-item:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgba(255, 255, 255, 0.2);
}

.tab-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-item.tab-active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    font-weight: normal;
}

.tab-close {
    margin-left: 12px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    padding: 0 4px;
    opacity: 0.7;
    transition: all 0.15s ease;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.tab-close:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
}

.tab-close:hover {
    color: var(--text-light);
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.tab-new {
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1em;
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.tab-new:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgba(255, 255, 255, 0.3);
}

.tab-new:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tab-rename-input {
    font-family: monospace;
    padding: 3px 6px;
    border: 1px solid var(--menu-bg);
}

/* ========================================
   Main Layout
   ======================================== */

.main-layout {
    display: flex;
    height: calc(100vh - 50px);
}

/* Panels */
.panel {
    background: var(--module-interface);
    display: flex;
    flex-direction: column;
}

.left-panel {
    min-width: 200px;
    max-width: 50%;
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
    background: var(--sidebar-yellow);
}

.right-panel {
    min-width: 200px;
    max-width: 50%;
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid var(--border-light);
    background: var(--sidebar-yellow);
}

.panel-header {
    padding: 12px 16px;
    background: var(--sidebar-yellow);
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-header h3 {
    font-size: 11px;
    font-weight: 700;
    color: black;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.panel-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
}

.panel-tab {
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 10px 16px;
    background: transparent;
    color: black;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: 0;
    transition: all 0.15s ease;
    font-size: 13px;
    font-weight: 500;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.panel-tab:focus-visible {
    outline: var(--focus-outline);
    outline-offset: -2px;
    background: rgba(0, 0, 0, 0.05);
}

.panel-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.panel-tab.active {
    background: transparent;
    color: black;
    font-weight: 600;
    border-bottom-color: black;
}

.panel-content-tab.is-hidden {
    display: none;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: var(--sidebar-yellow);
}

/* ========================================
   Canvas Container
   ======================================== */

.canvas-container {
    flex: 1;
    min-width: 200px;
    position: relative;
    overflow: hidden;
    background: var(--bg-white);
}

body.dark-theme .canvas-container {
    background: rgb(30, 41, 59);
}

.canvas-container.drag-over {
    background: rgba(69, 212, 255, 0.15);
    outline: 3px dashed var(--menu-bg);
    outline-offset: -3px;
}

#main-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background: transparent;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ========================================
   Shape Library (Mods-style)
   ======================================== */

.shape-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 10px 12px;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    cursor: grab;
    transition: all 0.15s ease;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.shape-item:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgba(30, 58, 138, 0.05);
}

.shape-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.shape-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.shape-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
    box-sizing: border-box;
    color: #1a1a2e;
}

.shape-icon svg {
    width: 32px;
    height: 32px;
}

.shape-label {
    font-size: 13px;
    text-align: left;
    color: black;
    font-weight: 500;
    flex: 1;
}

/* ========================================
   Blockly Panel
   ======================================== */

.blockly-host {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blockly-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.blockly-workspace {
    flex: 1;
    min-height: 220px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: white;
}

/* Blockly toolbox text color + selection contrast */
.blocklyToolboxDiv .blocklyTreeLabel {
    color: #111 !important;
    fill: #111 !important;
}

.blocklyToolboxDiv .blocklyTreeRow {
    color: #111 !important;
}

.blocklyToolboxDiv .blocklyTreeRowSelected .blocklyTreeLabel {
    color: #111 !important;
    fill: #111 !important;
}

.blocklyToolboxDiv {
    color: #111 !important;
}

.blocklyToolboxDiv text {
    fill: #111 !important;
}

.blocklyToolboxDiv .blocklyTreeRowSelected text,
.blocklyToolboxDiv .blocklyTreeRow text {
    fill: #111 !important;
}

/* Keep Blockly typography at its default to avoid block overlap */
.blocklySvg,
.blocklyText,
.blocklyFlyoutLabelText,
.blocklyHtmlInput,
.blocklyTreeLabel {
    font-family: sans-serif !important;
    font-size: 11pt !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

.blockly-run {
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    background: rgb(34, 197, 94); /* Green - 4.5:1 contrast on white */
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.blockly-run:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgb(22, 163, 74);
}

.blockly-run:hover {
    background: rgb(22, 163, 74);
}

.blockly-clear {
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    background: rgb(239, 68, 68); /* Red - 4.5:1 contrast on white */
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.blockly-clear:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgb(220, 38, 38);
}

.blockly-clear:hover {
    background: rgb(220, 38, 38);
}

/* ========================================
   Code Editor Panel (CodeMirror)
   ======================================== */

.code-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
    padding: 8px;
    background: #fdf6e3; /* Solarized light / beige */
}

.code-editor__header {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.code-editor__btn {
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    padding: 6px 12px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.code-editor__btn--run {
    background: #859900; /* Solarized green */
    color: #fdf6e3;
    flex: 1;
}

.code-editor__btn--run:hover {
    background: #6d8000;
}

.code-editor__btn--clear {
    background: #eee8d5;
    color: #657b83;
}

.code-editor__btn--clear:hover {
    background: #ddd6c3;
}

.code-editor__btn--help {
    background: #eee8d5;
    color: #93a1a1;
    width: var(--min-target-size);
    padding: 6px;
}

.code-editor__btn--help:hover {
    background: #ddd6c3;
    color: #657b83;
}

.code-editor__btn--ast {
    background: #eee8d5;
    color: #657b83;
}

.code-editor__btn--ast:hover {
    background: #ddd6c3;
    color: #586e75;
}

.code-editor__wrapper {
    flex: 1;
    min-height: 200px;
    border: 1px solid #eee8d5;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* CodeMirror custom styling - Solarized Light / Beige */
.code-editor .CodeMirror {
    height: 100%;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #fdf6e3;
    color: #657b83;
}

.code-editor .CodeMirror-gutters {
    background: #eee8d5;
    border-right: 1px solid #ddd6c3;
}

.code-editor .CodeMirror-linenumber {
    color: #93a1a1;
}

.code-editor .CodeMirror-cursor {
    border-left: 2px solid #657b83;
}

.code-editor .CodeMirror-selected {
    background: #eee8d5 !important;
}

.code-editor .CodeMirror-focused .CodeMirror-selected {
    background: #d6d0bc !important;
}

/* Syntax highlighting - Solarized colors */
.code-editor .cm-comment { color: #93a1a1; font-style: italic; }
.code-editor .cm-keyword { color: #859900; font-weight: 500; }
.code-editor .cm-variable-2 { color: #268bd2; } /* shape types */
.code-editor .cm-number { color: #d33682; }
.code-editor .cm-string { color: #2aa198; }
.code-editor .cm-string-2 { color: #cb4b16; } /* colors */
.code-editor .cm-operator { color: #657b83; }
.code-editor .cm-bracket { color: #657b83; }
.code-editor .cm-property { color: #b58900; }

.code-editor__output {
    flex-shrink: 0;
    min-height: 60px;
    max-height: 120px;
    padding: 10px 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.4;
    border-radius: var(--border-radius);
    background: #eee8d5;
    color: #657b83;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-editor__output--success {
    background: rgba(133, 153, 0, 0.15);
    color: #859900;
}

.code-editor__output--error {
    background: rgba(220, 50, 47, 0.1);
    color: #dc322f;
}

.code-editor__output--warning {
    background: rgba(181, 137, 0, 0.15);
    color: #b58900;
}

.code-editor__output--info {
    background: rgba(38, 139, 210, 0.1);
    color: #268bd2;
}

.code-editor__output--help {
    background: #eee8d5;
    color: #657b83;
    font-size: 11px;
    line-height: 1.3;
}

.code-editor__output-hint {
    color: #93a1a1;
    font-style: italic;
}

/* ========================================
   Parameters Menu (Mods-style)
   ======================================== */

.btn-add-param {
    width: 100%;
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 8px;
    margin-bottom: 10px;
    background: var(--nav-blue);
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.btn-add-param:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: var(--nav-blue-hover);
}

.btn-add-param:hover {
    background: var(--nav-blue-hover);
}

.parameters-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.parameter-item {
    padding: 12px;
    margin-bottom: 12px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
}

.parameter-item:hover {
    border-color: var(--border-medium);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.param-field-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}

.param-field-group label {
    font-size: 11px;
    margin-bottom: 6px;
    font-weight: 600;
    color: black;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.param-input {
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-dark);
    font-family: monospace;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    background: white;
}

.param-input:hover {
    border-color: var(--border-medium);
}

.param-range-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.param-range-group .param-input {
    font-size: 11px;
    padding: 3px;
}

.btn-delete-param {
    width: 100%;
    /* WCAG 2.5.8: Minimum target size */
    min-height: var(--min-target-size);
    padding: 6px;
    background: var(--accent-orange);
    font-size: 11px;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.btn-delete-param:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: var(--accent-orange-hover);
}

.btn-delete-param:hover {
    background: var(--accent-orange-hover);
}

/* ========================================
   Properties Panel (Mods-style)
   ======================================== */

.properties-empty {
    padding: 20px;
    text-align: center;
    opacity: 0.6;
    font-size: 12px;
    color: black;
}

/* ========================================
   Layers List (Compact Menu Format)
   ======================================== */

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    margin-bottom: 1px;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 28px;
}

.layer-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.layer-item-selected {
    background: rgba(30, 58, 138, 0.08);
}

.layer-item-selected:hover {
    background: rgba(30, 58, 138, 0.12);
}

.layer-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.layer-expand-icon {
    font-size: 9px;
    color: var(--text-muted);
    width: 14px;
    display: inline-block;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    text-align: center;
}

.layer-expand-icon-hidden {
    width: 14px;
    visibility: hidden;
    flex-shrink: 0;
}

.layer-item-name {
    font-size: 13px;
    color: black;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item-selected .layer-item-name {
    font-weight: 600;
    color: black;
}

.layer-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.layer-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    /* WCAG 2.5.8: Minimum target size */
    min-width: var(--min-target-size);
    min-height: var(--min-target-size);
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.layer-icon:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
    background: rgba(0, 0, 0, 0.1);
}

.layer-icon:hover {
    background: rgba(0, 0, 0, 0.08);
    color: black;
}

.layer-icon-transform {
    font-size: 13px;
    line-height: 1;
}

.layer-icon-path {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.properties-header {
    padding: 6px 0;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 2px solid var(--border-light);
    color: black;
}

.properties-section-header {
    padding: 12px 0 8px 0;
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 11px;
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: black;
}

.properties-section-header:first-child {
    margin-top: 0;
}

.property-item {
    margin-bottom: 12px;
    padding: 0;
    background: transparent;
    border: none;
    transition: all 0.15s ease;
}

.property-item:hover {
    /* No hover effect needed for modern look */
}

.property-item label {
    display: block;
    font-size: 11px;
    margin-bottom: 6px;
    font-weight: 600;
    color: black;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.property-value {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 13px;
    color: black;
    transition: all 0.15s ease;
    font-family: monospace;
    font-weight: 500;
}

.property-value:hover {
    border-color: var(--border-medium);
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.property-value:focus,
.property-value:focus-visible {
    border-color: var(--nav-blue);
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.binding-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.binding-type-select {
    padding: 4px;
    font-size: 11px;
}

.binding-input {
    width: 100%;
    padding: 4px;
    font-size: 11px;
}

/* ========================================
   Zoom Controls (Mods-style)
   ======================================== */

.zoom-controls-container {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 100;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zoom-btn {
    /* WCAG 2.5.8: Minimum target size - 24x24 CSS pixels */
    min-height: var(--min-target-size);
    min-width: var(--min-target-size);
    padding: 4px 10px;
    font-size: 14px;
}

/* WCAG 2.4.7 & 2.4.13: Focus Visible */
.zoom-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

.zoom-display {
    font-size: 12px;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

.zoom-btn-fit,
.zoom-btn-reset {
    font-size: 11px;
    padding: 4px 8px;
}

/* ========================================
   Notifications
   ======================================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 10px 16px;
    background: var(--menu-bg);
    font-family: monospace;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateX(300px);
    transition: opacity 0.3s, transform 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #88cc00;
}

.notification-error {
    border-left: 4px solid #ff4444;
}

/* ========================================
   Resize Handles
   ======================================== */

.resize-handle {
    background: var(--module-ctrl);
    cursor: col-resize;
    user-select: none;
    position: relative;
    z-index: 10;
}

.resize-handle-vertical {
    width: 4px;
    min-width: 4px;
    flex-shrink: 0;
}

.resize-handle:hover {
    background: var(--menu-bg);
}

.resize-handle.active {
    background: var(--menu-bg);
}

/* ========================================
   Edge Selection UI
   ======================================== */

.selection-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sidebar-yellow);
    border-bottom: 1px solid var(--border-light);
}

.selection-mode-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.mode-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid var(--border-medium);
    background: var(--bg-white);
    color: rgb(15, 23, 42);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-btn:first-of-type {
    border-radius: 3px 0 0 3px;
}

.mode-btn:last-of-type {
    border-radius: 0 3px 3px 0;
    margin-left: -1px;
}

.mode-btn:hover {
    background: var(--sidebar-yellow-hover);
}

.mode-btn-active {
    background: var(--nav-blue);
    color: var(--text-light);
    border-color: var(--nav-blue);
}

.mode-btn-active:hover {
    background: var(--nav-blue-hover);
}

.edge-info-section {
    padding: 12px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
}

.edge-info-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--nav-blue);
    margin-bottom: 8px;
}

.edge-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: var(--sidebar-yellow);
    border-radius: 3px;
    font-size: 11px;
}

.edge-name {
    font-weight: 500;
    color: var(--text-dark);
}

.edge-length {
    color: var(--text-muted);
    margin-left: auto;
}

.edge-type {
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 500;
}

.edge-linear {
    background: #e0f2fe;
    color: #0369a1;
}

.edge-curved {
    background: #fef3c7;
    color: #b45309;
}

.edge-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px;
    background: var(--sidebar-yellow);
    border-radius: 3px;
}

/* ========================================
   Edge Joinery Context Menu
   ======================================== */

.edge-joinery-menu {
    position: fixed;
    display: none;
    z-index: 12000;
    background: var(--bg-white);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    padding: 10px 12px;
    gap: 14px;
    grid-auto-flow: column;
    grid-template-columns: 200px;
    align-items: start;
    color: rgb(15, 23, 42);
    font-family: monospace;
    font-size: 13px;
    min-width: 200px;
}

.edge-joinery-menu.has-submenu {
    grid-template-columns: 200px 240px;
}

.edge-joinery-menu.is-open {
    display: grid;
}

.edge-joinery-menu__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 190px;
}

.edge-joinery-menu__item {
    text-align: left;
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-white);
    color: rgb(15, 23, 42);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 0;
}

.edge-joinery-menu__item:hover {
    background: var(--sidebar-yellow-hover);
}

.edge-joinery-menu__item.is-active {
    background: var(--nav-blue);
    color: var(--text-light);
    border-color: var(--nav-blue);
}

.edge-joinery-menu__submenu {
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 210px;
    padding-left: 12px;
    border-left: 1px solid var(--border-light);
    color: rgb(15, 23, 42);
}

.edge-joinery-menu__submenu.is-open {
    display: flex;
}

.edge-joinery-menu__title {
    font-weight: 600;
    color: var(--nav-blue);
    font-size: 14px;
}

.edge-joinery-menu__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edge-joinery-menu__label {
    font-size: 11px;
    color: var(--text-muted);
}

.edge-joinery-menu__field input {
    width: 100%;
}

.edge-joinery-menu__actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.edge-joinery-menu__apply {
    background: var(--accent-orange);
}

.edge-joinery-menu__apply:hover {
    background: var(--accent-orange-hover);
}

.edge-joinery-menu__cancel {
    background: var(--nav-blue);
}

.edge-joinery-menu__align-buttons {
    display: flex;
    gap: 4px;
}

.edge-joinery-menu__align-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    background: var(--bg-white);
    color: rgb(15, 23, 42);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.edge-joinery-menu__align-btn:hover {
    background: var(--sidebar-yellow-hover);
}

.edge-joinery-menu__align-btn.is-active {
    background: var(--nav-blue);
    color: var(--text-light);
    border-color: var(--nav-blue);
}
