/* ===========================================
   Unity UI Designer Pro - Modern Dark Theme
   =========================================== */

/* CSS Variables for easy theming */
:root {
    --bg-darkest: #0a0a0f;
    --bg-dark: #12121a;
    --bg-mid: #1a1a24;
    --bg-panel: #1e1e28;
    --bg-elevated: #252532;
    --bg-hover: #2a2a3a;
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a78bfa;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(99, 102, 241, 0.4);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body { 
    font-family: 'Inter', -apple-system, sans-serif; 
    background: linear-gradient(135deg, var(--bg-darkest) 0%, var(--bg-dark) 100%);
    color: var(--text-secondary);
}

/* Core Unity-style backgrounds */
.unity-border { border-color: var(--border-subtle); }
.unity-bg-dark { 
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darkest) 100%);
}
.unity-bg-mid { 
    background: linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-dark) 100%);
}
.unity-bg-panel { 
    background-color: var(--bg-panel);
}

/* Canvas Grid - softer dots */
.canvas-grid {
    background-image: radial-gradient(circle, rgba(99, 102, 241, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

.no-select { user-select: none; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { 
    background: linear-gradient(180deg, var(--accent-secondary), var(--accent-tertiary));
}

/* Form Controls */
input[type="range"] { 
    accent-color: var(--accent-primary);
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-darkest);
    border-radius: 4px;
    height: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
}

input[type="text"], input[type="number"], select {
    background: var(--bg-darkest) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-primary) !important;
    transition: all 0.2s ease;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

/* Checkbox styling */
input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

/* Gizmo Styles */
.gizmo-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: 2px solid var(--text-primary);
    pointer-events: auto;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 12px var(--accent-glow);
    border-radius: 2px;
}
.gizmo-handle:hover { 
    transform: scale(1.3); 
    background: var(--accent-tertiary);
    border-color: #fff;
}
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }

.selected-outline {
    outline: 2px solid var(--accent-primary) !important;
    outline-offset: -2px;
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Toggle Active State */
.toggle-active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: #fff !important;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Color Swatch */
.swatch-checkerboard {
    background-image: linear-gradient(45deg, #404050 25%, transparent 25%), 
                      linear-gradient(-45deg, #404050 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #404050 75%), 
                      linear-gradient(-45deg, transparent 75%, #404050 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
    background-color: #2a2a3a;
}

/* Toggle Switch Style */
.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-elevated);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--border-medium);
}
.slider-toggle:before {
    position: absolute;
    content: "";
    height: 12px; width: 12px;
    left: 1px; bottom: 1px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider-toggle { 
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: transparent;
}
input:checked + .slider-toggle:before { 
    transform: translateX(12px); 
    background-color: #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* Modal Backdrop */
.modal-backdrop {
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.95), rgba(18, 18, 26, 0.95));
    backdrop-filter: blur(8px);
}

/* Ensure preset modal behaves as a viewport-level window even if utility classes
   (like Tailwind's `fixed` or arbitrary `z-[100]`) are not available.
   This prevents the modal from being laid out inside the page flow. */
#preset-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem; /* matches p-6 used in markup */
    z-index: 1000;
}

/* Fallback for Tailwind arbitrary z-index class used in markup */
.z-\[100\] { z-index: 1000; }

/* Minimized modal: show header only, hide body content */
#preset-modal > div.modal-minimized {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
}
#preset-modal > div.modal-minimized > .flex-1 { display: none !important; }
#preset-modal > div.modal-minimized { overflow: visible; }

/* Runtime Mode */
.runtime-preview-active .selected-outline { outline: none !important; box-shadow: none !important; }
.runtime-preview-active #transform-overlay { display: none !important; }

/* Template Badge */
.template-badge {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 8px;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* ----------------------------- */
/* Buttons - Global Styling */
/* ----------------------------- */
button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0) scale(0.98);
}

/* Tab Buttons */
.tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.18s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(99,102,241,0.06), rgba(139,92,246,0.03));
    border-color: rgba(99,102,241,0.06);
    transform: translateY(-1px);
}

.tab-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
}

.tab-btn[data-view].border-blue-500 {
    border-color: var(--accent-primary) !important;
    color: var(--text-primary) !important;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.12), rgba(139,92,246,0.06));
    box-shadow: 0 6px 18px var(--accent-glow);
}

.tab-btn:not(.border-blue-500) {
    background: rgba(255,255,255,0.02);
}

.tab-btn:not(.border-blue-500):hover {
    color: var(--text-primary) !important;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.045), transparent);
}

