/* Mindmap Builder - Modern CSS Styles */
:root {
    --bg-color: #f8fafc;
    --primary-color: #4F46E5;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

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

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.control-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: white;
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.control-select:hover {
    border-color: var(--primary-color);
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Toolbar */
.toolbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    overflow-x: auto;
    z-index: 99;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: white;
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.toolbar-btn.primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.toolbar-btn.danger {
    color: #ef4444;
    border-color: #fecaca;
}

.toolbar-btn.danger:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Canvas */
.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-color);
    overflow: hidden;
}

.mindmap-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

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

.node-group {
    cursor: move;
    transition: transform 0.1s ease;
}

.node-rect {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: all 0.2s;
}

.node-rect:hover {
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
}

.connection {
    pointer-events: none;
    opacity: 0.6;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #f1f5f9;
}

.zoom-btn svg {
    width: 20px;
    height: 20px;
}

.zoom-level {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    min-width: 50px;
    text-align: center;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    z-index: 1000;
    min-width: 150px;
}

.context-menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f1f5f9;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Modal */
.modal {
    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: 1001;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    min-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.node-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.node-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.color-picker {
    margin-bottom: 1.5rem;
}

.color-picker span {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.color-options {
    display: flex;
    gap: 0.5rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-color);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-color);
}

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: white;
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: #f1f5f9;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn.primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

/* Shortcuts Help */
.shortcuts-help {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 100;
}

.shortcuts-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.shortcuts-toggle:hover {
    transform: scale(1.1);
    background: #4338ca;
}

.shortcuts-list {
    position: absolute;
    bottom: 50px;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    min-width: 250px;
}

.shortcuts-list h4 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 1rem;
}

.shortcuts-list ul {
    list-style: none;
}

.shortcuts-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-color);
}

.shortcuts-list kbd {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    min-width: 60px;
    text-align: center;
}

/* Theme: Dark */
.theme-dark {
    --bg-color: #0f172a;
    --primary-color: #6366f1;
    --text-color: #f1f5f9;
    --border-color: #334155;
}

.theme-dark .header,
.theme-dark .toolbar,
.theme-dark .control-select,
.theme-dark .toolbar-btn:not(.primary),
.theme-dark .zoom-controls,
.theme-dark .context-menu,
.theme-dark .modal-content,
.theme-dark .shortcuts-list,
.theme-dark .btn:not(.primary) {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

.theme-dark .toolbar-btn:not(.primary):hover,
.theme-dark .zoom-btn:hover,
.theme-dark .context-menu-item:hover,
.theme-dark .btn:not(.primary):hover {
    background: #334155;
}

.theme-dark .node-input {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

.theme-dark .shortcuts-list kbd {
    background: #334155;
    border-color: #475569;
}

/* Theme: Nature */
.theme-nature {
    --bg-color: #f0fdf4;
    --primary-color: #10b981;
    --text-color: #064e3b;
    --border-color: #86efac;
}

/* Theme: Ocean */
.theme-ocean {
    --bg-color: #f0f9ff;
    --primary-color: #0ea5e9;
    --text-color: #0c4a6e;
    --border-color: #7dd3fc;
}

/* Theme: Sunset */
.theme-sunset {
    --bg-color: #fef3c7;
    --primary-color: #f59e0b;
    --text-color: #78350f;
    --border-color: #fcd34d;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .header-controls {
        justify-content: center;
    }

    .toolbar {
        padding: 0.5rem;
        gap: 1rem;
    }

    .toolbar-btn span {
        display: none;
    }

    .toolbar-btn {
        padding: 0.5rem;
    }

    .modal-content {
        min-width: 90%;
        margin: 1rem;
    }

    .shortcuts-help {
        bottom: 1rem;
        left: 1rem;
    }

    .zoom-controls {
        bottom: 1rem;
        right: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-group {
    animation: fadeIn 0.3s ease;
}

/* Print styles */
@media print {
    .header,
    .toolbar,
    .zoom-controls,
    .shortcuts-help {
        display: none;
    }

    .canvas-container {
        background: white;
    }
}