/* Mindmap Container */
.mindmap-container {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mindmap-canvas {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.mindmap-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Mindmap Nodes */
.mindmap-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.mindmap-node:hover circle {
    stroke-width: 3;
    filter: brightness(1.1);
}

.mindmap-node.node-selected circle {
    stroke: #ff9800;
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(255, 152, 0, 0.6));
}

.mindmap-node text {
    pointer-events: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500;
}

/* Mindmap Links */
.mindmap-link {
    transition: all 0.3s ease;
}

.mindmap-link:hover {
    stroke: #666;
    stroke-width: 3;
}

/* Toolbar */
.mindmap-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mindmap-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 60px;
}

.mindmap-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

.mindmap-btn:active {
    transform: translateY(0);
}

.mindmap-btn[data-action="add-node"] {
    background: #4CAF50;
}

.mindmap-btn[data-action="add-node"]:hover {
    background: #45a049;
}

.mindmap-btn[data-action="delete-node"] {
    background: #f44336;
}

.mindmap-btn[data-action="delete-node"]:hover {
    background: #d32f2f;
}

.mindmap-btn[data-action="save"] {
    background: #FF9800;
}

.mindmap-btn[data-action="save"]:hover {
    background: #F57C00;
}

.mindmap-btn[data-action="export"] {
    background: #9C27B0;
}

.mindmap-btn[data-action="export"]:hover {
    background: #7B1FA2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mindmap-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mindmap-btn {
        width: 100%;
        margin: 2px 0;
    }
    
    .mindmap-container {
        height: 400px !important;
    }
}

/* Loading State */
.mindmap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 16px;
}

.mindmap-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Error State */
.mindmap-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #f44336;
    font-size: 16px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    margin: 10px;
}

/* Node Types */
.mindmap-node[data-type="root"] circle {
    fill: #4CAF50;
    r: 40;
}

.mindmap-node[data-type="branch"] circle {
    fill: #2196F3;
    r: 30;
}

.mindmap-node[data-type="leaf"] circle {
    fill: #FF9800;
    r: 25;
}

/* Animation for new nodes */
@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mindmap-node-new {
    animation: nodeAppear 0.3s ease-out;
}

/* Zoom and Pan Controls */
.mindmap-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mindmap-zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s ease;
}

.mindmap-zoom-btn:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Fullscreen Mode */
.mindmap-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Print Styles */
@media print {
    .mindmap-toolbar,
    .mindmap-controls {
        display: none !important;
    }
    
    .mindmap-container {
        border: none;
        box-shadow: none;
        page-break-inside: avoid;
    }
}
