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

body {
    background-color: #000;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#toolbar {
    background-color: #2a2a2a;
    padding: 10px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #3a3a3a;
}

#toolbar button {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
}

#toolbar button:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

#toolbar button:active {
    transform: translateY(1px);
}

#toolbar .separator {
    width: 1px;
    height: 24px;
    background-color: #3a3a3a;
    margin: 0 5px;
}

#mindmap-canvas {
    flex: 1;
    background-color: #000;
    cursor: grab;
}

#mindmap-canvas.grabbing {
    cursor: grabbing;
}

.tile {
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    min-width: 200px;
    min-height: 100px;
    position: absolute;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tile-header {
    height: 15px;
    border-radius: 8px 8px 0 0;
    cursor: move;
    position: relative;
}

.tile-controls {
    position: absolute;
    top: 20px;
    right: 5px;
    display: flex;
    gap: 5px;
}

.tile-control-btn {
    width: 24px;
    height: 24px;
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.tile-control-btn:hover {
    background-color: #4a4a4a;
}

.tile-content {
    padding: 35px 10px 10px 10px;
}

.tile-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    color: #e0e0e0;
    width: 100%;
}

.tile-title:focus {
    outline: 1px solid #5a5a5a;
    padding: 2px;
}

.tile-body {
    font-size: 14px;
    line-height: 1.5;
}

.tile.editing .tile-body {
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    padding: 5px;
    min-height: 60px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
}

.connection-line {
    stroke: #5a5a5a;
    stroke-width: 2;
    fill: none;
}

/* Tile Editor Styles */
.tile-editor {
    position: absolute;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    border-bottom: 1px solid #3a3a3a;
}

.color-picker-section {
    display: flex;
    gap: 5px;
    flex: 1;
    padding: 5px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-option:hover {
    border-color: #e0e0e0;
}

.color-option.selected {
    border-color: #fff;
}

.editor-close {
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
}

.editor-close:hover {
    color: #ff6b6b;
}

.editor-title {
    width: 100%;
    padding: 10px 15px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #3a3a3a;
    color: #e0e0e0;
    font-size: 18px;
    font-weight: 600;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.editor-content {
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.editor-content:focus {
    outline: none;
}

.editor-content[contenteditable]:empty::before {
    content: attr(placeholder);
    color: #666;
}

/* Constrain pasted formatted content */
.editor-content * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.editor-content img,
.editor-content video,
.editor-content iframe,
.editor-content object,
.editor-content embed {
    display: none !important;
}

.editor-content table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    margin: 6px 0;
}

.editor-content td,
.editor-content th {
    border: 1px solid #3a3a3a;
    padding: 4px 8px;
}

.editor-content pre,
.editor-content code {
    background: #1a1a1a;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 13px;
    white-space: pre-wrap;
}

.editor-content pre {
    padding: 8px;
    margin: 6px 0;
    overflow-x: auto;
}

.editor-content blockquote {
    border-left: 3px solid #4a90e2;
    padding-left: 10px;
    margin: 6px 0;
    color: #aaa;
}

.editor-content a {
    color: #4a90e2;
    text-decoration: underline;
}

.editor-content ul,
.editor-content ol {
    padding-left: 20px;
    margin: 4px 0;
}

.editor-content h1, .editor-content h2, .editor-content h3,
.editor-content h4, .editor-content h5, .editor-content h6 {
    margin: 6px 0 4px;
    line-height: 1.3;
}

.editor-content h1 { font-size: 1.3em; }
.editor-content h2 { font-size: 1.2em; }
.editor-content h3 { font-size: 1.1em; }

.checkbox-container {
    padding: 10px 15px;
    border-top: 1px solid #3a3a3a;
}

.add-checkbox {
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 10px;
}

.add-checkbox:hover {
    background-color: #4a4a4a;
}

.checkbox-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-item input[type="text"] {
    flex: 1;
    background: transparent;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    padding: 4px 8px;
    border-radius: 4px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.checkbox-item button {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 6px;
}

.checkbox-item button:hover {
    color: #ff6b6b;
}

.checkbox-item .checkbox-link-btn {
    color: #4a90e2;
    font-size: 12px;
    padding: 2px 4px;
}

.checkbox-item .checkbox-link-btn:hover {
    color: #6ab0ff;
}

/* Tile canvas controls overlay */
.tile-controls-overlay {
    position: absolute;
    display: none;
    gap: 5px;
    z-index: 100;
}

.tile-control {
    width: 24px;
    height: 24px;
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tile-control:hover {
    background-color: #4a4a4a;
}

/* Editor footer */
.editor-footer {
    padding: 10px 15px;
    border-top: 1px solid #3a3a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-button {
    background-color: #4a90e2;
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.save-button:hover {
    background-color: #357abd;
}

.connection-hint {
    font-size: 12px;
    color: #666;
}

/* Connection mode indicator */
.connection-mode-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4a90e2;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-toggle:hover {
    background-color: #4a4a4a;
    border-color: #5a5a5a;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    min-width: 200px;
    width: max-content;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-top: 4px;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e0e0e0;
    border-bottom: 1px solid #3a3a3a;
}

.dropdown-item:hover {
    background-color: #3a3a3a;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item.new-project {
    font-weight: 600;
    color: #4a90e2;
}

.dropdown-item .delete-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
}

.dropdown-item .delete-btn:hover {
    color: #ff5252;
}

/* Dialog styles */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.dialog-content {
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 30px;
    min-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.dialog-content h2 {
    color: #e0e0e0;
    margin-bottom: 20px;
    font-size: 24px;
}

.dialog-content input[type="text"] {
    width: 100%;
    padding: 12px;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 16px;
    margin-bottom: 20px;
}

.dialog-content input[type="text"]:focus {
    outline: none;
    border-color: #4a90e2;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dialog-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dialog-create, .dialog-import {
    background-color: #4a90e2;
    color: white;
}

.dialog-create:hover, .dialog-import:hover {
    background-color: #357abd;
}

.dialog-cancel {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
}

.dialog-cancel:hover {
    background-color: #4a4a4a;
}

.dialog-error {
    color: #ff6b6b;
    font-size: 14px;
    margin-top: 10px;
}

/* Custom color picker styles */
.custom-color-wrapper {
    position: relative;
}

.custom-color-wrapper:hover .custom-color-icon {
    border-color: #e0e0e0 !important;
}

.custom-color-icon {
    transition: border-color 0.2s ease;
}

.custom-color-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    border: none !important;
}

.custom-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Help dialog styles */
.help-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    color: #4a90e2;
    margin-bottom: 10px;
    font-size: 18px;
}

.help-section ul {
    list-style: none;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
    color: #e0e0e0;
}

.help-section strong {
    color: #fff;
    font-weight: 600;
}

.dialog-close {
    background-color: #4a90e2;
    color: white;
    padding: 10px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dialog-close:hover {
    background-color: #357abd;
}

/* Master/Parent container in tile editor */
.master-container {
    padding: 10px 15px;
    border-top: 1px solid #3a3a3a;
}

.master-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    color: #e0e0e0;
    font-size: 14px;
}

.master-label input[type="checkbox"] {
    cursor: pointer;
}

.parent-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.parent-select-row label {
    color: #e0e0e0;
    font-size: 14px;
}

.parent-select {
    flex: 1;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
}

.parent-select:focus {
    outline: none;
    border-color: #4a90e2;
}

/* Hierarchical dropdown styles */
.dropdown-item.has-children {
    position: relative !important;
}

.dropdown-item.has-children > .dropdown-arrow {
    margin-left: auto;
    padding-left: 10px;
    font-size: 10px;
    color: #888;
    flex-shrink: 0;
}

/* Submenu is appended to body and positioned via JS */
.dropdown-submenu {
    display: none;
    position: fixed;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1010;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dropdown-submenu.visible {
    display: block;
}

.dropdown-item .master-badge {
    background-color: #4a90e2;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Separator between masters and orphans in dropdown */
.dropdown-separator {
    height: 1px;
    background: linear-gradient(to right, transparent, #4a4a4a, transparent);
    margin: 8px 15px;
}

/* Assignment mode banner */
.assign-mode-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #6c63ff;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Delete dialog with options */
.delete-dialog-content {
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 30px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.delete-dialog-content h2 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 20px;
}

.delete-dialog-content p {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.delete-dialog-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delete-dialog-options button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.2s ease;
}

.delete-option-keep {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a !important;
}

.delete-option-keep:hover {
    background-color: #4a4a4a;
}

.delete-option-children {
    background-color: #ff9f43;
    color: white;
}

.delete-option-children:hover {
    background-color: #e8913d;
}

.delete-option-cascade {
    background-color: #ff6b6b;
    color: white;
}

.delete-option-cascade:hover {
    background-color: #e85a5a;
}

.delete-option-cancel {
    background-color: transparent;
    color: #888;
    border: 1px solid #3a3a3a !important;
    margin-top: 10px;
}

.delete-option-cancel:hover {
    background-color: #3a3a3a;
    color: #e0e0e0;
}

/* Toolbar assign button active state */
#assign-mode.active {
    background-color: #6c63ff;
    border-color: #8b83ff;
}