/* ====================================
 * TABLE OF CONTENTS
 * ====================================
 * 1. RESET & BASE STYLES
 * 2. APP CONTAINER
 * 3. SIDEBAR
 * 4. CONTEXT BAR
 * 5. CANVAS
 * 6. TOGGLE BUTTON
 * 7. NODES (GENERIC & SPECIFIC)df
 * 8. MODALS
 * 9. COMMAND BAR
 * 10. RECIPE PANEL
 * 11. ANIMATIONS
 * ==================================== */

/* ====================================
 * 1. RESET & BASE STYLES
 * ==================================== */
 * { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    letter-spacing: -0.4px;
}

/* --- Root Variables for Enhanced Theming --- */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', sans-serif;
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --hover-bg: rgba(0, 0, 0, 0.035);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
}

/* --- Dark Mode Variables --- */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50:  #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
    }
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    background: #f9fafb;
    color: #1f2937;
    height: 100vh;
    overflow-y: hidden;
}

:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0ms !important;
        animation-duration: 0ms !important;
    }
}

.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ====================================
 * 2. APP CONTAINER
 * ==================================== */
.app-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

/* ====================================
 * 3. SIDEBAR
 * ==================================== */
.sidebar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    height: 100vh;
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    contain: layout style;
    will-change: width;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    height: 56px;
}

.sidebar-toggle {
    padding: 8px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: background-color 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: #f3f4f6;
}

#sidebar-toggle-icon {
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100
}

.sidebar.collapsed #sidebar-toggle-icon {
    transform: scaleX(-1);
}

.logo {
    background: #000;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.sidebar-content {
    padding: 8px;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* --- Enhanced Tabs --- */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    position: relative;
}

.sidebar-tab.active {
    color: #1f2937;
    font-weight: 500;
}

.sidebar-tab:hover {
    color: #1f2937;
}

#tab-underline {
    position: absolute;
    bottom: -1px;
    height: 2px;
    background-color: var(--blue-500);
    will-change: left, width, opacity;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s ease-in-out;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* --- Enhanced List & Section Styling --- */
.group-label {
    color: var(--gray-400);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 16px 8px 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin: 8px 0;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.section-header > div:first-child {
    cursor: pointer;
    flex-grow: 1;
}

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

.section-header.active {
    background-color: var(--gray-100);
    color: var(--gray-900);
    font-weight: 500;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin: 2px 0;
    text-decoration: none;
    color: var(--gray-600);
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 14px;
    position: relative;
}

.nav-link.active {
    background-color: var(--gray-100);
    color: var(--gray-900);
    font-weight: 500;
}

.nav-link:not(.active):hover {
    background-color: var(--hover-bg);
}

.nav-link:hover .ellipsis-btn {
    opacity: 1;
}

.ellipsis-btn {
    opacity: 0;
    padding: 4px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
    color: #6b7280;
}

.ellipsis-btn:hover {
    background-color: #e5e7eb;
}

/* --- Expandable Sections --- */
.expandable-section .section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.expandable-section.open .section-content {
    max-height: 20rem; /* Fallback max-height */
}

.expandable-section.open .section-toggle-icon {
    transform: rotate(90deg);
}

.section-toggle-icon {
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 16px;
    height: 16px;
    color: #6b7280;
    flex-shrink: 0;
}

.nested-list-wrapper {
    position: relative;
    padding-top: 4px;
    padding-left: 8px;
}

.expandable-section.open .nested-list-wrapper::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background-color: var(--gray-200);
}

.nav-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    transition: color 0.2s ease;
}

/* --- Context Menu Styling --- */
.context-menu-base {
    position: fixed;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.1s ease, transform 0.1s ease;
    transform-origin: left center; 
    background-color: white;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    min-width: 224px;
}

.context-menu-base.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-900);
    transition: background-color 0.15s ease;
}

.context-menu-item:hover {
    background-color: var(--gray-100);
}

.context-menu-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
    color: var(--gray-500);
}

.context-menu-item.delete,
.context-menu-item.delete svg {
    color: var(--red-500);
}