/* Library header controls - prevent overlap and style inactive tabs */
.library-search {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
}
.library-search input#lib-search,
.library-search input[type="search"] {
    padding-right: 3.5rem; /* reserve space for the clear button */
    transition: padding-right 0.15s ease;
    background: linear-gradient(180deg, var(--bg-mid), var(--bg-dark)) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-secondary) !important;
    padding-left: 0.75rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
    /* Make the search input twice as wide and 30px taller */
    width: 32rem; /* twice Tailwind's w-64 (16rem) */
    padding-top: calc(0.375rem + 15px);
    padding-bottom: calc(0.375rem + 15px);
    font-size: 1rem; /* larger text (16px) */
    line-height: 1.25;
}
.library-search input::placeholder {
    color: var(--text-dim);
    opacity: 1;
}
.library-search button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem; /* ~14px */
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.6px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.04);
    z-index: 40;
    transition: all 0.12s ease;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.library-search button:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: rgba(99,102,241,0.06);
}

/* Library tabs styling */
.library-tabs { display: inline-flex; gap: 6px; align-items: center; padding: 4px; background: rgba(0,0,0,0.16); border-radius: 8px; border: 1px solid rgba(255,255,255,0.04); }
.library-tabs button {
    padding: 0.45rem 0.85rem;
    font-size: 0.95rem; /* ~15px */
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.12s ease;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}
.library-tabs button:hover {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(99,102,241,0.04), transparent);
    border-color: rgba(99,102,241,0.04);
}
.library-tabs button.bg-blue-600, .library-tabs button.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 8px 22px var(--accent-glow);
    border-color: transparent;
}

/* Delete Element Button */
#delete-element-btn {
    display: block;
    color: var(--danger);
    background: linear-gradient(180deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
    border: 1px solid rgba(239,68,68,0.12);
    box-shadow: none;
    text-align: center;
}

#delete-element-btn:hover {
    background: linear-gradient(180deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04));
    color: #ffb4b4; /* lighter red tone - not white */
}

#delete-element-btn:active {
    transform: scale(0.98);
}

/* Add Container button (header small icon) */
#add-container-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0.25rem;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.16s ease;
}

#add-container-btn svg { stroke: currentColor; }

#add-container-btn:hover {
    background: linear-gradient(90deg, rgba(99,102,241,0.06), rgba(139,92,246,0.03));
    color: var(--text-primary);
    border-color: rgba(99,102,241,0.06);
    transform: translateY(-1px);
}

#add-container-btn:active { transform: translateY(0) scale(0.98); }

/* Zoom buttons in floating toolbar */
#zoom-out-btn, #zoom-in-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0.25rem;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.14s ease;
}

#zoom-out-btn svg, #zoom-in-btn svg, #zoom-out-btn i, #zoom-in-btn i { stroke: currentColor; color: inherit; }

#zoom-out-btn:hover, #zoom-in-btn:hover {
    background: linear-gradient(90deg, rgba(99,102,241,0.05), rgba(139,92,246,0.02));
    color: var(--text-primary);
    border-color: rgba(99,102,241,0.06);
    transform: translateY(-1px);
}

#zoom-out-btn:active, #zoom-in-btn:active { transform: translateY(0) scale(0.98); }

/* Runtime Toggle (floating toolbar) */
#runtime-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 9999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.12));
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.06);
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 8px 22px rgba(12,12,16,0.7), inset 0 -2px 0 rgba(255,255,255,0.02);
}

#runtime-toggle i { color: var(--success); }

#runtime-toggle:hover {
    color: #fff;
    border-color: rgba(99,102,241,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    transform: translateY(-1px);
}

#runtime-toggle:active { transform: translateY(0) scale(0.98); }

.runtime-btn--active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 8px 30px var(--accent-glow);
    border-color: transparent;
}

/* ----------------------------- */
/* Panel Headers & Sections */
/* ----------------------------- */
.border-b.unity-border {
    border-image: linear-gradient(90deg, transparent, var(--border-medium), transparent) 1;
}

/* ----------------------------- */
/* Tailwind-like utility fallbacks */
/* ----------------------------- */

