body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

.logo-container {
    text-align: center;
    padding: 20px 0;
    background-color: #ffffff;
    border-bottom: 1px solid #eee;
}

.logo-container img {
    max-width: 150px;
    height: auto;
}

.main-title {
    text-align: center;
    color: #2c3e50;
    margin: 20px 10px;
    font-size: 1.8em;
    padding: 10px 0;
    border-bottom: 2px solid #3498db;
}

.main-title .highlight {
    color: #e74c3c;
    font-weight: bold;
}

.category-section {
    padding: 20px 10px;
    background-color: #fff;
    margin: 20px auto;
    max-width: 90%;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    justify-items: center;
    align-items: start;
}

.category-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.category-item:hover {
    transform: translateY(-5px);
}

.circle-outer {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #3498db; /* Màu viền mặc định */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    overflow: hidden; /* Đảm bảo ảnh không tràn ra ngoài */
    position: relative;
    transition: border-color 0.3s ease;
}

.circle-inner {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.circle-inner img {
    width: 100%; /* Đảm bảo ảnh lấp đầy vòng tròn */
    height: 100%;
    object-fit: cover; /* Cắt ảnh để vừa vặn mà không bị méo */
    display: block;
}

/* Màu viền riêng cho từng category */
.category-item[data-category="nha-pho"] .circle-outer { border-color: #e74c3c; } /* Đỏ */
.category-item[data-category="biet-thu"] .circle-outer { border-color: #f39c12; } /* Cam */
.category-item[data-category="noi-that"] .circle-outer { border-color: #9b59b6; } /* Tím */
.category-item[data-category="nha-xuong"] .circle-outer { border-color: #34495e; } /* Xám đậm */
.category-item[data-category="da-thi-cong"] .circle-outer { border-color: #2ecc71; } /* Xanh lá */
.category-item[data-category="bat-dong-san"] .circle-outer { border-color: #3498db; } /* Xanh dương */


.category-label {
    background-color: #3498db; /* Màu nền nút mặc định */
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap; /* Ngăn chữ xuống dòng */
    overflow: hidden;
    text-overflow: ellipsis; /* Thêm dấu ba chấm nếu chữ quá dài */
}

.category-label:hover {
    background-color: #2980b9;
}

/* Màu nút riêng cho từng category */
.label-nhapho { background-color: #e74c3c; }
.label-nhapho:hover { background-color: #c0392b; }
.label-bietthu { background-color: #f39c12; }
.label-bietthu:hover { background-color: #e67e22; }
.label-noithat { background-color: #9b59b6; }
.label-noithat:hover { background-color: #8e44ad; }
.label-nhaxuong { background-color: #34495e; }
.label-nhaxuong:hover { background-color: #2c3e50; }
.label-thicong { background-color: #2ecc71; }
.label-thicong:hover { background-color: #27ae60; }
.label-bds { background-color: #3498db; }
.label-bds:hover { background-color: #2980b9; }


/* Section Giới thiệu, Dịch vụ, Cam kết, Liên hệ */
.section-info {
    background-color: #fff;
    margin: 20px auto;
    max-width: 90%;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.section-title {
    color: #2c3e50;
    font-size: 1.5em;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
}

.section-title .section-icon {
    color: #3498db;
    margin-right: 10px;
    font-size: 1.2em;
}

.section-info ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.section-info li {
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
}

.section-info .check-icon {
    color: #2ecc71;
    position: absolute;
    left: 0;
    top: 3px;
}

.section-info .highlight-info {
    font-weight: bold;
    color: #e74c3c;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background-color: #ffe0e0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-info .star-icon {
    color: #f1c40f;
    margin-right: 8px;
    font-size: 1.2em;
}

.section-info .contact-icon {
    color: #3498db;
    margin-right: 10px;
    font-size: 1.1em;
}

.section-info a {
    color: #3498db;
    text-decoration: none;
}

.section-info a:hover {
    text-decoration: underline;
}

.company-info-bottom {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
}


/* Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1000px; /* Tăng max-width để ảnh lớn hơn */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    border-radius: 8px;
    display: flex;
    flex-direction: column; /* Đảm bảo các phần tử xếp dọc */
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010; /* Đảm bảo nút X luôn nằm trên cùng */
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

#modalTitle {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: bold;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Kích thước thumbnail nhỏ hơn */
    gap: 15px;
    padding: 10px;
    max-height: 70vh; /* Giới hạn chiều cao và cho phép cuộn */
    overflow-y: auto;
    background-color: #eee; /* Nền cho gallery thumbnail */
    border-radius: 5px;
    margin-bottom: 10px;
}

.image-gallery img {
    width: 100%;
    height: 100px; /* Chiều cao cố định cho thumbnail */
    object-fit: cover;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.image-gallery.hidden {
    display: none;
}

.single-image-view {
    position: relative;
    display: flex; /* Dùng flexbox để căn giữa ảnh và nút điều hướng */
    justify-content: center;
    align-items: center;
    height: 80vh; /* Chiếm phần lớn chiều cao modal */
    overflow: hidden; /* Quan trọng để ẩn phần tràn khi kéo/zoom */
    background-color: #333; /* Nền tối cho ảnh lớn */
    border-radius: 5px;
}

.single-image-view.active {
    display: flex;
}

.single-image-view #singleImage {
    max-width: 100%; /* Giới hạn kích thước ảnh trong khung nhìn */
    max-height: 100%;
    object-fit: contain; /* Đảm bảo ảnh hiển thị toàn bộ trong khung */
    position: absolute; /* Để có thể dịch chuyển và zoom */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    cursor: zoom-in; /* Con trỏ mặc định */
    transition: transform 0.1s ease-out; /* Chuyển động mượt mà khi zoom/kéo */
    image-rendering: -webkit-optimize-contrast; /* Có thể giúp ảnh nét hơn khi zoom */
    image-rendering: crisp-edges;
}

/* Các nút điều hướng ảnh lớn */
.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 15px 10px;
    cursor: pointer;
    font-size: 2em;
    z-index: 10;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.nav-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.prev-button {
    left: 10px;
}

.next-button {
    right: 10px;
}

/* Ẩn tiêu đề và nút điều hướng khi ở chế độ xem ảnh đơn */
body.single-image-active .modal-content #modalTitle {
    display: none !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    height: 0 !important; /* Đặt height về 0 để loại bỏ không gian */
    overflow: hidden !important;
}

/* Điều chỉnh padding top của modal-content khi ở chế độ ảnh đơn */
body.single-image-active .modal-content {
    /* Điều chỉnh padding-top nếu bạn thấy ảnh bị quá sát mép trên */
    /* padding-top: 10px !important; */
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .main-title {
        font-size: 1.5em;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }

    .circle-outer {
        width: 100px;
        height: 100px;
    }

    .circle-inner {
        width: 90px;
        height: 90px;
    }

    .category-label {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    .modal-content {
        width: 95%;
        padding: 10px;
    }

    #modalTitle {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }

    .image-gallery img {
        height: 70px;
    }

    .nav-button {
        padding: 10px 5px;
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.2em;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cột trên điện thoại nhỏ */
    }

    .circle-outer {
        width: 80px;
        height: 80px;
    }

    .circle-inner {
        width: 70px;
        height: 70px;
    }

    .category-label {
        font-size: 0.7em;
        padding: 5px 8px;
    }

    #modalTitle {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 8px;
    }

    .image-gallery img {
        height: 50px;
    }

    .nav-button {
        padding: 5px;
        font-size: 1.2em;
    }
}