/* Mind Map Styles - Hand-drawn aesthetic */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #b5836d;
    --node-bg: #f5f0e6;
    --node-border: #3d2c24;
    --text-color: #2d1f1a;
    --line-color: #3d2c24;
    --hover-glow: rgba(245, 240, 230, 0.4);
    --panel-bg: #f5f0e6;
    --font-handwritten: 'Caveat', cursive;
    --font-hand: 'Patrick Hand', cursive;
    --font-display: 'Walter Turncoat', cursive;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-hand);
    overflow: hidden;
    min-height: 100vh;
    cursor: grab;
}

body.dragging {
    cursor: grabbing;
}

#mindmap-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Canvas - the draggable surface */
.canvas {
    position: absolute;
    width: 300vw;
    height: 300vh;
    top: -100vh;
    left: -100vw;
    transition: none;
    transform-origin: center center;
}

.canvas.animate {
    transition: transform 0.1s ease-out;
}

/* SVG Connections Layer */
#connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: var(--line-color);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hand-drawn effect for lines */
.connection-path {
    stroke: var(--line-color);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.connection-arrow {
    stroke: var(--line-color);
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Nodes Container */
#nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Individual Nodes */
.node {
    position: absolute;
    background: var(--node-bg);
    border: 3px solid var(--node-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.node:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 15px var(--hover-glow), 3px 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.node.active {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 25px var(--hover-glow), 3px 5px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.node-label {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px;
    line-height: 1.1;
    white-space: nowrap;
}

/* Node sizes */
.node.size-xl {
    width: 180px;
    height: 180px;
    font-size: 28px;
}

.node.size-lg {
    width: 130px;
    height: 130px;
    font-size: 18px;
}

.node.size-md {
    width: 100px;
    height: 100px;
    font-size: 15px;
}

.node.size-sm {
    width: 80px;
    height: 80px;
    font-size: 13px;
}

.node.size-xs {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

/* Decorative small nodes (no labels, just visual connectors) */
.node.decorator {
    width: 24px;
    height: 24px;
    cursor: default;
    border-width: 2px;
}

.node.decorator:hover {
    transform: translate(-50%, -50%);
    box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.15);
}

/* Category colors - subtle tints */
.node.category-main {
    background: var(--node-bg);
}

.node.category-creative {
    background: linear-gradient(145deg, #f5f0e6 0%, #fff0e6 100%);
}

.node.category-nature {
    background: linear-gradient(145deg, #f5f0e6 0%, #e6f5ec 100%);
}

.node.category-library {
    background: linear-gradient(145deg, #f5f0e6 0%, #e6ecf5 100%);
}

/* Content Panel */
#content-panel {
    position: fixed;
    top: 0;
    right: -50vw;
    width: 50vw;
    height: 100vh;
    background: var(--panel-bg);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    padding: 40px;
    font-family: var(--font-hand);
}

#content-panel.visible {
    right: 0;
}

#content-panel.hidden {
    right: -50vw;
}

#close-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 3px solid var(--node-border);
    background: var(--node-bg);
    border-radius: 50%;
    font-size: 32px;
    font-family: Arial, sans-serif;
    font-weight: 300;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    line-height: 1;
    padding-bottom: 4px;
}

#close-panel:hover {
    transform: scale(1.1);
    background: #e8e0d0;
}

#panel-content {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 18px;
}

#panel-content h1 {
    font-family: var(--font-display);
    font-size: 2.5em;
    font-weight: 400;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--node-border);
    padding-bottom: 15px;
}

#panel-content .subtitle {
    font-family: var(--font-hand);
    font-size: 1.1em;
    color: var(--text-color);
    margin-bottom: 20px;
}

#panel-content h2 {
    font-family: var(--font-display);
    font-size: 1.8em;
    font-weight: 400;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--node-border);
}

#panel-content h3 {
    font-family: var(--font-handwritten);
    font-size: 1.4em;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
}

#panel-content p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