.context-menu-item .submenu-icon {
    margin-left: auto;
    color: var(--gray-400);
}

.context-menu-divider {
    height: 1px;
    background-color: var(--gray-100);
    margin: 6px 0;
}

/* --- Inline Rename Input --- */
.rename-input {
    width: 100%;
    font-size: 14px;
    padding: 4px 8px;
    border: 1px solid var(--blue-500);
    border-radius: 6px;
    background-color: white;
    color: var(--gray-900);
}

.rename-input:focus {
    outline: none;
}

/* --- Modal Styling --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

/* Sidebar Sections */
.section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.add-btn {
    width: 24px;
    height: 24px;
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s;
    color: #9ca3af;
}

.section-header:hover .add-btn {
    opacity: 1;
}

.add-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.nav-list {
    list-style: none;
}

/* Sidebar Navigation Items */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #4b5563;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 5px;
    transition: background-color 0.3s;
}

.sidebar-item:hover {
    background-color: #f3f4f6;
}

.sidebar-item i {
    margin-right: 10px;
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-200) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--gray-200);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: var(--gray-300);
}

/* ====================================
 * 4. CONTEXT BAR
 * ==================================== */
.context-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    padding-left: 280px; /* 260px sidebar + 20px padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5; /* Set to be below sidebar but above other elements */
    transition: padding-left 0.2s ease;
}

.sidebar.collapsed + .context-bar {
    padding-left: 92px; /* 72px collapsed sidebar + 20px padding */
}

.sidebar.collapsed + .context-bar #context-parent {
    display: flex !important;
}

.context-title {
    font-weight: 600;
    color: #1f2937;
    margin-right: 8px;
}

.context-breadcrumb {
    display: flex;
    align-items: center;
}

.context-item {
    display: flex;
    align-items: center;
    color: #4b5563;
}

/* Explicit breadcrumb separator element */
.context-sep {
    margin: 0 8px;
    color: #9ca3af;
    pointer-events: none;
}

.context-item:last-child {
    font-weight: 500;
    color: #3b82f6;
}
.context-bar-logo {
    width: 54px;
    height: 54px;
    display: block;
    color: #6b7280;
    fill: currentColor;
    stroke: currentColor;
}

.context-bar-profile {
    display: flex;
    align-items: center;      /* vertical centering */
    justify-content: flex-end;
    padding-right: 1px;      /* adjust as needed */
    padding-top: 0;           /* remove if not needed */
}

.context-bar-docs-link {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: #111;
    text-decoration: none;
    margin-right: 16px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.context-bar-docs-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* ====================================
 * 5. CANVAS
 * ==================================== */
#canvas {
    position: absolute;
    top: 0;
    left: 0;
    /* width/height will expand */
    transform-origin: 0 0;
    padding: 20px;
    padding-top: 60px; /* leave space for context bar */
    min-height: 100vh;
    /* Remove margin-left since viewport handles positioning */
    margin-left: 0;
}

#canvas.collapsed {
    margin-left: 0;
}

.canvas-watermark {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%,-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e5e7eb;
    font-size: 82px;
    font-weight: 700;
    letter-spacing: -5.5px;
    pointer-events: none;
    z-index: -1;
}

.canvas-watermark .beta-tag {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 700;
    position: absolute;
    bottom: -0.2em;
    right: 0.08em;
    font-size: 0.85rem;
    color: #3b82f6;
    background-color: #eff6ff;
    padding: 0.15em 0.5em;
    border-radius: 0.5em;
}

/* ====================================
 * 6. TOGGLE BUTTON
 * ==================================== */
#toggle-sidebar {
    position: relative;
    top: auto;
    right: auto;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    box-shadow: none;
    padding: 8px;
    transition: background-color 0.2s ease;
}

#toggle-sidebar:hover {
    background-color: #f3f4f6;
}

#toggle-sidebar svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed #toggle-sidebar svg {
    transform: scaleX(-1);
}

/* ====================================
 * 7. NODES (GENERIC & SPECIFIC)
 * ==================================== */
