* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    padding: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f0f8ff;
    border-radius: 5px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

input, select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

button {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.tree-container {
    margin-top: 20px;
}

.tree-wrapper {
    overflow: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #f9f9f9;
    position: relative;
    transform-origin: top left;
    transition: transform 0.3s;
    min-height: 300px;
    cursor: grab;
}

.tree {
    min-width: fit-content;
    min-height: fit-content;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.family-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 20px;
}

.parents-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 20px;
}

.parents-container::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: #888;
}

.parents-container .person:first-child + .person .person-box.wife {
    position: relative;
}

.parents-container .person:first-child + .person .person-box.wife::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background-color: #888;
}

.children-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
    position: relative;
}

.children-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: #888;
}

.children-container::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #888;
    z-index: -1;
}

.children-container .person::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: #888;
    z-index: 0;
}

.person {
    position: relative;
    text-align: center;
    margin-bottom: 15px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.person-box {
    width: 180px;
    padding: 12px;
    background-color: #fff;
    border: 2px solid #4CAF50;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.person-box.husband {
    background-color: #e3f2fd;
    border-color: #2196F3;
}

.person-box.wife {
    background-color: #e8f5e9;
    border-color: #2E7D32;
}

.person-box.deceased {
    background-color: #f0f0f0;
    border-color: #888;
}

.person-box.widow {
    border-style: dashed;
    box-shadow: 0 2px 5px rgba(255, 165, 0, 0.3);
}

.person-name-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.person-name {
    font-weight: bold;
    color: #222;
}

.person-details-container {
    display: none; /* Initially hidden */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 13px;
    color: #555;
    text-align: center;
}

.person-details-container.show {
    display: block; /* Toggled by the "View" button */
}

.view-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-left: 5px; /* Space between name and button */
}

.view-btn:hover {
    background-color: #45a049;
}

.edit-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 8px;
}

.edit-btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: #2196F3; /* Blue */
}

.delete-btn {
    padding: 4px 8px;
    font-size: 12px;
    background-color: #f44336; /* Red */
}

.zoom-controls {
    position: sticky;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    z-index: 10;
    margin-bottom: 10px;
}

.zoom-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.export-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.export-btn {
    background-color: #9c27b0;
}

.print-btn {
    background-color: #009688;
}

.edit-form-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.edit-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 5px;
}

.status-alive {
    background-color: #4CAF50;
}

.status-deceased {
    background-color: #f44336;
}

.empty-message {
    text-align: center;
    padding: 20px;
    color: #666;
}