#panel-content ul, #panel-content ol {
    margin-left: 25px;
    margin-bottom: 15px;
}

#panel-content li {
    margin-bottom: 8px;
}

#panel-content a {
    color: #8b5a3c;
    text-decoration: none;
    border-bottom: 2px dashed #8b5a3c;
}

#panel-content a:hover {
    color: var(--node-border);
    border-bottom-style: solid;
}

#panel-content blockquote {
    font-family: var(--font-handwritten);
    font-size: 1.3em;
    border-left: 4px solid var(--node-border);
    padding-left: 20px;
    margin: 25px 0;
    font-style: normal;
}

#panel-content blockquote footer {
    font-family: var(--font-hand);
    font-size: 0.75em;
    margin-top: 10px;
    font-weight: 600;
}

/* Loading indicator */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-family: var(--font-handwritten);
    font-size: 1.5em;
    color: #888;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--node-border);
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Sub-nodes navigation in panel */
.sub-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.sub-nav-item {
    background: var(--bg-color);
    color: var(--node-bg);
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.3em;
    font-weight: 400;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 3px solid var(--node-border);
    cursor: pointer;
}

.sub-nav-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    #content-panel {
        width: 70vw;
        right: -70vw;
    }
    
    #content-panel.hidden {
        right: -70vw;
    }
}

@media (max-width: 768px) {
    #content-panel {
        width: 100vw;
        right: -100vw;
        padding: 20px;
    }
    
    #content-panel.hidden {
        right: -100vw;
    }
    
    .node.size-xl {
        width: 130px;
        height: 130px;
        font-size: 20px;
    }
    
    .node.size-lg {
        width: 100px;
        height: 100px;
        font-size: 16px;
    }
    
    .node.size-md {
        width: 80px;
        height: 80px;
        font-size: 14px;
    }
}

/* Entry animation */
.node {
    opacity: 0;
    animation: nodeAppear 0.5s ease forwards;
}

@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.node:nth-child(1) { animation-delay: 0.1s; }
.node:nth-child(2) { animation-delay: 0.12s; }
.node:nth-child(3) { animation-delay: 0.14s; }
.node:nth-child(4) { animation-delay: 0.16s; }
.node:nth-child(5) { animation-delay: 0.18s; }
.node:nth-child(6) { animation-delay: 0.20s; }
.node:nth-child(7) { animation-delay: 0.22s; }
.node:nth-child(8) { animation-delay: 0.24s; }
.node:nth-child(9) { animation-delay: 0.26s; }
.node:nth-child(10) { animation-delay: 0.28s; }
.node:nth-child(11) { animation-delay: 0.30s; }
.node:nth-child(12) { animation-delay: 0.32s; }
.node:nth-child(13) { animation-delay: 0.34s; }
.node:nth-child(14) { animation-delay: 0.36s; }
.node:nth-child(15) { animation-delay: 0.38s; }
.node:nth-child(16) { animation-delay: 0.40s; }
.node:nth-child(17) { animation-delay: 0.42s; }
.node:nth-child(18) { animation-delay: 0.44s; }

/* Connection line animation */
.connection-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 1s ease forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--node-border);
    border-radius: 6px;
    border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background: #2d1f1a;
}

/* Selection color */
::selection {
    background-color: var(--node-border);
    color: var(--node-bg);
}

/* Drag hint */
.drag-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(61, 44, 36, 0.8);
    color: var(--node-bg);
    padding: 10px 20px;
    border-radius: 20px;
    font-family: var(--font-hand);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 50;
}

.drag-hint.visible {
    opacity: 1;
}

/* Recipe and content cards */
.content-card {
    background: rgba(181, 131, 109, 0.15);
    border: 2px solid var(--node-border);
    border-radius: 15px;
    padding: 20px;
    margin: 15px 0;
}

.tag {
    display: inline-block;
    background: var(--bg-color);
    color: var(--node-bg);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.9em;
    margin: 4px;
    font-family: var(--font-handwritten);
}