/* Generic Node Styles */
.node {
    width: 400px;
    position: absolute;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 16px;
    position: absolute !important;
}
.node.selected { 
    border: 2px solid #3b82f6 !important; 
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); 
    background: rgba(59, 130, 246, 0.02);
}

.node.marquee-highlight {
    border: 2px solid #3b82f6 !important; 
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); 
    background: rgba(59, 130, 246, 0.02);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.node-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.node-controls {
    display: flex;
    align-items: center;
}

.node-controls button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: 5px;
    font-size: 14px;
}

.node-content {
    display: flex;
    flex-direction: column;
}

.node textarea, .node input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    padding: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    resize: vertical;
}

.node button.generate {
    align-self: flex-end;
    background-color: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.node button.generate:hover {
    background-color: #f3f4f6;
}

.node.expanded {
    width: 500px;
    height: 300px;
}

.node.expanded textarea {
    height: 200px;
}

/* ── ENHANCED TEXT AND INPUT NODES ── */
.node.text-node, .node.input-node {
  width: 428px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e1e1e6;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: visible; /* allow endpoints */
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: relative; /* Ensure proper positioning for jsPlumb endpoints */
}

.node.fullscreen {
  position: fixed !important;
  top: 0 !important; 
  left: 0 !important;
  width: 100vw !important; 
  height: 100vh !important;
  transform: none !important; 
  border-radius: 0 !important;
  z-index: 1000 !important;
  /* Add flexbox for layout */
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important; /* Add background */
}

/* Remove custom connection dots - jsPlumb will handle connections */
/* .connection-dot styles removed */

/* Progress Bar */
.node .progress-container {
  position: absolute; 
  top: 0; 
  left: 0;
  width: 100%; 
  height: 4px;
  clip-path: inset(0px 0px calc(100% - 4px) 0px round 12px 12px 0 0);
  pointer-events: none;
}

.node .progress {
  width: 0; 
  height: 100%;
  background: #3b82f6;
  border-radius: 2px 2px 0 0;
}

/* Top Toolbar */
.node .toolbar.top {
  display: flex; 
  align-items: center;
  padding-bottom: 6px; 
  margin-bottom: 6px;
  cursor: move; /* Make toolbar draggable */
}

.node .toolbar.top button {
  background: none; 
  border: none;
  font-size: 16px; 
  color: #666;
  cursor: pointer; 
  padding: 0 4px;
}

.node .toolbar.top .model-label {
  margin-left: auto;
  font-size: 14px; 
  font-weight: 500; 
  color: #666;
  display: inline-block;
  max-width: 20ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Search Bar */
.node .search-bar-wrapper {
  display: none;
  width: 100%;
  background: rgba(255,255,255,0.9);
  border: 1px solid #e1e1e6;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 6px 0;
  align-items: center;
  gap: 8px;
}

.node .search-bar-wrapper.visible {
  display: flex;
}

.node .search-bar-wrapper input {
  flex: 1;
  font-size: 14px;
  border: none; 
  outline: none;
  background: transparent;
}

.node .search-bar-wrapper .search-count {
  font-size: 12px; 
  color: #666;
  user-select: none;
  min-width: 32px;
  text-align: center;
}

.node .search-bar-wrapper .search-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.node .search-bar-wrapper .search-nav button {
  background: none;
  border: none;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
}

.node .search-bar-wrapper .search-nav button:hover {
  background: #f0f0f5;
}

/* Textarea */
.node.text-node textarea, .node.input-node textarea {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; 
  line-height: 1.4;
  color: #333;
  background: transparent; 
  border: none; 
  outline: none;
  resize: none; 
  overflow-y: hidden;
  min-height: calc(1.4em * 2);
  max-height: calc(1.4em * 20);
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #e1e1e6 transparent;
  margin-bottom: 0;
  border-radius: 0;
}

.node.text-node textarea::placeholder, .node.input-node textarea::placeholder {
  font-weight: 400; 
  color: #999;
}

.node.text-node textarea::-webkit-scrollbar, .node.input-node textarea::-webkit-scrollbar {
  width: 12px;
}

.node.text-node textarea::-webkit-scrollbar-thumb, .node.input-node textarea::-webkit-scrollbar-thumb {
  background-color: #e1e1e6; 
  border-radius: 6px;
}

.node.text-node textarea::selection, .node.input-node textarea::selection {
  background: #3b82f6; 
  color: #fff;
}

/* Bottom Toolbar */
.node .toolbar.bottom {
  display: flex; 
  align-items: center;
  border-top: 1px solid #e1e1e6;
  padding-top: 6px; 
  margin-top: 6px;
  cursor: move; /* Make toolbar draggable */
}

.node .toolbar.bottom .word-count {
  margin-left: auto; 
  font-size: 14px; 
  color: #666;
}

/* Fullscreen Overrides */
/* This will target the textarea in text-node and input-node */
.node.fullscreen > textarea {
  flex: 1;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
}

/* This will target the wrapper in chameleon-node */
.node.fullscreen .editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flexbox inside scrolling containers */
}

/* This will make the textarea inside chameleon's wrapper take up space */
.node.fullscreen .editor-wrapper .chameleon-textarea,
.node.fullscreen .editor-wrapper .chameleon-editor-overlay {
    flex: 1;
    height: 100%;
    max-height: none;
    overflow-y: auto;
}

.node.fullscreen .toolbar.bottom {
  border-top: none;
  position: relative; /* Change from absolute */
  bottom: auto;
  right: auto;
  padding: 4px 8px;
  margin-top: 6px;
  width: 100%;
  box-sizing: border-box;
  background: rgba(240,240,240,0.8);
}

/* Hide jsPlumb endpoints in fullscreen */
.node.fullscreen .jtk-endpoint {
  display: none !important;
}

/* Editable Model Label */
.node .model-label-input {
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; 
  font-weight: 500; 
  color: #666;
  background: transparent;
  border: none;
  outline: none;
  white-space: nowrap;
  padding: 0;
  display: inline-block;
  box-sizing: border-box;
}

/* Highlight styles */
.highlight {
  background-color: rgba(255, 255, 0, 0.3);
  border-radius: 2px;
}

.highlight.current {
  background-color: rgba(255, 165, 0, 0.5);
}

/* jsPlumb endpoint styling for enhanced nodes */
.node.text-node .jtk-endpoint, .node.input-node .jtk-endpoint {
  z-index: 10;
}

.node.text-node .jtk-connector, .node.input-node .jtk-connector {
  z-index: 5;
}

/* Ensure jsPlumb endpoints are properly positioned */
.jtk-endpoint {
  cursor: crosshair;
  transition: none !important; /* Remove transitions that cause lag */
  transform: none !important; /* Prevent transform lag */
}

.jtk-endpoint:hover {
  transform: scale(1.2) !important; /* Only scale on hover */
}

/* Critical: Ensure endpoints move with parent element */
.node .jtk-endpoint {
  position: absolute !important;
  z-index: 25 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  /* Remove any properties that might cause lag */
  transition: none !important;
  will-change: auto !important;
}

/* Ensure connections are visible and don't interfere */
.jtk-connector {
  z-index: 10 !important;
  pointer-events: stroke !important;
  transition: none !important;
}

/* Connector overlays (arrows) */
.jtk-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Node dragging state */
.node.jtk-drag {
  z-index: 100 !important;
}

.node.jtk-drag .jtk-endpoint {
  z-index: 101 !important;
}

/* Glass card compatibility */
.node.text-node .jtk-endpoint, 
.node.input-node .jtk-endpoint {
  z-index: 30 !important;
  /* Removed blur and background effects to match broken version styling */
}

/* CRITICAL: Drag endpoint styling for blue connection endpoints */
.jtk-endpoint.drag-endpoint,
.jtk-drag-endpoint {
  background: #2784dd !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  width: 16px !important;
  height: 16px !important;
  z-index: 100 !important;
}

/* Enhanced endpoint styling during drag operations */
.jtk-endpoint.jtk-endpoint-drag {
  background: #2784dd !important;
  border: 2px solid #fff !important;
  z-index: 100 !important;
}

/* CRITICAL: Remove ALL arrow overlays from ANY connections */
.jtk-overlay,
.jtk-overlay.jtk-arrow,
.jtk-overlay.jtk-arrow-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Ensure drag connections show blue endpoints */
.jtk-connector.jtk-connector-outline {
  z-index: 50 !important;
}

/* Chat Node */
.chat-node-container {
    position: absolute;
    width: 400px;
    max-width: 600px;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

.chat-node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
}

.chat-node-body {
    padding: 1rem;
}

.chat-history {
    display: flex;
    flex-direction: column;
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
}

.user-message, .llm-response {
    max-width: 80%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 18px;
    word-wrap: break-word;
}

.user-message {
    align-self: flex-end;
    background-color: #f3f4f6;
}

.llm-response {
    align-self: flex-start;
    background-color: #e5e7eb;
}

.chat-input-container {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: transparent;
    border-top: 1px solid #e5e7eb;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #1f2937;
}

.send-chat-message-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.send-chat-message-button .icon {
    width: 24px;
    height: 24px;
    color: #4b5563;
}

/* File Upload Node */
.file-upload-node {
    background-color: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 300px;
    height: 430px;
    transition: width 0.3s, height 0.3s;
    overflow: hidden;
}

.file-upload-node .upload-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.file-upload-node .upload-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
}