/* Layout & Display */
.h-screen { height: 100vh; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.-translate-x-1\/2 { transform: translateX(-50%); }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.bottom-6 { bottom: 1.5rem; }
.left-1\/2 { left: 50%; }
.hidden { display: none !important; }
.pointer-events-none { pointer-events: none; }
.cursor-crosshair { cursor: crosshair; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }

/* Flex / Alignment */
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.shrink-0 { flex-shrink: 0; }

/* Sizing helpers */
.w-72 { width: 18rem; }
.w-80 { width: 20rem; }
.w-8 { width: 2rem; }
.w-5 { width: 1.25rem; }
.w-10 { width: 2.5rem; }
.w-24 { width: 6rem; }
.h-12 { height: 3rem; }
.h-8 { height: 2rem; }
.h-1 { height: 0.25rem; }
.h-40 { height: 10rem; }
.w-\[800px\] { width: 800px; }
.h-\[600px\] { height: 600px; }
.h-\[700px\] { height: 700px; }
.w-\[1px\] { width: 1px; }
.h-4 { height: 1rem; }
/* Center the canvas container within the viewport. JS will apply pan/zoom offsets
   relative to this centered origin. */
#canvas-container {
    left: 50%;
    top: 50%;
    transform-origin: center;
}
.max-w-md { max-width: 28rem; }
.max-w-5xl { max-width: 64rem; }

