:root {
    /* Light Mode Theme */
    --bg-primary: #F8F9FA;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-select: #ffffff;
    --text-primary: #333;
    --text-secondary: #364153;
    --text-tertiary: #999;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0,0,0,0.05);
    --shadow-color-hover: rgba(0,0,0,0.12);
}

body.dark-mode {
    /* Dark Mode Theme */
    --bg-primary: #1a1d23;
    --bg-secondary: #23262d;
    --bg-tertiary: #2c2f38;
    --bg-select: var(--bg-primary);
    --text-primary: #e8eaed;
    --text-secondary: #b8bbc1;
    --text-tertiary: #888b92;
    --border-color: #3a3d45;
    --shadow-color: rgba(0,0,0,0.3);
    --shadow-color-hover: rgba(0,0,0,0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

#root {
    width: 100vw;
    height: 100vh;
    display: flex;
}

/* Sidebar Styles */
.sidebar {
    width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 8px var(--shadow-color);
    transition: all 0.3s ease;
    margin: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    border: 2px solid var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
.sidebar {
    scrollbar-width: 18px;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.sidebar h3 {
    font-size: 14px;
    margin: 20px 0 10px 0;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.node-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.draggable-node {
    width: 160px;
    height: 80px;
    padding: 20px;
    border-radius: 16px;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    font-weight: 500;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.draggable-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.draggable-node:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.draggable-node-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.draggable-node-icon {
    width: 24px;
    height: 24px;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.draggable-node-label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
}

.draggable-node.person { background: var(--node-person); }
.draggable-node.entity { background: var(--node-entity); }
.draggable-node.thing { background: var(--node-thing); }
.draggable-node.process { background: var(--node-process); }
.draggable-node.api { background: var(--node-api); }
.draggable-node.other { background: var(--node-other); }
.draggable-node.note { background: var(--node-note); color: #333; }

.note-sticky {
    width: 332px !important;
    height: 80px !important;
    background-color: #FFF8A7 !important;
    border-radius: 0 !important;
    padding: 12px 16px !important;
    gap: 0 !important;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: visible;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* Bottom-left folded paper corner - back side */
.note-sticky::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    border-color: transparent transparent #E8D98F transparent;
    z-index: 1;
    transform: rotate(270deg);
}

/* Bottom-left folded paper corner - shadow */
.note-sticky::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -1px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    background-color: #fff;
    border-color: transparent transparent rgba(0, 0, 0, 0.12) transparent;
    z-index: 0;
    transform: rotate(270deg) translate(-1px, 1px);
}

.note-sticky-label {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    text-align: left;
    z-index: 2;
    position: relative;
    margin: 0;
    line-height: 1.4;
}

.note-sticky:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px 0px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Text Note Sticky (on canvas) */
.text-note-sticky {
    overflow: visible !important;
}

/* Bottom-left curled corner - back side */
.text-note-sticky::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    border-color: transparent transparent #E8D98F transparent;
    z-index: 1;
    transform: rotate(270deg);
}

/* Bottom-left curled corner - shadow */
.text-note-sticky::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -1px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    border-color: transparent transparent rgba(0, 0, 0, 0.12) transparent;
    z-index: 0;
    transform: rotate(270deg) translate(-1px, 1px);
}

.connection-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.connection-type {
    width: 332px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #364153;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s;
    cursor: pointer;
}

.connection-type:hover {
    border-color: var(--hover-stroke-color, var(--primary-color));
}

.connection-type.selected {
    border-color: var(--hover-stroke-color, var(--primary-color));
}

.edge-menu .connection-type {
    width: 100%;
}

.connection-indicator {
    width: 40px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Pages */
.pages-container {
    margin: 15px 0;
}

.pages-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.page-tab {
    position: relative;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s;
    user-select: none;
}

.page-tab:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.page-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.page-tab span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-name-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
}

.page-tab.active .page-name-input {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

body.dark-mode .page-name-input {
    background: rgba(40, 44, 52, 0.9);
    color: var(--text-primary);
}

body.dark-mode .page-tab.active .page-name-input {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.page-copy-btn,
.page-delete-btn {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.page-copy-btn {
    font-size: 14px;
}

.page-copy-btn:hover,
.page-delete-btn:hover {
    opacity: 1;
}

.page-tab.active .page-copy-btn,
.page-tab.active .page-delete-btn {
    color: white;
}

.copy-page-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 10000;
    min-width: 200px;
}

.copy-brand-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
    margin-bottom: 4px;
}

.copy-brand-option:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.copy-menu-cancel {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-top: 8px;
}

.copy-menu-cancel:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.add-page-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.add-page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-secondary);
}

/* Main Canvas */
.main-canvas {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

/* Light mode dotted pattern */
.main-canvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, #B7B7B7 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Dark mode uses ReactFlow's built-in Background component */
body.dark-mode .main-canvas::before {
    display: none;
}

/* Empty Canvas Message */
.empty-canvas-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

.empty-canvas-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding: 0;
    line-height: 1.4;
}

.empty-canvas-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    padding: 0;
    line-height: 1.4;
}
.react-flow__node {
    background: transparent !important;
    border: none;
    border-radius: 8px;
    padding: 0;
    box-shadow: none;
    transition: all 0.2s;
    cursor: move;
}

.react-flow__node:hover {
    box-shadow: none;
    transform: translateY(-1px);
}

.react-flow__node.selected {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.custom-node {
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: box-shadow 0.2s;
    width: 100%;
    height: 100%;
    min-width: 240px;
    min-height: 150px;
}

.custom-node:hover {
    box-shadow: 0 4px 12px var(--shadow-color-hover);
}
/* Ensure all text content in nodes wraps properly */
.custom-node input[type="text"],
.custom-node textarea {
    box-sizing: border-box;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Text display areas should have scrollbars when content overflows */
.custom-node > div > div {
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure resize handle stays visible */
.custom-node > div[style*="resize"] {
    z-index: 100;
}
.node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.node-header-icon-wrapper {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.node-header-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-header-icon-emoji {
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-edit-icon {
    filter: brightness(0);
}

body.dark-mode .node-edit-icon {
    filter: brightness(0) invert(1) brightness(0.80);
}

.node-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    cursor: text;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.node-title:hover {
    background: var(--bg-tertiary);
}

/* Connection Handles */
.react-flow__handle {
    width: 16px;
    height: 16px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
    transform-origin: center center;
}

.react-flow__handle:hover {
    transform: scale(3);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.react-flow__handle-connecting {
    background: #38f9d7 !important;
}

.react-flow__handle-valid {
    background: #43e97b !important;
}

/* Edge Styles */
.react-flow__edge-path {
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Make edges easier to interact with */
.react-flow__edge {
    pointer-events: all;
}

.react-flow__edge:hover .react-flow__edge-path {
    stroke-width: 3.5;
}

/* Show circular handles at edge endpoints when hovering */
.react-flow__edge.selected .react-flow__edge-path,
.react-flow__edge:hover .react-flow__edge-path {
    opacity: 1;
}

/* Edge Labels - ensure clean rendering */
.react-flow__edge-text {
    fill: #555 !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    stroke: none !important;
    stroke-width: 0 !important;
}

.react-flow__edge-textbg {
    fill: white !important;
    fill-opacity: 0.9 !important;
    stroke: none !important;
}

/* Pulse animation for other use cases */
@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    50% { 
        opacity: 0.9;
        transform: translateX(-50%) scale(1.02);
    }
}

/* Edge Updater Handles (for reconnection) */
.react-flow__edgeupdater {
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    pointer-events: all;
}

.react-flow__edgeupdater:hover {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-color: #43e97b;
    border-width: 3px;
    cursor: grabbing;
}

/* Toolbar */
.toolbar {
    position: absolute;
    top: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    z-index: 10;
    transition: all 0.3s ease;
}

.toolbar-left {
    left: 20px;
}

.toolbar-right {
    right: 20px;
}

.toolbar button {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    height: 38px;
    box-sizing: border-box;
}

.toolbar button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.toolbar button:active {
    transform: translateY(0);
}

.toolbar button.primary {
    background: var(--primary-color);
    color: white;
}

.toolbar button.primary:hover {
    filter: brightness(1.1);
}

.toolbar button.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.toolbar button.secondary:hover {
    background: var(--bg-secondary);
}

.toolbar .file-button {
    background: transparent !important;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.toolbar .file-button:hover {
    background: var(--bg-tertiary) !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .toolbar .file-button {
    color: var(--text-primary) !important;
}

body.dark-mode .toolbar .file-button img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.toolbar .undo-redo-button {
    background: #E5E5E5;
    border: none;
    color: var(--text-primary);
}

.toolbar .undo-redo-button:hover {
    background: #D4D4D4;
}

.toolbar .undo-redo-button img {
    filter: brightness(0);
}

body.dark-mode .toolbar .undo-redo-button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.dark-mode .toolbar .undo-redo-button:hover {
    background: var(--bg-secondary);
}

body.dark-mode .toolbar .undo-redo-button img {
    filter: brightness(0) invert(1);
}

/* Toolbar Pages Dropdown */
.toolbar-pages-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    width: 243px;
    height: 240px;
    z-index: 1000;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.toolbar-pages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #364153;
    border-bottom: none;
    flex-shrink: 0;
}

body.dark-mode .toolbar-pages-header {
    color: var(--text-primary);
}

.toolbar-pages-add-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toolbar-pages-add-btn:hover {
    background: var(--bg-tertiary);
}

body.dark-mode .toolbar-pages-add-btn {
    color: #667eea;
}

body.dark-mode .toolbar-pages-add-btn img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

body.dark-mode .toolbar-pages-add-btn:hover {
    background: var(--bg-tertiary);
    color: #667eea;
}

body.dark-mode .toolbar-pages-add-btn:hover img {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.toolbar-pages-list {
    flex: 1;
    padding: 0 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    min-height: 0;
    max-height: calc(240px - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #D1D5DC #F5F5F5;
}

/* Custom scrollbar for pages list */
.toolbar-pages-list::-webkit-scrollbar {
    width: 8px;
}

.toolbar-pages-list::-webkit-scrollbar-track {
    background: #F5F5F5;
    border-radius: 4px;
}

.toolbar-pages-list::-webkit-scrollbar-thumb {
    background: #D1D5DC;
    border-radius: 4px;
}

.toolbar-pages-list::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.toolbar-page-item {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-tertiary) !important;
    justify-content: space-between;
    width: 215px;
    height: 30px;
    padding: 0 8px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--text-secondary);
    background: transparent;
}

.toolbar-page-item:hover {
    background: #FFEDE7 !important;
}

.toolbar-page-item.active {
    background: #FFEDE7 !important;
    color: var(--text-secondary);
}

body.dark-mode .toolbar-page-item.active {
    background: var(--primary-color) !important;
    color: white;
}

.toolbar-page-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-page-menu-btn {
    background: transparent !important;
    border: none !important;
    color: #364153 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    padding: 0 !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: none !important;
    flex-shrink: 0;
    box-shadow: none !important;
}

.toolbar-page-menu-btn:hover,
.toolbar-page-menu-btn:focus,
.toolbar-page-menu-btn:active {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
}

.toolbar-page-context-menu {
    position: fixed;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 10001;
    overflow: hidden;
    white-space: nowrap;
}

.toolbar-page-context-menu button {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #364153;
    cursor: pointer;
    transition: background 0.2s;
}

.toolbar-page-context-menu button:hover {
    background: #F5F5F5;
}

.toolbar-page-context-menu button.delete {
    color: #ef4444;
}

.toolbar-page-context-menu button.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.toolbar-page-menu-divider {
    height: 1px;
    background: #E5E5E5;
    margin: 4px 0;
}

body.dark-mode .toolbar-page-context-menu {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .toolbar-pages-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Toolbar Delete All Button */
.toolbar-delete-all-container {
    padding: 8px 14px;
    border-top: 1px solid #E5E5E5;
}

.toolbar-delete-all-btn {
    width: 100%;
    padding: 8px !important;
    background: transparent !important;
    border: 2px solid #ef4444 !important;
    border-radius: 6px;
    color: #ef4444 !important;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    height: auto !important;
}

.toolbar-delete-all-btn:hover {
    background: #ef4444 !important;
    color: white !important;
}

.toolbar-delete-all-btn:hover .toolbar-delete-all-icon {
    filter: brightness(0) invert(1);
}

.toolbar-delete-all-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    filter: brightness(0) saturate(100%) invert(27%) sepia(95%) saturate(7498%) hue-rotate(340deg) brightness(99%) contrast(95%);
    transition: filter 0.2s;
}

/* Toolbar Page Preview */
.toolbar-page-preview {
    pointer-events: none;
}

.toolbar-page-preview-content {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 200px;
    padding: 8px;
}

.toolbar-page-preview-header {
    padding: 8px 12px;
    background: #F5F5F5;
    border-bottom: 1px solid #E5E5E5;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #364153;
    text-align: center;
}

.toolbar-page-preview-minimap {
    width: 184px;
    height: 150px;
    overflow: hidden;
    position: relative;
    border-radius: 4px;
}

.toolbar-page-preview-minimap .react-flow {
    width: 184px !important;
    height: 150px !important;
}

.toolbar-page-preview-minimap .react-flow__viewport {
    width: 184px !important;
    height: 150px !important;
}

.toolbar-page-preview-minimap .react-flow__nodes {
    pointer-events: none;
}

.toolbar-page-preview-minimap .react-flow__edges {
    pointer-events: none;
}

.toolbar-page-preview-footer {
    padding: 8px 12px;
    background: #FFFFFF;
    border-top: 1px solid #E5E5E5;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #364153;
    text-align: left;
}

body.dark-mode .toolbar-page-preview-content {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .toolbar-page-preview-header {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-mode .toolbar-page-preview-footer {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Brand Select Dropdown */
.brand-select {
    width: 332px;
    height: 40px;
    padding: 10px 40px 10px 12px; /* RIGHT padding = space for arrow */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    background-image: url("./assets/Type=ChevronDown.svg");
    background-repeat: no-repeat;
    background-position: right 12px center; /* arrow padding */
    background-size: 18px 18px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    /* Remove default arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.brand-select:hover {
    border-color: var(--border-color);
    background-color: var(--bg-tertiary);
}

.brand-select:focus {
    border-color: #E5E7EB;
    outline: none;
}

.brand-select.open {
    background-image: url("./assets/Type=ChevronUp.svg");
}

body.dark-mode .brand-select {
    background-color: #FFFFFF !important;
    background-image: url("./assets/Type=ChevronDown.svg") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px 18px !important;
    border-color: #E5E7EB !important;
    color: #364153 !important;
    filter: none;
}

body.dark-mode .brand-select.open {
    background-image: url("./assets/Type=ChevronUp.svg") !important;
    filter: none;
}

body.dark-mode .brand-select option {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    filter: none;
}

body.dark-mode .brand-select option:checked,
body.dark-mode .brand-select option:hover {
    background: #0081FF !important;
    color: #FFFFFF !important;
}

/* Hide default select arrow in all browsers */
.brand-select::-ms-expand {
    display: none;
}

.brand-select::-webkit-scrollbar {
    display: none;
}

.brand-select {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* React Flow Minimap */
.react-flow__minimap {
    bottom: 20px !important;
    right: 7px !important;
    margin-bottom: 95px !important;
}

/* Minimap Size Control */
.minimap-size-control {
    position: absolute;
    bottom: 90px;
    right: 20px;
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px var(--shadow-color);
    z-index: 5;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.minimap-size-control:hover {
    opacity: 1;
}

.minimap-size-control input[type="range"] {
    width: 80px;
    height: 3px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    transform: scaleX(-1);
}

.minimap-size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.minimap-size-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.minimap-size-control input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.minimap-size-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}
/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 24px;
}

.modal pre {
    background: #ffffff;
    color: #000000;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid #e0e0e0;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal button.primary {
    background: var(--primary-color);
    color: white;
}

.modal button.primary:hover {
    filter: brightness(1.1);
}

.modal button.secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e0e0;
}

.modal button.secondary:hover {
    background: #e9ecef;
}

/* Edge Context Menu */
.edge-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(0,0,0,0.1);
}

.edge-menu {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    width: 364px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideIn 0.2s ease-out;
}
.edge-menu-connection-type {
    width: 320px;
}

.edge-menu-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.edge-menu-header strong {
    font-size: 15px;
    font-weight: 600;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 20px;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    width: 28px;
    height: 28px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.edge-menu-content {
    padding: 16px;
}

.edge-menu-section {
    margin-bottom: 20px;
    position: relative;
    overflow: visible;
}

.edge-menu-section:last-child {
    margin-bottom: 0;
}

.edge-menu-label {
    font-size: 11px;
    color: var(--primary-color);
    padding: 0 0 8px 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.edge-notes-wrapper {
    position: relative;
    overflow: visible;
}

.edge-notes-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    transition: all 0.2s;
    background-color: #FFF8A7;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: visible;
    min-height: 80px;
    line-height: 1.4;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.edge-notes-input:focus {
    outline: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.edge-notes-input::placeholder {
    color: #666;
}

/* Bottom-left folded paper corner - back side */
.edge-notes-wrapper::before {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    border-color: transparent transparent #E8D98F transparent;
    z-index: 1;
    transform: rotate(270deg);
    pointer-events: none;
}

/* Bottom-left folded paper corner - shadow */
.edge-notes-wrapper::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: -1px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 22px 22px;
    background-color: #fff;
    border-color: transparent transparent rgba(0, 0, 0, 0.12) transparent;
    z-index: 0;
    transform: rotate(270deg) translate(-1px, 1px);
    pointer-events: none;
}

.edge-menu-item {
    width: 100%;
    padding: 12px 14px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
    font-weight: 500;
}

.edge-menu-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateX(2px);
}

.edge-menu-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.edge-menu-item .connection-indicator {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 10px;
}

.edge-menu-item.active .connection-indicator {
    background: white !important;
    opacity: 0.9;
}

.edge-menu-reconnect {
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(67, 233, 123, 0.3);
}

.edge-menu-reconnect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 233, 123, 0.4);
}

.edge-menu-delete {
    width: 100%;
    padding: 12px 14px;
    background: white;
    border: 2px solid #ffcdd2;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #d32f2f;
    font-weight: 600;
    transition: all 0.2s;
}

.edge-menu-delete:hover {
    background: #ffebee;
    border-color: #ef5350;
    transform: translateX(2px);
}

/* Node Menu Close Icon Dark Mode */
body.dark-mode .node-menu-close-icon {
    filter: brightness(0) invert(1);
}

/* Edge Menu Close Icon Dark Mode */
body.dark-mode .edge-menu-close-icon {
    filter: brightness(0) invert(1);
}

/* React Flow Custom Controls */
.react-flow__controls {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.react-flow__controls-button {
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.react-flow__controls-button:hover {
    background: #f8f9fa;
}

/* React Flow Attribution */
.react-flow__attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #333 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    position: fixed !important;
    bottom: 20px !important;
    left: 27% !important;
    z-index: 1000 !important;
}

.react-flow__attribution a {
    color: #667eea !important;
    text-decoration: none !important;
}

.react-flow__attribution a:hover {
    text-decoration: underline !important;
}

body.dark-mode .react-flow__attribution {
    background: rgba(35, 38, 45, 0.9) !important;
    color: #e8eaed !important;
    border: 1px solid var(--border-color) !important;
}

body.dark-mode .react-flow__attribution a {
    color: #667eea !important;
}

/* Instructions Panel */
.instructions {
    background: #f0f2ff;
    border: 1px solid #d4d9ff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.instructions strong {
    color: #667eea;
    display: block;
    margin-bottom: 4px;
}

/* Settings Control Card */
.settings-control {
    width: 100%;
    max-width: 332px;
    height: 68px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-control:hover {
    border-color: #D1D5DC;
}

.settings-control-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.settings-control-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.4;
    margin-bottom: 4px;
}

.settings-control-description {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-tertiary);
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* Toggle Switch */
.settings-toggle {
    width: 44px;
    height: 24px;
    border-radius: 99px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
    background: #D1D5DC;
}

.settings-toggle.active {
    background: #FF5C35;
}

.settings-toggle-handle {
    width: 20px;
    height: 20px;
    background: #FFFFFF;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-toggle.active .settings-toggle-handle {
    transform: translateX(20px);
}

/* Bottom Navigation */
.bottom-navigation {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: fit-content;
    height: 62px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    z-index: 2000;
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

/* Resize Button */
.resize-button {
    width: 42px;
    height: 42px;
    background: #F6F6F6;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.resize-button:hover {
    background: #E8E8E8;
}

.resize-button svg {
    width: 24px;
    height: 24px;
    color: #364153;
    stroke: #364153;
}

/* Theme Toggle Button */
.theme-toggle-button {
    background: #281A47;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #FFFFFF;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    height: 52px;
}

.theme-toggle-button:hover {
    background: #1F1335;
}

.theme-toggle-button img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* How it Works Button */
.how-it-works-button {
    width: 200px;
    height: 40px;
    background: #0081FF;
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #FFFFFF;
    box-sizing: border-box;
}

.how-it-works-button:hover {
    background: #0066CC;
}

.how-it-works-button svg {
    width: 24px;
    height: 24px;
    color: #FFFFFF;
    flex-shrink: 0;
    stroke: #FFFFFF;
}

.toolbar .clear-button,
.clear-button {
    width: 90px;
    height: 38px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #FB2C36 !important;
    background-color: #FFFFFF !important;
    border: 1px solid #FB2C36 !important;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.2s;
}

.toolbar .clear-button:hover,
.clear-button:hover {
    background-color: #FFE6E8 !important;
    border-color: #FB2C36 !important;
    filter: none;
    transform: none;
}

.clear-button img {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    filter: brightness(0) saturate(100%) invert(27%) sepia(96%) saturate(7471%) hue-rotate(346deg) brightness(98%) contrast(98%);
    vertical-align: middle;
}

.clear-button:hover img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(96%) saturate(7471%) hue-rotate(346deg) brightness(98%) contrast(98%);
}

body.dark-mode .toolbar .clear-button,
body.dark-mode .clear-button {
    background-color: var(--bg-tertiary) !important;
    border-color: #FB2C36 !important;
    color: #FB2C36 !important;
}

body.dark-mode .toolbar .clear-button:hover,
body.dark-mode .clear-button:hover {
    background-color: #FFE6E8 !important;
    border-color: #FB2C36 !important;
}

body.dark-mode .clear-button img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(96%) saturate(7471%) hue-rotate(346deg) brightness(98%) contrast(98%);
}

.toolbar .clear-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