.file-upload-node .file-preview {
    border: 2px dashed #3b82f6;
    border-radius: 10px;
    height: 270px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f3f9ff;
    position: relative;
}

.file-upload-node .file-preview.dragover {
    background-color: #e3f0ff;
}

.file-upload-node .upload-placeholder {
    text-align: center;
}

.file-upload-node .file-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    fill: #3b82f6;
}

.file-upload-node .upload-text {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 5px;
}

.file-upload-node .file-size-limit {
    font-size: 12px;
    color: #9ca3af;
}

/* Special Node Types */
.world-node {
    background-color: #eef2ff;
    border: 2px solid #c7d2fe;
}

.recipe-node {
    background-color: #fef2f2;
    border: 2px solid #fecaca;
}

/* ====================================
 * 8. MODALS
 * ==================================== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    z-index: 30;
}

.modal.hidden {
    display: none;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    width: 320px;
    padding: 24px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-btn {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn.primary {
    background: #f3f4f6;
}

.modal-btn:hover {
    background: #f9fafb;
}

/* ====================================
 * 9. COMMAND BAR
 * ==================================== */
.command-bar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: none;
}

.command-bar-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.command-bar {
    position: fixed;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: white;
    border-radius: 25px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 101;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(20px);
}

.command-bar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.command-bar-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.command-bar-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 0.5rem 0;
    background: transparent;
    font-family: inherit;
}