/* Spacing */
.p-1 { padding: 0.25rem; }
.p-4 { padding: 1rem; }
.p-3 { padding: 0.75rem; }
.p-2 { padding: 0.5rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-12 { padding: 3rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pl-2 { padding-left: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-auto { margin-top: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.ml-1 { margin-left: 0.25rem; }

/* Gap */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }

/* Text */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-[9px], .text-\[9px\] { font-size: 9px; }
.text-[10px], .text-\[10px\] { font-size: 10px; }
.text-[12px], .text-\[12px\] { font-size: 12px; }
.text-white { color: var(--text-primary); }
.text-gray-300 { color: var(--text-secondary); }
.text-gray-400 { color: var(--text-muted); }
.text-gray-500 { color: var(--text-muted); }
.text-gray-600 { color: var(--text-dim); }
.text-blue-500 { color: var(--accent-primary); }
.text-blue-400 { color: var(--accent-tertiary); }
.text-green-500 { color: var(--success); }
.font-black { font-weight: 900; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; }
.uppercase { text-transform: uppercase; }
.italic { font-style: italic; }
.leading-none { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.leading-tight { line-height: 1.25; }
.tracking-tight { letter-spacing: -0.01em; }
.tracking-wider { letter-spacing: 0.08em; }
.tracking-widest { letter-spacing: 0.12em; }
.tracking-tighter { letter-spacing: -0.02em; }
.opacity-80 { opacity: 0.8; }

/* Backgrounds & colors */
.bg-black\/20 { background-color: rgba(0, 0, 0, 0.2); }
.bg-black\/40 { background-color: rgba(0, 0, 0, 0.4); }
.bg-white\/5 { background-color: rgba(255, 255, 255, 0.03); }
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.06); }
.bg-blue-600 { 
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}
.bg-blue-500 { background-color: var(--accent-primary); }
.bg-blue-600\/20 { background-color: rgba(99, 102, 241, 0.15); }
.bg-\[\#333\], .bg-\[\#333333\] { background-color: var(--bg-elevated); }
.bg-\[\#2d2d2d\] { background-color: var(--bg-mid); }
.bg-\[\#2d2d2d\]\/90 { background-color: rgba(26, 26, 36, 0.95); }
.bg-\[\#1a1a1a\] { background-color: var(--bg-dark); }
.bg-\[\#111\], .bg-\[\#111111\] { background-color: var(--bg-darkest); }
.bg-\[\#444\] { background-color: var(--bg-hover); }
.bg-\[\#555\] { background-color: #3a3a4a; }
.bg-gray-600 { background-color: var(--text-dim); }
.bg-gray-700 { background-color: var(--bg-elevated); }

/* Fill colors */
.fill-green-500 { fill: var(--success); }

/* Borders */
.border { border-width: 1px; border-style: solid; border-color: var(--border-subtle); }
.border-2 { border-width: 2px; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-r { border-right-width: 1px; border-right-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b-2 { border-bottom-width: 2px; }
.border-transparent { border-color: transparent; }
.border-blue-500 { border-color: var(--accent-primary); }
.border-blue-500\/50 { border-color: rgba(99, 102, 241, 0.5); }
.border-\[\#444\], .border-\[\#444444\] { border-color: var(--border-medium); }
.border-white\/10 { border-color: var(--border-medium); }
.border-gray-800 { border-color: var(--border-subtle); }

/* Rounded / Shadow */
.rounded { border-radius: 0.375rem; }
.rounded-md { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3); }
.shadow-lg { 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 
                0 4px 6px -4px rgba(0, 0, 0, 0.3),
                0 0 20px var(--accent-glow);
}
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
.shadow-lg.shadow-blue-900\/20 { 
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 
                0 4px 6px -4px rgba(99, 102, 241, 0.2);
}

/* Utilities */
.transition-all { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.duration-75 { transition-duration: 75ms; }
.origin-center { transform-origin: center; }
.backdrop-blur { backdrop-filter: blur(8px); }
.active\:scale-95:active { transform: scale(0.95); }

/* Hover helpers */
.hover\:text-white:hover { color: var(--text-primary); }
.hover\:text-gray-300:hover { color: var(--text-secondary); }
.hover\:bg-blue-600\/20:hover { background-color: rgba(99, 102, 241, 0.15); }
.hover\:border-blue-500\/50:hover { border-color: rgba(99, 102, 241, 0.5); }
.hover\:border-blue-500:hover { border-color: var(--accent-primary); }
.hover\:bg-blue-600:hover { background-color: var(--accent-primary); }
.hover\:bg-blue-500:hover { 
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-tertiary));
}
.hover\:bg-\[\#555\]:hover { background-color: #3a3a4a; }
.hover\:bg-gray-600:hover { background-color: var(--bg-hover); }

/* Group hover */
.group { }
.group:hover .group-hover\:text-blue-400 { color: var(--accent-tertiary); }

/* Text utilities */
.text-center { text-align: center; }
.block { display: block; }

/* Code output */
pre { white-space: pre-wrap; word-wrap: break-word; }
#code-output { 
    color: var(--accent-tertiary);
    display: block;
    overflow-x: auto; /* horizontal scrollbar when long lines */
    overflow-y: auto; /* vertical scrollbar when content is tall */
    max-height: calc(100vh - 220px); /* keep code area from growing past viewport */
    width: 100%;
    max-width: 1200px; /* limit code block width for readability */
    margin: 0 auto; /* center within parent */
    padding: 0.75rem;
    white-space: pre; /* preserve formatting for code */
    overflow-wrap: normal; /* prevent breaking long words */
    word-break: normal;
    box-sizing: border-box;
    /* allow the code block to be wider than its container so horizontal scroll appears */
    min-width: -webkit-min-content;
    min-width: -moz-min-content;
    min-width: min-content;
    background: transparent;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 13px;
}

/* ----------------------------- */
/* Component Enhancements */
/* ----------------------------- */

/* Sidebar panels */
aside {
    background: linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-dark) 100%) !important;
}

/* Logo area enhancement */
aside .bg-blue-600 {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Element buttons in sidebar */
aside button.bg-\[\#333\] {
    background: var(--bg-panel) !important;
    border-color: var(--border-medium) !important;
}

aside button.bg-\[\#333\]:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1)) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Canvas root element */
#root-element {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darkest) 100%) !important;
    border-color: var(--border-medium) !important;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(99, 102, 241, 0.03);
}

/* Floating toolbar */
.absolute.bottom-6 {
    background: linear-gradient(135deg, rgba(26, 26, 36, 0.95), rgba(18, 18, 26, 0.95)) !important;
    border-color: var(--border-medium) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-glow);
}

/* Runtime toggle button — match export/download style by default */
#runtime-toggle {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 15px var(--accent-glow);
    padding: 0.4rem 0.75rem !important;
    font-weight: 700;
    border-radius: 9999px;
}

#runtime-toggle:hover {
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-1px);
}

/* Modal styling */
#preset-modal > div {
    background: linear-gradient(135deg, var(--bg-mid), var(--bg-dark)) !important;
    border-color: var(--border-medium) !important;
}

/* Library cards hover effect */
#library-list-container > div {
    transition: all 0.3s ease;
    min-height: 10rem; /* ensure library cards are tall enough to show two lines */
}

#library-list-container > div:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px var(--accent-glow);
}

/* Export view buttons */
#export-download-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)) !important;
    box-shadow: 0 4px 15px var(--accent-glow);
}

#export-download-btn:hover {
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* Responsive grid */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Smooth animations */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
    50% { box-shadow: 0 0 25px var(--accent-glow), 0 0 40px rgba(99, 102, 241, 0.2); }
}

.selected-outline {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Icon styling */
[data-lucide] {
    stroke: currentColor;
}

/* Hierarchy tree items */
#hierarchy-tree > div {
    border-radius: 4px;
    transition: all 0.15s ease;
}

#hierarchy-tree > div:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Inspector panel */
#inspector-content {
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
}

/* Space for additional elements */
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

