/* CSS CHUNG & FONT */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Montserrat', sans-serif; background-color: #f4f6f9; color: #333; overflow: hidden; touch-action: none; }

/* HEADER CHỨA LOGO VÀ TIÊU ĐỀ */
header {
    background: linear-gradient(90deg, #0a3d91 0%, #1557c0 100%);
    color: white; padding: 12px 20px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); position: relative; z-index: 100;
    min-height: 110px;
}

/* KHU VỰC CHỨA LOGO BÊN TRÁI HEADER */
.header-left {
    position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
    display: flex; gap: 25px; align-items: flex-start;
}

/* KHU VỰC CHỨA LOGO BÊN PHẢI HEADER */
.header-right {
    position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: flex-start;
}

.logo-group {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.logo-row {
    display: flex; gap: 6px;
}

.logo-row img {
    width: 45px; height: 45px; border-radius: 50%; object-fit: contain;
    background: white; padding: 3px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.logo-caption {
    font-size: 10px; font-weight: 700; color: #ffdd00; text-transform: uppercase;
    letter-spacing: 0.5px; text-align: center; line-height: 1.3;
}
#logo-right-caption { min-width: 250px; }

/* TÊN DI TÍCH ÉP GIỮA */
.title-container { text-align: center; z-index: 10; pointer-events: none; }
.title-container h1 { font-size: 24px; text-transform: uppercase; letter-spacing: 1px; color: #ffdd00; text-shadow: 1px 1px 3px rgba(0,0,0,0.5); font-weight: 700; margin: 0;}

/* FOOTER NGUỒN CÔNG TRÌNH */
#footer-credit {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(10, 61, 145, 0.95); color: #fff;
    text-align: center; padding: 10px; font-size: 14px; font-weight: 600;
    z-index: 300; box-shadow: 0 -2px 10px rgba(0,0,0,0.3); backdrop-filter: blur(5px);
}
#footer-credit span { color: #ffdd00; }

/* VÙNG TƯƠNG TÁC CHÍNH */
main {
    position: relative; width: 100vw; height: calc(100vh - 145px);
    background: #e0e5ec; overflow: hidden; display: flex; justify-content: center; align-items: center; cursor: grab;
}
main:active { cursor: grabbing; }

#map-container {
    position: relative; display: inline-block; line-height: 0;
    transform-origin: center center; transition: transform 0.1s ease-out; will-change: transform;
}

#model-image {
    max-width: 95vw; max-height: 75vh; width: 100%; height: auto;
    display: block; border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.3); pointer-events: none; background-color: #ccc;
}

/* CÁC ĐIỂM GHIM (PINS) */
.pin {
    position: absolute; width: 32px; height: 32px; background-color: #e74c3c;
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -100%) rotate(-45deg);
    transform-origin: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.8); transition: 0.2s; z-index: 10;
}
.pin::after { content: ''; position: absolute; width: 14px; height: 14px; background: white; border-radius: 50%; top: 9px; left: 9px; }
.pin:hover, .pin:active { transform: translate(-50%, -100%) rotate(-45deg) scale(1.3); background-color: #c0392b; z-index: 20;}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(231,76,60, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(231,76,60, 0); } 100% { box-shadow: 0 0 0 0 rgba(231,76,60, 0); } }
.pin { animation: pulse 2s infinite; }

/* Toạ độ từng ghim được gán trực tiếp qua style="top/left" khi JS dựng ghim
   từ dữ liệu API (/api/site), thay vì cố định bằng CSS như bản cũ. */

/* MODAL CHUNG */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 400;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content {
    background: rgba(255, 255, 255, 0.98); width: 90%; max-width: 800px; max-height: 85vh; overflow-y: auto;
    border-radius: 20px; padding: 30px 40px; position: relative;
    transform: scale(0.8) translateY(30px); transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2);
}
.modal-overlay.show .modal-content { transform: scale(1) translateY(0); }
.close-modal-btn {
    position: absolute; top: 15px; right: 20px; font-size: 32px; font-weight: bold;
    color: #888; cursor: pointer; transition: 0.2s; line-height: 1; z-index: 10;
}
.close-modal-btn:hover { color: #e74c3c; transform: scale(1.1); }
.modal-title { color: #0a3d91; font-size: 26px; margin-bottom: 20px; border-bottom: 3px solid #ffdd00; padding-bottom: 10px; font-weight: 700; margin-right: 20px;}

#modal-image {
    width: 100%; max-height: 350px; object-fit: cover; border-radius: 12px; margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); display: none;
}
.modal-body { line-height: 1.8; color: #333; font-size: 16px; text-align: justify; }
.modal-body p { margin-bottom: 15px; }

/* GALLERY ẢNH LƯỚI */
.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px;
}
.gallery-grid img {
    width: 100%; height: 140px; object-fit: cover; border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); transition: 0.3s; cursor: pointer;
}
.gallery-grid img:hover { transform: scale(1.05); box-shadow: 0 8px 16px rgba(0,0,0,0.2); }

/* LIGHTBOX */
#lightbox-modal {
    background: rgba(0, 0, 0, 0.9); z-index: 500;
}
.close-lightbox-btn {
    position: absolute; top: 20px; right: 30px; font-size: 40px; font-weight: bold;
    color: #fff; cursor: pointer; transition: 0.2s; z-index: 510; line-height: 1; text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.close-lightbox-btn:hover { color: #ffdd00; transform: scale(1.1); }

/* NÚT CHUYỂN ẢNH */
.lb-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2); color: white; border: none;
    font-size: 40px; padding: 15px 20px; cursor: pointer; border-radius: 10px;
    transition: 0.3s; z-index: 510; backdrop-filter: blur(5px);
}
.lb-nav-btn:hover { background: rgba(255, 255, 255, 0.5); color: #ffdd00; }
.lb-left { left: 20px; }
.lb-right { right: 20px; }

/* KHUNG CHỨA ẢNH LIGHTBOX */
#lightbox-img-container {
    width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;
    overflow: hidden;
}
#lightbox-img {
    max-width: 90vw; max-height: 85vh; border-radius: 8px; object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: transform 0.2s ease-out;
    transform-origin: center center;
}