.command-bar-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.command-bar-button {
    padding: 0.5rem;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.command-bar-button:hover {
    background: #f3f4f6;
    color: #111827;
}

.command-bar-button.book {
    color: #6b7280;
}

.command-bar-button.book.active {
    color: #3b82f6;
}

.command-bar-button.submit {
    padding: 0.5rem 1rem;
    background: #eff6ff;
    color: #3b82f6;
    font-weight: 500;
    border-radius: 20px;
}

.command-bar-button.submit:hover {
    background: #dbeafe;
}

/* ====================================
 * 10. RECIPE PANEL
 * ==================================== */
.recipe-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-left: 1px solid #e5e7eb;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 102;
    display: flex;
    flex-direction: column;
}

.recipe-panel.show {
    transform: translateX(0);
}

.recipe-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-panel-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #111827;
}

.recipe-panel-close {
    padding: 0.5rem;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-panel-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.recipe-panel-categories {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
}

.recipe-category-button {
    border: none;
    background: none;
    font-size: 0.875rem;
    color: #6b7280;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 400;
    position: relative;
    white-space: nowrap;
}

.recipe-category-button:hover {
    color: #111827;
}

.recipe-category-button.active {
    color: #111827;
    font-weight: 500;
}

.recipe-category-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background-color: #111827;
    border-radius: 2px;
}

/* Recipe Section Header */
.recipe-section-header {
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    cursor: pointer;
    position: relative;
    margin-top: 16px;
}

