/* ==========================================
   RESET & BIẾN GLOBAL
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --sidebar-width: 260px;
    --ambilight-color: rgba(2, 132, 199, 0.35); /* Màu ánh sáng hắt nền mặc định */
}

body {
    background-color: #f8f9fa;
    color: #333;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s, background 0.5s ease;
}

/* ==========================================
   3D SPACE - NỀN LƯỚI PHỐI CẢNH (PERSPECTIVE GRID) - CHẾ ĐỘ SÁNG
   ========================================== */
body.is-3d-space {
    position: relative;
    background-color: #dbe2e8 !important;
    background-image: linear-gradient(to bottom, #ffffff 0%, #dbe2e8 40%, #b8c7d5 100%) !important;
    background-attachment: fixed !important;
    color: #1e293b !important;
    overflow-x: hidden;
}

/* 1. MẶT SÀN LƯỚI 3D RỜI (SÁNG) */
body.is-3d-space::before {
    content: "";
    position: fixed;
    bottom: -35%;
    left: -50%;
    width: 200%;
    height: 110%;
    
    background-image:
        linear-gradient(to right, rgba(51, 65, 85, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(51, 65, 85, 0.1) 1px, transparent 1px);
        
    background-size: 33px 33px; /*khoảng cách lưới*/
    
    transform: perspective(1000px) rotateX(72deg);
    transform-origin: center top;
    
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    mask-image: linear-gradient(to bottom, transparent 5%, rgba(0,0,0,0.95) 45%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 5%, rgba(0,0,0,0.95) 45%, black 100%);
    
    pointer-events: none;
    z-index: 0;
}

/* 2. DẢI SÁNG PHẢN CHIẾU Ở TÂM CHÂN TRỜI (SÁNG) */
body.is-3d-space::after {
    content: "";
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 250px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.8) 0%, rgba(219, 226, 232, 0.3) 60%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

/* Đảm bảo nội dung luôn nằm trên lớp lưới 3D */
body.is-3d-space .gallery-container,
body.is-3d-space .viewer-section {
    position: relative;
    z-index: 2;
}

body.is-3d-space .image-info h1 { color: #0f172a !important; }
body.is-3d-space .image-info p { color: #334155 !important; }

body.is-3d-space .main-image-wrapper {
    box-shadow: 
        0 20px 40px -10px rgba(15, 23, 42, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
}

/* ==========================================
   0. 3D SPACE - ĐỒNG BỘ CHẾ ĐỘ TỐI (DARK MODE)
   ========================================== */
body.dark-mode.is-3d-space {
    background-color: #0f172a !important;
    background-image: linear-gradient(to bottom, #020617 0%, #0f172a 50%, #1e293b 100%) !important;
    color: #f8fafc !important;
}

body.dark-mode.is-3d-space::before {
    background-image: 
        linear-gradient(to right, rgba(56, 189, 248, 0.22) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(56, 189, 248, 0.22) 1px, transparent 1px) !important;
}

body.dark-mode.is-3d-space::after {
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.18) 0%, rgba(15, 23, 42, 0.2) 60%, transparent 80%) !important;
}

body.dark-mode.is-3d-space .image-info h1 { color: #f8fafc !important; }
body.dark-mode.is-3d-space .image-info p { color: #94a3b8 !important; }
body.dark-mode.is-3d-space .main-image-wrapper {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset !important;
}

.gallery-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================
   1. SIDEBAR & HIỆU ỨNG TRƯỢT ĐÓNG/MỞ
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: #111625;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: relative;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease;
    flex-shrink: 0;
    z-index: 20;
    overflow: hidden;
}

.sidebar.collapsed {
    --sidebar-width: 65px;
    width: var(--sidebar-width);
    padding: 24px 8px;
}

.sidebar-header {
    margin-bottom: 25px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.sidebar-header h2 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #f8f9fa;
    text-transform: uppercase;
    padding-left: 4px;
    white-space: nowrap;
    margin-bottom: 0;
    transition: opacity 0.2s ease;
}

.collapse-btn {
    position: static;
    transform: none;
    width: 28px;
    height: 28px;
    background-color: #111625;
    border: 1px solid #111625;
    color: #bfaf98;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s, color 0.2s;
}

.collapse-btn:hover {   
    background-color: #1e293b;
    color: #ffffff;
}

.search-box {
    position: relative;
    transition: opacity 0.3s ease;
}

.search-box input {
    width: 100%;
    padding: 5px 36px 5px 12px;
    background-color: #1d2333;
    border: 1px solid #2d3548;
    border-radius: 20px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    font-weight: 500;
}

.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #bfaf98;
}

.sidebar-body {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.sidebar-icons-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-btn {
    background: none;
    border: none;
    color: #bfaf98;
    cursor: pointer;
    padding-top: 5px;
    padding-left: 5px;
    padding-right: 5px;
    padding-bottom: 2px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-btn:hover {
    color: #ffffff;
}

.nav-btn.active {
    background-color: #1e293b;
    color: #bfaf98;
}

.sidebar-menu {
    flex: 1;
    padding-left: 5px;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 8px; 
}

.menu-link {
    color: #f8f9fa;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 400;      
    display: block;
    width: 100%;
    padding: 8px 14px;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.menu-link:hover, 
.menu-link.active {
    color: #ffffff;
    font-weight: 500;
    background-color: #1e293b;
    transform: translateX(3px);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding-left: 4px;
    gap: 12px;
    width: 100%;
}

.sidebar-footer .footer-icon {
    background: none;
    border: none;
    color: #bfaf98;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    transition: color 0.2s, background-color 0.2s;
}

.sidebar-footer .footer-icon:hover {
    background-color: #1e293b;
    color: #ffffff;
}

.sidebar.collapsed .sidebar-footer {
    align-items: center;
    padding-left: 0;
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .search-box,
.sidebar.collapsed .sidebar-menu {
    display: none !important;
}

.sidebar.collapsed .header-top {
    justify-content: center;
    margin-bottom: 20px;
}

/* ==========================================
   2. MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    transition: max-width 0.35s ease;
    position: relative;
}

.viewer-section {
    width: 100%;
    max-width: 820px;
    text-align: center;
    margin-bottom: 0px;
    perspective: 1200px;
    position: relative;
}

.viewer-section::before {
    content: '';
    position: absolute;
    top: 5%;
    left: 10%;
    width: 80%;
    height: 70%;
    background: var(--ambilight-color);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
    transition: background 0.8s ease, opacity 0.5s ease;
}

.main-image-wrapper {
    width: 100%;
    height: 440px;
    border-radius: 18px;
    overflow: hidden;
    background-color: #e2e8f0;
    position: relative;
    z-index: 2;
    
    box-shadow: 
        0 20px 40px -15px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.4) inset;        
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.main-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, opacity 0.3s ease;
    pointer-events: none;
}

.ground-shadow {
    width: 75%;
    height: 20px;   
    margin: 4px auto 0px auto;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 75%);
    border-radius: 50%;
    filter: blur(7px);
    transition: transform 0.2s ease-out, opacity 0.3s ease, filter 0.3s ease;
    opacity: 0.85;
    position: relative;
    z-index: 1;
}

.image-info {
    position: relative;
    z-index: 2;
}

.image-info h1 {
    font-size: 24px;
    font-weight: 500;
    margin-top: 0px;
    margin-bottom: 8px;
    color: black;
    transition: color 0.3s;
}

.image-info p {
    font-size: 16px;
    color: #32465a; 
    transition: color 0.3s;
}

/* ==========================================
   3. CAROUSEL THUMBNAILS & SCROLL BUTTONS (LIGHT MODE)
   ========================================== */
.carousel-container {
    width: 100%;
    max-width: 950px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 0px;
    position: relative;
    z-index: 2;
}

.scroll-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    color: #64748b;    
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;    
    display: inline-flex;
    align-items: center;
    justify-content: center;    
    flex-shrink: 0;
    z-index: 20;        
    transition: all 0.25s ease;
}

.scroll-btn:hover {
    color: #0284c7;
    border-color: #0284c7;
    background-color: #e0f2fe;
    transform: scale(1.08);
}

.thumbnails-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 35px 20px 20px 20px; 
    width: 100%;
    margin: 0 auto;
    perspective: 1000px;
}

.thumbnails-wrapper::-webkit-scrollbar {
    display: none;
}

.thumb-card {
    flex: 0 0 110px;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border-radius: 13px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s, border-color 0.3s, box-shadow 0.3s;
    text-align: center;
    transform-style: preserve-3d;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;    
}

/* Hiệu ứng khi rê chuột vào từng ảnh nhỏ */
.thumb-card:not(.active):hover {
    transform: translateY(-4px) !important;
    opacity: 0.9 !important;
}

.thumb-card:first-child { margin-left: auto; }
.thumb-card:last-child { margin-right: auto; }

.thumb-card.active {
    border-color: #0284c7;   
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.4);
    font-weight: 500;
    font-size: 13px;  
}

.thumb-card img {
    width: 100%;
    height: calc(100% - 20px);
    object-fit: cover;
    border-radius: 9px;
}

.thumb-card span,
.thumb-card p {
    font-size: 13px;    
    color: #32465a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;

    display: block;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

/* ==========================================
   4. AUDIO GUIDE & HOTSPOT 3D (LIGHT MODE)
   ========================================== */
.title-with-audio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.audio-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
    transition: all 0.25s ease;
}

.audio-guide-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.audio-guide-btn.speaking {
    animation: audioPulse 1.2s infinite ease-in-out;
    background: #0284c7;
    color: #ffffff;
}

@keyframes audioPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.glass-glare {
    position: absolute;
    top: 0; left: -150%;
    width: 100%; height: 100%;
    background: linear-gradient(
        115deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.25) 45%, 
        rgba(255, 255, 255, 0.45) 50%, 
        transparent 55%
    );
    pointer-events: none;
    z-index: 5;
    transition: left 0.8s ease;
}

.main-image-wrapper:hover .glass-glare {
    left: 150%;
}

.magnifier {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(0,0,0,0.2);
    cursor: none;
    pointer-events: none;
    display: none;
    z-index: 30;
    background-repeat: no-repeat;
}

.hotspot-pin {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #0284c7;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.8);
    animation: pulsePin 2s infinite;
}

@keyframes pulsePin {
    0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(2, 132, 199, 0); }
    100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.hotspot-tooltip {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.hotspot-pin:hover .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 34px;
}

.spotlight-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.spotlight-mode .spotlight-overlay {
    opacity: 1;
    pointer-events: all;
}

body.spotlight-mode .viewer-section {
    z-index: 20;
}

/* ==========================================
   5. THANH ĐIỀU KHIỂN & ĐỊNH DẠNG NÚT CONTROL
   ========================================== */
.controls-bar {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);    
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 30px;     
    transition: all 0.3s ease;    
    z-index: 100;
}

.control-divider {
    width: 1px;
    height: 16px;
    background-color: #cbd5e1;
}

.control-btn, .footer-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.control-btn:hover, .footer-icon:hover {
    background-color: #0284c7;
    color: #ffffff;
}

.control-btn:hover svg, .footer-icon:hover svg {
    stroke: #ffffff;
}

.control-btn.active,
#themeToggleBtn.active,
#toggleLoupeBtn.active,
#musicToggleBtn.active,
#toggleSpotlightBtn.active,
#btn-toggle-3d.active {
    background-color: #e0f2fe !important;
    color: #0284c7 !important;
    border-radius: 50% !important;
}

.control-btn.active svg,
.control-btn.active svg line,
.control-btn.active svg path,
.control-btn.active svg circle,
.control-btn.active svg polygon,
.control-btn.active svg polyline {
    stroke: #0284c7 !important;
}

.spotlight-icon .light-rays {
    display: none;
    stroke: #0284c7;
}

.control-btn.active .spotlight-icon .light-rays {
    display: block;
}

.control-btn.active .spotlight-icon .bulb-body {   
    fill: #e0f2fe;
    stroke: #0284c7;
}

.music-select {
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 5px 35px 5px 15px;
    border-radius: 16px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    max-width: 200px;
    transition: all 0.2s;

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center; 
}

.music-select:hover {
    border-color: #0284c7 !important; /* Đổi viền sang màu xanh */
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important; /* Tạo quầng sáng xanh xung quanh */
    /* Đổi màu mũi tên SVG sang màu xanh (#0284c7) khi hover */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>") !important;
}

.music-select:focus {
    outline: none;
    border-color: #0284c7 !important;
    /* SVG mũi tên quay ngược lên đỉnh (Points đổi từ 6 9 12 15... thành 6 15 12 9...) */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230284c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 15 12 9 18 15'></polyline></svg>") !important;
}

#autoPlayBtn {
    width: auto !important;
    height: 32px !important;     
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding: 0 8px !important;
}

#autoPlayBtn svg {
    display: block;
    margin: 0 auto;
}