/* NÚT ZOOM DƯỚI ĐÁY */
.lb-zoom-controls {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 15px; z-index: 510;
}
.lb-zoom-controls button {
    background: rgba(255, 255, 255, 0.3); border: 2px solid white; color: white;
    width: 45px; height: 45px; border-radius: 50%; font-size: 24px; font-weight: bold;
    cursor: pointer; transition: 0.3s; backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; line-height: 1;
}
.lb-zoom-controls button:hover { background: white; color: #0a3d91; transform: scale(1.1); }

/* CÁC NÚT MENU TRÁI MÀN HÌNH CHÍNH */
.menu-buttons-container {
    position: absolute; left: 20px; top: 20px; display: flex; flex-direction: column; gap: 12px; z-index: 90;
}
.toggle-menu-btn {
    background: #0a3d91; color: white; padding: 12px 20px; border-radius: 8px; cursor: pointer;
    font-weight: 600; font-size: 15px; border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: 0.3s;
}
.toggle-menu-btn:hover { background: #1557c0; transform: scale(1.05); }

/* NGÔN NGỮ BÊN TRONG CỤM MENU TRÁI */
.lang-switcher { position: relative; width: 100%; z-index: 100; }
.lang-options {
    position: absolute; top: 110%; left: 0; background: white;
    border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden; width: 100%; min-width: 150px;
    transform: translateY(-10px); opacity: 0; pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.lang-switcher.active .lang-options { transform: translateY(0); opacity: 1; pointer-events: auto; }
.lang-opt {
    padding: 12px 15px; color: #333; font-weight: 600; cursor: pointer; font-size: 14px;
    display: flex; align-items: center; gap: 10px; transition: 0.2s; white-space: nowrap;
}
.lang-opt:hover { background: #f0f4fa; color: #0a3d91; }
.lang-opt.active-lang { background: #e0eaf5; color: #d35400; }

/* MENU TỔNG QUAN */
#side-menu {
    position: absolute; top: 0; left: -100%; width: 500px; max-width: 90vw; height: 100%;
    background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(10px);
    box-shadow: 5px 0 25px rgba(0,0,0,0.2); padding: 40px 30px;
    transition: 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 95; overflow-y: auto; border-right: 1px solid rgba(0,0,0,0.1);
}
#side-menu.open { left: 0; }

.close-menu-btn {
    position: absolute; top: 10px; right: 20px; font-size: 32px; font-weight: bold;
    color: #888; cursor: pointer; transition: 0.2s; line-height: 1; background: none; border: none;
}
.close-menu-btn:hover { color: #e74c3c; transform: scale(1.1); }
.side-menu-title { color: #0a3d91; font-size: 24px; margin-top: 10px; margin-bottom: 20px; font-weight: 700; text-transform: uppercase; border-bottom: 3px solid #ffdd00; padding-bottom: 10px; margin-right: 25px;}

.menu-settings-block {
    background: #f4f6f9; padding: 15px; border-radius: 12px; margin-bottom: 25px;
    border: 1px solid #dcdde1; display: flex; flex-direction: column; gap: 15px;
}

.voice-control-inline .voice-header { font-weight: 700; color: #0a3d91; font-size: 13px; text-transform: uppercase; margin-bottom: 8px; }
audio { width: 100%; height: 35px; outline: none; border-radius: 8px; }

.side-menu-content { line-height: 1.7; font-size: 15px; text-align: justify; color: #333; }
.side-menu-content h4 { color: #d35400; margin-top: 15px; margin-bottom: 8px; font-size: 16px; font-weight: 700; }
.side-menu-content ul { padding-left: 20px; margin-top: 5px; }
.side-menu-content li { margin-bottom: 8px; }

/* TỐI ƯU CHO ĐIỆN THOẠI */
@media (max-width: 900px) {
    header { flex-direction: column; padding: 15px 10px; justify-content: flex-start; gap: 15px; min-height: auto;}
    .header-left, .header-right { position: static; transform: none; flex-wrap: wrap; justify-content: center; gap: 15px; }
    .title-container { position: static; padding-bottom: 5px;}
    .title-container h1 { font-size: 18px; }
    .logo-group { width: 100%; }
    .logo-caption { max-width: 100%; }
    #logo-right-caption { min-width: 0; max-width: 100%; }

    #footer-credit { font-size: 11px; padding: 8px 5px; }
    main { height: calc(100vh - 200px); }

    .menu-buttons-container { top: 15px; left: 15px; gap: 8px;}
    .toggle-menu-btn { font-size: 12px; padding: 10px 15px; }

    .pin { width: 24px; height: 24px; } .pin::after { width: 10px; height: 10px; top: 7px; left: 7px; }
    #modal-image { max-height: 200px; } .modal-content { padding: 25px 20px; }

    .gallery-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .gallery-grid img { height: 100px; }

    .lb-nav-btn { font-size: 24px; padding: 10px 12px; }
    .lb-zoom-controls button { width: 35px; height: 35px; font-size: 18px; }
}

/* TRẠNG THÁI ĐANG TẢI DỮ LIỆU TỪ API */
.loading-hint {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: #f4f6f9; color: #0a3d91; font-weight: 700; font-size: 16px; z-index: 1000;
    letter-spacing: 0.5px; text-transform: uppercase;
}