.recipe-section-header::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 8px;
    right: 8px;
    bottom: 4px;
    background-color: #f3f4f6;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    border-radius: 6px;
}

.recipe-section-header:hover::before {
    opacity: 1;
}

.recipe-section-title {
    font-size: 14px;
    color: #4b5563;
    font-weight: 500;
    position: relative;
    z-index: 1;
    padding: 4px 0;
}

.recipe-section-actions {
    visibility: hidden;
    opacity: 0;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 1;
    display: flex;
    transition: opacity 0.15s ease;
}

.recipe-section-header:hover .recipe-section-actions {
    visibility: visible;
    opacity: 1;
}

.recipe-action-button {
    padding: 2px;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-action-button:hover {
    color: #374151;
}

.recipe-action-button i {
    width: 16px;
    height: 16px;
}

/* Recipe Cards */
.recipe-cards-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.recipe-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    transition: all 0.15s ease;
    padding: 0.75rem;
}

.recipe-card:hover {
    background: rgba(0, 0, 0, 0.03);
}

.recipe-card.active {
    background: rgba(0, 0, 0, 0.05);
}

.recipe-content {
    padding: 0.5rem;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.recipe-title {
    font-weight: 500;
    color: #111827;
    margin: 0;
    font-size: 16px;
}

.recipe-description {
    font-size: 14px;
    color: #6b7280;
    margin: 4px 0 0 0;
}

.add-recipe-button {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-recipe-button:not(.active) {
    background: #f3f4f6;
    color: #6b7280;
}

.add-recipe-button.active {
    background: #eff6ff;
    color: #3b82f6;
}

.recipe-prompt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
    color: #4b5563;
    display: none;
}

.recipe-prompt.show {
    display: block;
}

.expand-button {
    margin-top: 8px;
    border: none;
    background: none;
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
}

.expand-button:hover {
    color: #4b5563;
}

.expand-button i {
    transition: transform 0.2s ease;
}

.expand-button.expanded i {
    transform: rotate(90deg);
}

/* ====================================
 * 11. ANIMATIONS
 * ==================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* Glass Recipe Cards */
.recipe-glass-card {
    position: relative;
    width: 100%;
    height: 80px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(39, 39, 39, 0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.3s ease;
}

.recipe-glass-card:hover {
    background: rgba(39, 39, 39, 0.15);
    transform: translateY(-2px);
}

.recipe-glass-card:active {
    cursor: grabbing;
}

/* make on-canvas watermark match the drag-preview */
.recipe-glass-card .recipe-watermark {
    position: absolute;
    bottom: 0.9rem;      /* was 4px */
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;       /* was 12px */
    color: #000;
    opacity: 0.1;
    pointer-events: none;
    letter-spacing: -0.04em;
    text-transform: none;  /* new */
}

/* make on-canvas title match preview text */
.recipe-glass-card .recipe-name {
    font-size: 28px;       /* was 16px */
    font-weight: bold;
    color: #000;
    opacity: 0.3;          /* was 0.5 */
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
}


.recipe-glass-card input.recipe-name-edit {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    background: transparent;
    border: none;
    text-align: center;
    width: 90%;
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
}

.recipe-glass-card input.recipe-name-edit:hover {
    background: rgba(0, 0, 0, 0.05);
}

.recipe-glass-card input.recipe-name-edit:focus {
    background: rgba(0, 0, 0, 0.1);
}

/* Recipe drag preview */
.recipe-drag-preview {
    position: fixed;
    width: 19rem;
    height: 27em;
    padding: 1rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(39, 39, 39, 0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.7;
}

.recipe-drag-preview .watermark {
    position: absolute;
    bottom: 0.9rem;
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: #000;
    opacity: 0.1;
    pointer-events: none;
    letter-spacing: -0.04em;
    text-transform: none;
}

.recipe-drag-preview .text-center {
    font-size: 28px;
    font-weight: bold;
    color: #000;
    opacity: 0.3;
    text-align: center;
}

/* Enable drag-drop for canvas */
#canvas.drag-over {
    background-color: rgba(59, 130, 246, 0.1);
}
.context-item:hover {
    color: #3b82f6;
    text-decoration: underline;
}
/* ── LINKED DATA PANEL ── */
#linked-data-panel {
  position: fixed;
  bottom: 0;
  left: 260px;     /* same as your sidebar */
  right: 0;
  height: 150px;
  width: auto !important;       /* ← override the 428px */
  max-width: none !important;
  background: #fff;
  border-top: 1px solid #e1e7eb;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 10;
  padding: 12px;
  overflow: hidden;
}#linked-data-panel textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}
/* Linked Data Toggle Button */
.linked-data-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.2s ease;
  z-index: 1000;
}

