/* MindMeister-style CSS - Refined */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
}

.mindmap-container {
    width: 100vw;
    height: 100vh;
    background: #fff;
    position: relative;
    overflow: hidden;
}


.mindmap-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
    position: absolute;
    transform-origin: 0 0;

    /* Grid Pattern */
    background-color: #f8f9fa;
    background-image:
        linear-gradient(#e1e4e8 1px, transparent 1px),
        linear-gradient(90deg, #e1e4e8 1px, transparent 1px);
    background-size: 40px 40px;
    /* Base size */
    background-position: 0 0;
}

.mindmap-canvas:active {
    cursor: grabbing;
}

/* Control Buttons */
.mindmap-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* NODES */
.mm-node {
    position: absolute;
    padding: 8px 12px;
    border-radius: 25px;
    background: white;
    border: 2px solid #ccc;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    max-width: 350px;
    /* Standardize Width */
    transform: translate(-50%, -50%);
    white-space: nowrap;
    /* Force single line */
}

.mm-node:hover {
    transform: translate(-50%, -50%) scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.mm-node.root {
    padding: 15px 25px;
    background: #333;
    color: #fff;
    border-color: #333;
    z-index: 15;
    font-size: 16px;
    min-width: 220px;
}

/* Content */
.mm-node-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    position: relative;
}

/* Added relative */
.mm-main-info {
    width: 100%;
}

.mm-name {
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-node-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-color: #eee;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.root .mm-node-avatar {
    width: 40px;
    height: 40px;
}

/* ACTION BUTTONS - TOP RIGHT FLOATING */
.mm-actions {
    display: none;
    /* Hidden default */
    position: absolute;
    top: -24px;
    /* Lifted higher */
    right: -20px;
    /* Pushed further right */
    background: white;
    padding: 3px;
    border-radius: 50px;
    /* Fully rounded capsule */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #f0f0f0;
    gap: 4px;
    z-index: 101;
    animation: bounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mm-node:hover .mm-actions {
    display: flex;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(5px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.action-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 12px;
}

.action-btn:hover {
    background: #3498db;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn.edit-btn:hover {
    background: #f39c12;
}

.action-btn.add-btn:hover {
    background: #2ecc71;
}

/* SPOUSE NODES specifically */
.mm-spouse-node {
    /* Identical sizing to main node */
    min-width: 200px;
    max-width: 350px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    z-index: 9;
    /* Slightly below main */
}

.mm-spouse-node .mm-node-avatar {
    width: 32px;
    height: 32px;
}

/* Heart Connector */
.mm-connection-heart {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    border: 1px solid #ddd;
    color: #ff4757;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transform: translate(-50%, -50%);
    /* Centered on coord */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Toggles */
.mm-toggle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
}

.mm-toggle.toggle-right {
    right: -12px;
}

.mm-toggle.toggle-left {
    left: -12px;
}

/* Connectors */
#connections-layer {
    pointer-events: none;
}

.spouse-link {
    stroke-dasharray: 4;
}

/* Deceased Member Style */
.mm-node.deceased {
    background-color: #f2f2f2;
    color: #888;
    border-color: #bbb !important;
}

.mm-node.deceased .mm-node-avatar {
    filter: grayscale(100%);
    opacity: 0.8;
}

.mm-node.deceased .mm-name {
    color: #666;
}

/* View Member Modal Styling */
.view-card {
    border-radius: 20px;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.view-header-bg {
    height: 120px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    position: relative;
    clip-path: ellipse(150% 100% at 50% 0%);
}

.view-body {
    padding: 0 30px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    top: -50px;
    position: relative;
}

.view-avatar-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background: #fff;
    overflow: hidden;
    margin-bottom: 15px;
}

.view-avatar {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #eee;
}

.view-name {
    margin: 10px 0 5px;
    font-weight: 700;
    color: #2d3436;
    text-align: center;
}

.view-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.view-dates-section {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.date-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.date-group small {
    color: #636e72;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.date-group strong {
    font-size: 16px;
    color: #2d3436;
}

.luna-date {
    font-size: 12px;
    color: #888;
    font-style: italic;
}

.view-details-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #636e72;
    border-bottom: 1px solid #f1f2f6;
    padding-bottom: 8px;
}

.detail-row i {
    width: 20px;
    text-align: center;
}

.detail-row strong {
    color: #2d3436;
    margin-left: auto;
}

.view-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    color: white;
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.view-close-btn:hover {
    opacity: 1;
    color: white;
}

/* Modal Form Consistency Fixes */
.form-control,
.form-control option {
    height: 45px !important;
    line-height: normal;
}

textarea.form-control {
    height: auto !important;
}

.modal-xl {
    max-width: 95vw !important;
}