.auto-text {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 800;
    fill: currentColor;
    stroke: none !important;
    letter-spacing: 0.5px;
}

#autoPlayBtn.active {
    color: #0284c7 !important;
    background-color: #e0f2fe !important;
}

/* ==========================================
   6. BỘ LỌC MÀU POPUP (COLOR PICKER DROPDOWN)
   ========================================== */
.color-picker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.color-picker-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0px solid #cbd5e1;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
}

.color-picker-btn:hover {
      background: #e0f2fe !important;   /* Nền xanh nhạt mịn */
    transform: translateY(-2px) scale(1.05);  /* Nhô nhẹ lên & phóng to chút */
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2); /* Đổ bóng quầng xanh nhẹ */
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #3b82f6, #ec4899, #eab308);
    transition: all 0.25s ease;
}

.color-palette-dropdown {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #ffffff;
    backdrop-filter: blur(12px);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 8px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    
    min-width: 130px;        
    width: max-content;      
}

.color-palette-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.color-option:not(.active):hover {
    background: #f1f5f9 !important; /* Màu nền xanh pastel rất nhẹ */
    color: #0284c7 !important;            /* Đổi chữ sang màu xanh chủ đạo */
    padding-left: 14px !important;        /* Đẩy nhẹ chữ sang phải tạo cảm giác phản hồi */
    transition: all 0.2s ease;
}