.linked-data-toggle-btn:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.linked-data-toggle-btn i {
  width: 16px;
  height: 16px;
}

/* Adjust canvas padding when panel is visible */
#canvas.panel-visible {
  padding-bottom: 170px; /* panel height + pad */
}

/* make room so canvas nodes aren't hidden under it */
#canvas {
  padding-bottom: 60px; /* default padding without panel */
}

/* Node Selection & Marquee */
.marquee-selection {
    position: absolute;
    border: 2px dashed #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    pointer-events: none;
    z-index: 999;
    border-radius: 4px;
}

.canvas-selecting {
    cursor: crosshair;
}

.canvas-selecting .node {
    pointer-events: auto;
}

/* Mini-map box */
#minimap {
    position: absolute;
    right: 12px;
    bottom: 80px; /* above debug toggle */
    width: 180px;
    height: 120px;
    background: rgba(240,240,240,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    pointer-events: auto;
    z-index: 50;
}

/* cursor while panning */
#canvas-viewport[style*="cursor: grabbing"] {
    cursor: grabbing !important;
}

#mini-rect {
    background: rgba(59,130,246,0.15);
}

.mini-dot{pointer-events:none;}

/* Galaxy Hub View Styles */
.galaxy-hub-container {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    z-index: 5;
    background-color: var(--body-bg);
    padding: 2rem;
    box-sizing: border-box;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto; /* Allows scrolling for content if it overflows */
    padding-top: 60px; /* Space for context bar */
    padding-bottom: 2rem; /* Ensure space at bottom */
}

.sidebar.collapsed ~ .galaxy-hub-container {
    left: var(--sidebar-collapsed-width);
}

.galaxy-hub-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    text-align: center;
    margin-bottom: .1rem;
    padding: 1rem 0;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: .1rem;
    letter-spacing: -0.03em;
    color: #1f2937;
}

.header p {
    color: #6b7280;
    font-weight: 400;
    font-size: 1.2rem;
    margin: -10;
}

.galaxy-nav {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 3rem;
    margin-top: -10;
    padding: 0.5rem 0;
}

.galaxy-nav .nav-item {
    padding: 0.5rem 0;
    font-weight: 400;
    color: #999;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
    position: relative;
}

.galaxy-nav .nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #000;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.galaxy-nav .nav-item:hover {
    color: #000;
}

.galaxy-nav .nav-item.active {
    color: #000;
    font-weight: 500;
}

.galaxy-nav .nav-item.active::after {
    transform: scaleX(1);
}

.galaxy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    margin-bottom: 3rem;
    margin-top: -3rem;
    width: 100%;
    max-width: 1200px;
}

.glass-card {
    position: relative;
    cursor: pointer;
    width: 280px;
    height: 100px;
    border-radius: 24px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
}

.glass-card-blur {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(66, 153, 225, 0.08), rgba(139, 92, 246, 0.08));
    border-radius: 24px;
    opacity: 0;
    transition: all 0.5s ease;
    filter: blur(20px);
}

.glass-card:hover .glass-card-blur {
    opacity: 1;
}

.glass-card-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.05),
        0 12px 24px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.glass-card:hover .glass-card-content {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
}

.world-actions {
    display: flex;
    gap: 0.5rem;
}

.action-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(4px);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.glass-card:hover .action-icon {
    opacity: 1;
    transform: scale(1);
}

.action-icon:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
}

