/* Global styles and CSS variables */
:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f8f9fa;
    --surface-color: #fff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    overflow: hidden;
    line-height: 1.5;
}

/* Toolbar styles */
.toolbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: flex;
    gap: 4px;
    z-index: 1000;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.toolbar button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    transform: translateY(-1px);
}

.toolbar button:active {
    transform: scale(0.95);
}

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

.toolbar button::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.toolbar button:hover::before {
    opacity: 1;
}

.toolbar .separator {
    width: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 0 4px;
}

.toolbar button:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.toolbar button:active:after {
    animation: ripple 0.4s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Mind map container */
#mindmap-container {
    width: 100vw;
    height: 100vh;
    cursor: grab;
    background: linear-gradient(135deg, var(--background-color) 0%, #fff 100%);
}

#mindmap-container:active {
    cursor: grabbing;
}

/* Node styles */
.node circle {
    fill: var(--surface-color);
    stroke: var(--primary-color);
    stroke-width: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.node:hover circle {
    filter: brightness(1.1);
    cursor: pointer;
}

.node.selected circle {
    filter: brightness(1.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.node-label {
    font-size: 12px;
    fill: var(--text-color);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    transition: all var(--transition-normal);
}

.node:hover .node-label {
    font-weight: 500;
}

/* Link styles */
.link {
    stroke: #ccc;
    stroke-width: 2px;
    stroke-opacity: 0.6;
    transition: stroke 0.2s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.link:hover {
    stroke: var(--primary-color);
    stroke-width: 2px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: opacity var(--transition-normal);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.modal h2 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-group input[type="color"] {
    height: 40px;
    padding: 4px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.form-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.form-actions button[type="button"] {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-light);
}

.form-actions button[type="button"]:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.form-actions button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
}

.form-actions button[type="submit"]:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.form-actions button[type="submit"]:active {
    transform: translateY(0);
}

/* Loading indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.loading.active {
    display: block;
}

.loading:after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .toolbar {
        top: auto;
        bottom: 20px;
        flex-wrap: wrap;
        justify-content: center;
        max-width: calc(100% - 40px);
    }

    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.fade-in {
    animation: fadeIn var(--transition-normal);
}

.scale-in {
    animation: scaleIn var(--transition-normal);
}

/* Tooltip styles */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
} 