/* --- BIẾN MÀU SẮC CHỦ ĐẠO --- */
:root {
    --red-dark: #8b0000;
    --gold: #d4af37;
    --bg-paper: #fdfaf6;
    --text-color: #333;
}

body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: var(--bg-paper);
    color: var(--text-color);
}

/* --- BANNER ĐỒNG NHẤT (Sử dụng image4.jpg) --- */
.banner-container {
    width: 100%;
    max-height: 350px;
    overflow: hidden;
    background-color: var(--red-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* --- THANH MENU (NAVBAR) --- */
.navbar { 
    background: var(--red-dark); 
    display: flex; 
    justify-content: center; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    border-bottom: 4px solid var(--gold); 
}

/* Định dạng chung cho link menu và nút dropdown */
.navbar a, .dropdown .dropbtn { 
    color: white; 
    text-decoration: none; 
    padding: 15px 25px; 
    font-weight: bold; 
    text-transform: uppercase; 
    font-size: 14px; 
    display: inline-block;
    /* Loại bỏ định dạng nút mặc định */
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    transition: 0.3s;
}

.navbar a:hover, .dropdown:hover .dropbtn {
    background-color: rgba(255,255,255,0.15);
    color: var(--gold);
}

/* --- CĂN GIỮ NỘI DUNG TRANG --- */
.content-section, .container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    background: white; /* Tạo nền trắng cho nội dung dễ đọc */
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    padding: 30px;
}

/* --- MENU XỔ XUỐNG (DROPDOWN) --- */
.dropdown { position: relative; display: inline-block; }

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 220px;
    z-index: 1001;
    border-top: 3px solid var(--gold);
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
}

/* Định dạng link bên trong menu xổ xuống */
.dropdown-content a {
    color: #333 !important;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    text-transform: none; /* Không cần viết hoa toàn bộ */
    font-weight: normal;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.dropdown-content a:last-child { border-bottom: none; }

.dropdown-content a:hover {
    background-color: #f8f8f8;
    color: var(--red-dark) !important;
}

.dropdown:hover .dropdown-content { display: block; }

/* --- ĐỊNH DẠNG SƠ ĐỒ PHẢ HỆ --- */
#tree-display { 
    width: 100%; 
    height: 750px; 
    background: white; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    overflow: auto; 
}

.node circle { fill: #fff; stroke-width: 2.5px; }
.node-male circle { stroke: var(--red-dark); }
.node-female circle { stroke: #ff69b4; }
.node text { font-size: 14px; font-weight: bold; fill: #333; }
.link { fill: none; stroke: #ccc; stroke-width: 1.5px; stroke-opacity: 0.6; }

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 30px;
    color: #888;
    background: #eee;
    margin-top: 50px;
}
/* --- TỐI ƯU GIAO DIỆN CHO ĐIỆN THOẠI (BẢN SỬA LỖI DROPDOWN) --- */
@media screen and (max-width: 768px) {
    .navbar {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start !important;
        padding: 0 10px !important;
    }

    .navbar::-webkit-scrollbar {
        display: none;
    }

    /* Biến dropdown thành một phần của hàng ngang */
    .dropdown {
        display: flex !important; 
    }

    /* Ẩn cái nút "Thờ Phụng & An Táng ▼" trên điện thoại vì nó chỉ là tiêu đề nhóm */
    /* Thay vào đó, chúng ta hiện các mục con trực tiếp ra luôn */
    .dropbtn {
        display: none !important;
    }

    .dropdown-content {
        display: flex !important; /* Hiện các mục con ra luôn */
        position: static !important; /* Không cho nó bay lơ lửng nữa, giúp không bị cắt */
        background: none !important;
        box-shadow: none !important;
    }

    .navbar a, .dropdown-content a {
        padding: 12px 15px !important;
        font-size: 14px !important;
        display: inline-block !important;
        color: white !important; /* Đảm bảo chữ luôn trắng trên nền đỏ */
        text-decoration: none;
    }

    /* Làm nổi bật mục đang xem trên điện thoại */
    .navbar a.active, .dropdown-content a.active {
        background-color: rgba(255, 255, 255, 0.2) !important;
        font-weight: bold;
    }
}
/* Unify all navbar items (Main and Dropdown) */
.navbar a, 
.navbar .dropbtn, 
.dropdown-content a {
    font-size: 14px !important;    /* Kích thước chữ đồng nhất */
    font-weight: bold !important;  /* Ép chữ đậm */
    text-transform: uppercase;     /* Tự động viết hoa nếu bạn quên */
    padding: 12px 15px;            /* Khoảng cách đệm đều nhau */
    display: inline-block;
    color: white;                  /* Màu chữ trắng cho rõ */
    text-decoration: none;
}

/* Đảm bảo các mục trong menu con không bị đổi màu nền quá tối */
.dropdown-content a {
    background-color: transparent !important; 
    width: 100%;
    text-align: left;
}
/* Hiệu ứng ô chữ nhật bao quanh khi ở trang hiện tại */
.navbar a.active, 
.dropbtn.active {
    background-color: rgba(0, 0, 0, 0.3) !important; /* Tạo ô màu tối hơn nền đỏ */
    color: white !important;
    font-weight: bold;
    border-radius: 4px; /* Bo góc nhẹ cho giống hình chữ nhật đẹp */
    padding: 10px 15px; /* Đảm bảo ô bao quanh vừa vặn chữ */
}