.color-option.active {
    background: #e0f2fe;
    color: #0284c7;
    font-weight: 600;
}

.color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.color-swatch.filter-none { background: linear-gradient(135deg, #3b82f6, #ec4899); }
.color-swatch.filter-sepia { background-color: #704214; }
.color-swatch.filter-grayscale { background-color: #4b5563; }
.color-swatch.filter-cyan { background-color: #0891b2; }
.color-swatch.filter-vintage { background-color: #c2410c; }

.color-indicator.is-none { background: linear-gradient(135deg, #3b82f6, #ec4899, #eab308); }
.color-indicator.is-sepia { background-color: #704214; }
.color-indicator.is-grayscale { background-color: #4b5563; }
.color-indicator.is-cyan { background-color: #0891b2; }
.color-indicator.is-vintage { background-color: #c2410c; }

#mainImage.filter-sepia-active { filter: sepia(0.85) contrast(1.05) brightness(0.95) !important; }
#mainImage.filter-grayscale-active { filter: grayscale(1) contrast(1.1) !important; }
#mainImage.filter-cyan-active { filter: grayscale(0.8) sepia(0.3) hue-rotate(140deg) saturate(2) !important; }
#mainImage.filter-vintage-active { filter: sepia(0.4) contrast(1.1) saturate(1.3) hue-rotate(-20deg) !important; }

/* ==========================================
   7. DARK MODE STYLES CHUNG & ĐỒNG BỘ NÚT BẤM
   ========================================== */
body.dark-mode {
    background-color: #0f172a;
    color: #f1f5f9;
}

body.dark-mode .image-info h1 { color: #f8fafc; }
body.dark-mode .image-info p { color: #94a3b8; }
body.dark-mode .thumb-card { background: #1e293b; }
body.dark-mode .thumb-card span { color: #cbd5e1; }

body.dark-mode .main-image-wrapper {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

body.dark-mode .ground-shadow {
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 75%);
}

/* ĐỒNG BỘ 2 NÚT SCROLL SANG DARK MODE */
body.dark-mode .scroll-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .scroll-btn:hover {
    background-color: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* ĐỒNG BỘ NÚT AUDIO GUIDE SANG DARK MODE */
body.dark-mode .audio-guide-btn {
    background: rgba(2, 132, 199, 0.25);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .audio-guide-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

body.dark-mode .audio-guide-btn.speaking {
    background: #0284c7;
    color: #ffffff;
}

/* THANH ĐIỀU KHIỂN & ĐỊNH DẠNG KHÁC Ở DARK MODE */
body.dark-mode .controls-bar {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .control-divider { background-color: #475569; }
body.dark-mode .control-btn, body.dark-mode .footer-icon { color: #94a3b8; }

body.dark-mode .control-btn:hover, body.dark-mode .footer-icon:hover {
    color: #38bdf8;
    background-color: #0f172a;
}

body.dark-mode .control-btn.active,
body.dark-mode #themeToggleBtn.active,
body.dark-mode #toggleLoupeBtn.active,
body.dark-mode #musicToggleBtn.active,
body.dark-mode #toggleSpotlightBtn.active,
body.dark-mode #autoPlayBtn.active,
body.dark-mode #btn-toggle-3d.active {
    color: #38bdf8 !important;
    background-color: #0369a1 !important;
}

body.dark-mode .control-btn.active svg,
body.dark-mode .control-btn.active svg line,
body.dark-mode .control-btn.active svg path,
body.dark-mode .control-btn.active svg circle,
body.dark-mode .control-btn.active svg polygon,
body.dark-mode .control-btn.active svg polyline {
    stroke: #38bdf8 !important;
}

body.dark-mode .control-btn.active .spotlight-icon .bulb-body {
    fill: #0369a1;
    stroke: #38bdf8;
}

body.dark-mode .music-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

/* Bảng màu Popup chuyển sang Dark Mode */
body.dark-mode .color-picker-btn {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .color-picker-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

body.dark-mode .color-indicator {
    border-color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .color-palette-dropdown {
    background: rgba(23, 23, 23, 0.92);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

body.dark-mode .color-option {
    color: #e5e5e5;
}

body.dark-mode .color-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.dark-mode .color-option.active {
    background: rgba(2, 132, 199, 0.35);
    color: #38bdf8;
}

body.dark-mode .color-swatch {
    border-color: rgba(255, 255, 255, 0.4);
}


/* ==========================================
   8. RESPONSIVE DESIGN (MOBILE & TABLET TOP MENU)
   ========================================== */
/* ------------------------------------------
   A. TABLET / DI ĐỘNG LỚN (Max-width: 735px)
   ------------------------------------------ */
@media screen and (max-width: 735px) {
    .gallery-container {
        flex-direction: column;
    }

    /* MENU TOP THU GỌN MẶC ĐỊNH */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        padding: 10px 16px !important;
        position: sticky;
        top: 0;
        z-index: 1000;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar-header { margin-bottom: 0 !important; }
    .header-top { margin-bottom: 0 !important; display: flex; align-items: center; justify-content: space-between; }
    
    .sidebar.collapsed .sidebar-header h2,
    .sidebar .sidebar-header h2 {
        display: block !important;
        font-size: 13px;
    }

    .collapse-btn {
        display: flex !important;
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    /* Ẩn các phần con mặc định */
    .sidebar .sidebar-body,
    .sidebar .search-box,
    .sidebar .sidebar-footer {
        display: none !important;
        opacity: 0;
    }

    /* Hiện khi mở menu */
    .sidebar.show-menu .collapse-btn { transform: rotate(-90deg); }
    .sidebar.show-menu .sidebar-body,
    .sidebar.show-menu .search-box,
    .sidebar.show-menu .sidebar-footer {
        display: flex !important;
        opacity: 1;
    }
    .sidebar.show-menu .sidebar-menu { display: block !important; }

    .sidebar-body {
        flex-direction: column;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: 10px;
    }
    .sidebar-menu { padding-left: 0; white-space: normal; }
    .sidebar-icons-left { flex-direction: row; }
    .sidebar-footer { flex-direction: row; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.05); }

    /* NÚT TỰ ĐỘNG CÙNG DÒNG VỚI TIÊU ĐỀ */
    .title-with-audio {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .image-info h1 {
        font-size: 20px;
        margin-top: 0;
        margin-bottom: 10px;
    }

    .image-info p {
        font-size: 15px;
    }
    
    /* LAYOUT NỘI DUNG MAIN & DỜI SLIDER THUMBNAIL XUỐNG TÍ */
    .main-content {
        padding: 16px 10px 110px 10px;
        min-height: auto;
    }
    .viewer-section { max-width: 100%; }
    .main-image-wrapper { height: 280px; border-radius: 14px; }
    
    /* YÊU CẦU 3: Dời slider ảnh nhỏ xuống chút */
    .carousel-container { 
        padding-top: 0px; 
        margin-top: 25px !important; 
        overflow: visible !important;
    }
    .thumbnails-wrapper { padding: 16px 4px; gap: 8px; }
    .thumb-card { flex: 0 0 80px; border-radius: 10px; padding: 4px; }

    /* CONTROLS BAR: CỐ ĐỊNH CHÂN TRANG, KHÔNG BÓP ICON, TỰ XUỐNG DÒNG */
    .controls-bar {
        position: fixed !important;
        bottom: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: calc(100% - 24px) !important;
        max-width: 480px !important;
        z-index: 999 !important;       
        border-radius: 20px !important;
        padding: 8px 12px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px 12px !important;
    }

    /* YÊU CẦU 1: Chống bóp nhỏ nút AUTO ICON */
    #autoPlayBtn {
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #autoIcon {
        width: 38px !important;
        height: 12px !important;
        min-width: 38px !important;
        min-height: 12px !important;
        flex-shrink: 0 !important;
    }

    /* YÊU CẦU 2: Ẩn vạch ngăn cách .control-divider */
    .control-divider {
        display: none !important;
    }

    .control-btn, 
    .footer-icon {
        width: 36px !important;
        height: 36px !important;
        padding: 6px !important;
        flex-shrink: 0 !important;
    }

    .control-btn svg {
        width: 20px !important;
        height: 20px !important;
    }

    .music-select {
        max-width: 130px !important;
        font-size: 12px !important;
        height: 32px !important;
        flex-shrink: 0 !important;
    }

    body.is-3d-space::before {
        bottom: -20%;
        height: 90%;
        background-size: 14px 14px;
    }

    /* Đổi căn lề menu chọn màu sang bên phải để không bị tràn màn hình */
    .color-palette-dropdown {
        position: absolute !important;
        bottom: 50px !important; /* Đẩy menu nổi lên trên thanh controls-bar */
        right: 12px !important;  /* Bám sát mép phải trong của thanh controls-bar */
        left: auto !important;
        transform: none !important;
    }

    

}


/* ------------------------------------------
   B. DI ĐỘNG NHỎ (Max-width: 480px)
   ------------------------------------------ */
@media screen and (max-width: 480px) {
    .main-content { 
        padding: 10px 6px 120px 6px; 
    }
    
    .main-image-wrapper { 
        height: 220px; 
        border-radius: 12px; 
    }

    /* Slider ảnh nhỏ cho di động nhỏ */
    .carousel-container { 
        margin-top: 20px !important; 
    }

    .scroll-btn { width: 28px; height: 28px; }
    .scroll-btn svg { width: 14px; height: 14px; }

    .thumb-card { flex: 0 0 70px; padding: 3px; }
    .thumb-card span, .thumb-card p { font-size: 9.5px; }

    .controls-bar {
        bottom: 8px !important;
        width: calc(100% - 16px) !important;
        padding: 8px 10px !important;
        gap: 6px 10px !important;
    }

    .audio-guide-btn { 
        padding: 4px 10px; 
        font-size: 12px; 
    }

    body.is-3d-space::before {
        transform: perspective(600px) rotateX(75deg);
        background-size: 12px 12px;
    }
}