body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
}

header {
    background: #fff;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.search-container {
    display: flex;
    gap: 10px;
}

input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
}

input[type="text"]:focus {
    border-color: #3498db;
}

button {
    padding: 8px 15px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 14px;
}

button:hover {
    background-color: #2980b9;
}

.controls {
    display: flex;
    gap: 10px;
}

#graph {
    margin-top: 80px;
    width: 100vw;
    height: calc(100vh - 80px);
    overflow: hidden;
    cursor: grab;
}

#graph:active {
    cursor: grabbing;
}

/* dTree Styles */
.linage {
    fill: none;
    stroke: #ccc;
    stroke-width: 2px;
}

.marriage {
    fill: none;
    stroke: #ccc;
    stroke-width: 2px;
}

.node-card {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    text-align: center;
}

.node-card:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.node-card.man {
    border-top: 4px solid #3498db;
}

.node-card.deceased.man {
    /* Không dùng border-bottom nữa theo yêu cầu */
}

.node-card.woman {
    border-top: 4px solid #e74c3c;
}

.node-card.deceased.woman {
    /* Không dùng border-bottom nữa theo yêu cầu */
}

.node-card.unknown {
    border-top: 4px solid #95a5a6;
}

.node-card.deceased.unknown {
    /* Không dùng border-bottom nữa theo yêu cầu */
}

foreignObject {
    width: 150px;
    height: 50px;
    overflow: visible;
}

.node-name {
    padding: 2px 10px;
    font-weight: bold;
    font-size: 14px;
}

.highlight {
    background-color: #f1c40f !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    max-width: 400px;
    width: 90%;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: #000;
    text-decoration: none;
}

.modal-body p {
    margin: 10px 0;
    font-size: 16px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        overflow: hidden; /* Prevent body scrolling */
    }
    
    header {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    header h1 {
        text-align: center;
        font-size: 1.3rem;
    }
    
    .search-container {
        display: flex;
        width: 100%;
        box-sizing: border-box;
    }
    
    .search-container input {
        flex: 1;
        min-width: 0;
    }
    
    .controls {
        display: flex;
        width: 100%;
        justify-content: space-between;
        gap: 6px;
        box-sizing: border-box;
    }
    
    .controls button {
        flex: 1;
        padding: 8px 4px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    #graph {
        margin-top: 0;
        height: auto;
    }
}
