body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    padding: 20px;
    margin: 0;
    position: relative; /* Needed for absolute positioning of lines */
}

.controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.controls input, .controls select, .controls button {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#tree-container {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    overflow-x: auto;
    white-space: nowrap;
    position: relative; /* Needed for positioning lines within the container */
}

/* Person card styling */
.person {
    display: inline-block;
    vertical-align: top;
    text-align: center;
    margin: 15px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: #e9f5ff;
    border: 1px solid #cceeff;
    position: relative; /* Needed for positioning lines relative to person */
    z-index: 1; /* Ensure people are above lines */
}

.person-name {
    font-weight: bold;
    margin-bottom: 5px;
    cursor: pointer;
}

.person-id {
    font-size: 0.8em;
    color: #666;
}

/* Relationship display for spouses/partners */
.spouses-display {
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}

.children-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 15px;
}

/* Line styling */
.line {
    position: absolute;
    background-color: #888;
    z-index: 0; /* Lines should be behind people */
}

.line.vertical {
    width: 2px;
}

.line.horizontal {
    height: 2px;
}

/* Person Details Panel */
#person-details-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
    z-index: 1000; /* Ensure it's on top */
    max-width: 400px;
    width: 90%;
}

#person-details-panel h2 {
    margin-top: 0;
    color: #007bff;
}

#person-details-panel div {
    margin-bottom: 10px;
}

#person-details-panel label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#person-details-panel input[type="text"],
#person-details-panel textarea {
    width: calc(100% - 18px); /* Account for padding */
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#person-details-panel button {
    padding: 10px 15px;
    margin-right: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#saveDetailsBtn {
    background-color: #28a745;
    color: white;
}

#closeDetailsBtn {
    background-color: #dc3545;
    color: white;
}

.hidden {
    display: none;
}