.action-icon svg {
    width: 16px;
    height: 16px;
    color: #666;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: #000;
    margin-bottom: 0.5rem;
}

.card-description {
    font-size: 0.875rem;
    color: #666;
    font-weight: 300;
    margin-bottom: auto;
}

.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(4px);
    border-radius: 999px;
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
}

.galaxy-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.action-btn.primary {
    background: linear-gradient(120deg, #000000, #333333);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.secondary {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #666;
}

.action-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
    color: #000;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media (max-width: 2008px) {
    .galaxy-hub-container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2.8rem;
    }
    
    .header p {
        font-size: 1.1rem;
    }
    
    .galaxy-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 0.5rem;
        max-width: 100%;
    }
    
    .glass-card {
        width: 100%;
        min-width: 250px;
    }
    
    .galaxy-nav {
        gap: 1.5rem;
    }
    
    .galaxy-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .galaxy-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .glass-card {
        min-width: unset;
        max-width: 100%;
    }
    
    .galaxy-nav {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }
}

/* Make galaxy name clickable */
.nav-text[data-action="select"] {
    pointer-events: auto;
    cursor: pointer;
    color: #374151;
    transition: color 0.2s ease;
}

.nav-text[data-action="select"]:hover {
    color: #1f2937;
}

/* --- Collapsed State Styles --- */
.sidebar.collapsed .sidebar-content,
.sidebar.collapsed .sidebar-tabs,
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .tab-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .group-label,
.sidebar.collapsed .ellipsis-btn,
.sidebar.collapsed .add-btn {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .api-button {
    display: none;
}

/* === Canvas Viewport Wrapper === */
#canvas-viewport {
    /* Position to the right of sidebar and below context bar */
    position: fixed;
    top: 56px; /* Height of context bar */
    left: 280px; /* Width of sidebar */
    right: 0;
    bottom: 0;
    overflow: hidden; /* we will handle panning with transforms later */
    min-height: calc(100vh - 56px);
    transition: left 0.2s ease;
}

.galaxy-hub-active #canvas-viewport {
  left: 280px !important;
}

.sidebar-collapsed .galaxy-hub-inner {
    margin-left: calc(72px + (100vw - 72px - 900px) / 2);
    margin-right: auto;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


.globe-icon {
    position: absolute !important;
    bottom: 24px !important;
    right: 24px !important;
    top: auto !important;
    left: auto !important;
    opacity: 0.3 !important;
    color: #000 !important;
    z-index: 100 !important;
    pointer-events: none !important;
}

/* 3D Galaxy View Styles */
.galaxy-3d-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    height: 100%;
        margin-top: -1rem;

    font-family: 'Roboto', 'Segoe UI', system-ui, sans-serif;
    padding: 20px;
    box-sizing: border-box;
}

.galaxy-3d-top-bar {
    width: 90%;
    max-width: 1200px;
    background-color: #ffffff;
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-top: -3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.galaxy-3d-search-bar {
    display: flex;
    align-items: center;
    background-color: #f1f3f4;
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    padding: 4px 12px;
    transition: background-color 0.3s ease;
}

.galaxy-3d-search-bar .material-icons {
    color: #5f6368;
    font-size: 20px;
    transition: color 0.3s ease;
}

.galaxy-3d-search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 6px;
    font-size: 14px;
}

.galaxy-3d-card-container {
    position: relative;
    width: 90%;
    height: 80vh;
    max-width: 1200px;
    max-height: 750px;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.galaxy-3d-scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.galaxy-3d-scene-container:active {
    cursor: grabbing;
}

.world-label {
    color: #3c4043;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(0,0,0,0.08);
    transform: translate(-50%, 0);
    white-space: nowrap;
    transition: opacity 0.2s;
    pointer-events: none;
}

.galaxy-3d-info-panel {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 18px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    max-width: 300px;
    transition: opacity 0.3s, transform 0.3s, background-color 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    z-index: 10;
}

.galaxy-3d-info-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.galaxy-3d-info-panel h2 {
    font-size: 16px;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.galaxy-3d-info-panel p {
    margin: 0;
    color: #5f6368;
}

.galaxy-3d-view {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
