:root {
    --primary-bg: #f8f9fa;
    --secondary-bg: #e9ecef;
    --toolbar-bg: #343a40;
    --text-color: #212529;
    --light-text: #f8f9fa;
    --border-color: #dee2e6;
    --accent-color: #007bff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --connection-color: #6c757d;
    --node-shadow: 0 4px 6px var(--shadow-color);
    --node-hover-shadow: 0 0 12px var(--accent-color);
    --leaf-bg: #ffffff;
    --leaf-border: #e1e5e9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
}
/* Text Box / Post-it Note Styles */
.text-box {
    position: absolute;
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.2s;
    z-index: 15;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.text-box:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.text-box.selected {
    box-shadow: 0 0 0 2px var(--accent-color), 0 6px 12px rgba(0, 0, 0, 0.2);
    z-index: 25;
}

.text-box:active {
    cursor: grabbing;
}
.text-box-text {
    font-size: 14px;
    line-height: 1.2;
    color: #333;
    word-wrap: break-word;
    overflow: hidden;
    height: 100%;
    width: 100%;
    /* Much more conservative scaling - starts at 14px, only shrinks when needed */
    font-size: min(14px, 8cqw, 12cqh);
    container-type: size;
}

.text-box-content {
    padding: 12px;
    height: 100%;
    position: relative;
    overflow: hidden;
    container-type: size;
}
.text-box-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
    color: #666;
}

.text-box:hover .text-box-delete {
    opacity: 1;
}

.text-box-delete:hover {
    background-color: #ff4757;
    color: white;
}

/* Color picker in modal */
.color-picker {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

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

.color-option.selected {
    border-color: var(--accent-color);
}

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

/* Update modal textarea */
.modal textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.modal textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.node-title {
    display: inline-block; /* Ensures proper centering with <br> */
    font-weight: bold;
}
body.dragging {
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
}

.app-container { display: flex; flex-direction: column; height: 100vh; }
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px; /* Increased height */
    background-color: #ffffff; /* White background */
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* Softer shadow */
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-button {
    background: transparent;
    border: 1px solid var(--border-color); /* Subtle border */
    color: var(--text-color);
    cursor: pointer;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 6px; /* Slightly more rounded */
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    font-size: 14px;
    font-weight: 500; /* Medium weight */
}

.toolbar-button:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.app-title {
    font-size: 1.3em; /* Slightly smaller */
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.canvas-container { flex-grow: 1; position: relative; background-color: var(--secondary-bg); overflow: hidden; }
.canvas { position: absolute; transform-origin: 0 0; }

/* Base node styles */
.node {
    position: absolute;
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.2s;
    z-index: 10;
    border-left: 5px solid transparent; /* Default transparent border */
}

.node:active { cursor: grabbing; }
.node.selected { box-shadow: var(--node-hover-shadow); z-index: 20; }

/* Parent nodes - card-like appearance */
.parent-node {
    background-color: var(--primary-bg);
    border-radius: 8px;
    box-shadow: var(--node-shadow);
    text-align: center;
}



.root-node {
    border-radius: 50%;
    padding: 30px;
    min-width: 225px;
    min-height: 225px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.root-node .node-title {
    font-size: 1.5em;
}

/* Leaf nodes - text-like appearance */
.leaf-node {
    padding: 2px 8px;
    background-color: var(--leaf-bg);
    border-radius: 4px;
    text-align: left;
    min-width: 150px; /* Wider */
    max-width: 300px;
    white-space: nowrap; /* Prevent wrapping */
}

.leaf-node:hover {
    background-color: rgba(0,0,0,0.05); /* Subtle hover effect */
}

/* Leaf node content layout */
.leaf-content {
    display: flex;
    align-items: center; /* Vertically center */
    gap: 8px;
}

.leaf-text {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

.leaf-node .node-title {
    font-size: 0.85em; /* Smaller text */
    font-weight: normal;
    line-height: 1.4;
}

.node-title.done { 
    text-decoration: none; 
    color: #6c757d; 
}

.node.done {
    background-color: #FFFACD; /* Light goldenrod yellow */
}

.node-subtitle { 
    font-size: 0.8em; 
    color: #6c757d; 
    margin-top: 4px; 
}

.leaf-node .node-subtitle {
    font-size: 0.75em;
    margin-top: 2px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toggle button on the left for leaf nodes */
.node-state-left {
    font-size: 1.1em;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.node-state-left:hover {
    transform: scale(1.2);
}

/* Regular node content (for parent nodes) */
.node-content { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

/* Connections */
.connection {
    position: absolute;
    height: 2px;
    transform-origin: 0 50%;
    z-index: 1;
}

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

.modal-content { 
    background-color: white; 
    padding: 25px; 
    border-radius: 8px; 
    width: 450px; 
    max-width: 95%; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}

.modal-header { 
    font-size: 1.4em; 
    font-weight: 600; 
    margin-bottom: 20px; 
}

.modal-body .form-group { 
    margin-bottom: 15px; 
}

.modal-footer { 
    display: flex; 
    justify-content: flex-end; 
    margin-top: 25px; 
}

.modal button { 
    padding: 10px 20px; 
    margin-left: 10px; 
    border: none; 
    border-radius: 5px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 500; 
}

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

.modal .secondary { 
    background-color: var(--secondary-bg); 
    color: var(--text-color); 
}

.modal input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    font-size: 14px; 
}

.modal input:focus { 
    outline: none; 
    border-color: var(--accent-color); 
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); 
}

.modal label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: 500; 
}

/* Other UI elements */
.file-input { 
    display: none; 
}

.toolbar-button i {
    font-size: 1.2em;
}

.zoom-display {
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.zoom-display:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.floating-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 1001;
}

.floating-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}

.instructions-popup {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.9em;
    max-width: 340px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.instructions-popup.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.instructions-popup h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.instructions-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-popup li {
    margin-bottom: 8px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #6c757d;
}

.close-btn:hover {
    color: #212529;
}

/* Atlas List Modal Styles - Add this to your styles.css */

.atlas-list-modal .modal-content {
    max-width: 600px;
    width: 90%;
}

.atlas-list-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.atlas-count {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: normal;
}

.atlas-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.atlas-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 10px;
    background-color: var(--primary-bg);
    transition: background-color 0.2s;
}

.atlas-item:hover {
    background-color: var(--secondary-bg);
}

.atlas-info {
    flex: 1;
}

.atlas-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.atlas-meta {
    font-size: 0.85em;
    color: #6c757d;
}

.atlas-actions {
    display: flex;
    gap: 8px;
}

.atlas-actions button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.load-atlas-btn {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.export-atlas-btn:hover {
    background-color: var(--secondary-bg);
}

.delete-atlas-btn:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}