/* Reset & Base Canvas Styling */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f8fafc;
    user-select: none;
}

/* Infinite Dot Grid Background ala Figma/Miro */
#canvas-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    cursor: grab;
    background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 1.25px, transparent 1.25px);
    background-size: 24px 24px;
    touch-action: none;
}

#canvas-container.is-panning {
    cursor: grabbing;
}

/* Viewport / World Transform Layer */
#viewport {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

/* SVG Edges Layer */
#edges-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

/* Nodes Layer */
#nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* Node Card Styling & Transitions */
.family-node {
    position: absolute;
    width: 268px;
    border-radius: 16px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    cursor: grab;
    touch-action: none;
}

.family-node:hover {
    box-shadow: 0 20px 35px -8px rgba(15, 23, 42, 0.14), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
    z-index: 25;
}

.family-node.is-dragging {
    cursor: grabbing;
    box-shadow: 0 25px 45px -10px rgba(15, 23, 42, 0.22);
    z-index: 50 !important;
    transition: none !important;
}

.family-node.is-animating {
    transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), top 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Gender Theme Accents */
.family-node[data-gender="male"] {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 38%);
}
.family-node[data-gender="male"] .node-accent-bar {
    background-color: #3b82f6;
}

.family-node[data-gender="female"] {
    border-color: #fda4af;
    background: linear-gradient(180deg, #fff1f2 0%, #ffffff 38%);
}
.family-node[data-gender="female"] .node-accent-bar {
    background-color: #f43f5e;
}

.family-node[data-gender="neutral"] {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 38%);
}
.family-node[data-gender="neutral"] .node-accent-bar {
    background-color: #64748b;
}

/* Inline Editable Inputs */
.inline-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 2px 5px;
    margin: -2px -5px;
    width: calc(100% + 10px);
    transition: all 0.15s ease;
    user-select: text;
    cursor: text;
}

.inline-input:hover {
    background: rgba(241, 245, 249, 0.8);
    border-color: #e2e8f0;
}

.inline-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Custom Scrollbar for Toolbar on Small Screens */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Edge Path Animations */
.spouse-edge-path {
    stroke-dasharray: 6 5;
    animation: dashFlow 24s linear infinite;
}

@keyframes dashFlow {
    to {
        stroke-dashoffset: -220;
    }
}

/* Sorotan Visual Sementara (2 Detik) saat Kartu Ditemukan dari Pencarian */
@keyframes targetFocusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.72), 0 20px 35px -8px rgba(15, 23, 42, 0.18);
        border-color: #4f46e5;
    }
    35% {
        box-shadow: 0 0 0 14px rgba(99, 102, 241, 0.16), 0 25px 45px -10px rgba(79, 70, 229, 0.28);
        border-color: #4f46e5;
    }
    70% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.35), 0 20px 35px -8px rgba(15, 23, 42, 0.16);
        border-color: #6366f1;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0), 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    }
}

.family-node.search-highlight-ring {
    animation: targetFocusPulse 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    z-index: 45 !important;
}
