/* ============================================
           STYLES POUR LES NOUVELLES VISUALISATIONS
           ============================================ */

/* Canvas pour les visualisations */
.visualization-canvas {
    width: 100%;
    height: 750px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Mindmap Styles */
/* Mindmap Styles */
.mindmap-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.mindmap-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mindmap-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.mindmap-list {
    flex: 1;
    overflow-y: auto;
}

.mindmap-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mindmap-item:hover {
    background: rgba(212, 175, 55, 0.1);
}

.mindmap-item.active {
    background: rgba(212, 175, 55, 0.2);
    border-left: 3px solid var(--accent-gold);
}

.mindmap-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.mindmap-toolbar {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.mindmap-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
    background-image:
        linear-gradient(90deg, rgba(var(--accent-gold-rgb), 0.1) 1px, transparent 1px),
        linear-gradient(rgba(var(--accent-gold-rgb), 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    touch-action: none;
    /* Prevent scroll during mindmap pan/drag without passive:false JS listener */
}

.mindmap-canvas {
    width: 6000px;
    height: 6000px;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    cursor: grab;
}

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

.mindmap-canvas.linking {
    cursor: crosshair;
}

/* Zoom Controls */
.mindmap-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1000;
}

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

.mindmap-zoom-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.mindmap-zoom-level {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 8px;
    min-width: 50px;
    text-align: center;
}

.mindmap-node {
    position: absolute;
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    cursor: move;
    box-shadow: 0 2px 8px var(--shadow);
    width: 180px;
    overflow-wrap: break-word;
    user-select: none;
    transition: box-shadow 0.2s ease;
}

.mindmap-node:hover {
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    z-index: 10;
}

.mindmap-node.selected {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.2);
}

.mindmap-node.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.mindmap-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.mindmap-node-icon {
    font-size: 1.2rem;
}

.mindmap-node-title {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mindmap-node-delete {
    opacity: 0;
    cursor: pointer;
    color: var(--accent-red);
    font-size: 1.2rem;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.mindmap-node:hover .mindmap-node-delete {
    opacity: 1;
}

.mindmap-node-link-btn {
    opacity: 0;
    cursor: pointer;
    color: var(--accent-gold);
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.2s ease;
    margin-right: 0.25rem;
}

.mindmap-node:hover .mindmap-node-link-btn {
    opacity: 1;
}

.mindmap-node-link-btn:hover {
    transform: scale(1.2);
}

.mindmap-node.linking-source {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.3);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(196, 69, 54, 0.1);
    }
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.mindmap-canvas-wrapper.linking-mode {
    cursor: crosshair;
}

.mindmap-canvas-wrapper.linking-mode .mindmap-node:not(.linking-source) {
    cursor: pointer;
}

.mindmap-canvas-wrapper.linking-mode .mindmap-node:not(.linking-source):hover {
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.5);
    border-color: var(--accent-blue);
}

.mindmap-node-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mindmap-node.type-character {
    border-color: var(--accent-red);
    background: rgba(var(--accent-red-rgb), 0.05);
}

.mindmap-node.type-element {
    border-color: var(--accent-green);
    background: rgba(var(--accent-green-rgb), 0.05);
}

.mindmap-node.type-scene {
    border-color: var(--accent-blue);
    background: rgba(var(--accent-blue-rgb), 0.05);
}

.mindmap-node.type-note {
    border-color: var(--accent-gold);
    background: var(--bg-primary);
}

.mindmap-node.type-codex {
    border-color: var(--accent-purple);
    background: rgba(var(--accent-purple-rgb), 0.05);
}

.mindmap-node.type-act {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.08);
}

.mindmap-node.type-chapter {
    border-color: var(--accent-blue);
    background: rgba(var(--accent-blue-rgb), 0.05);
}

.mindmap-link-line {
    position: absolute;
    pointer-events: stroke;
    cursor: pointer;
}

.mindmap-link-label {
    position: absolute;
    padding: 0.25rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.mindmap-library {
    width: 250px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mindmap-library.collapsed {
    width: 40px;
}

.mindmap-library-toggle {
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 1.2rem;
}

.mindmap-library-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.mindmap-library.collapsed .mindmap-library-tabs {
    display: none;
}

.mindmap-library-tab {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    border-right: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.mindmap-library-tab:last-child {
    border-right: none;
}

.mindmap-library-tab:hover {
    background: rgba(212, 175, 55, 0.1);
}

.mindmap-library-tab.active {
    background: var(--accent-gold);
    color: white;
    font-weight: 600;
}

.mindmap-library-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.mindmap-library.collapsed .mindmap-library-content {
    display: none;
}

.mindmap-library-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mindmap-library-item:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 2px 8px var(--shadow);
}

.mindmap-library-item:active {
    cursor: grabbing;
}

.mindmap-library-item-icon {
    font-size: 1.2rem;
}

.mindmap-library-item-text {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mindmap-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}

.mindmap-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}