/* RESET LAYOUT */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
   /*  height: 100%; */
   /*  height: auto;    */       /* ⭐ không khóa chiều cao trang */
   height: 100%;
    overflow-x: hidden;
    overflow-y: auto;      /* ⭐ trang được phép cuộn xuống */
  /*   display: flex; */
    display: block;    /* ⭐ KHÔNG dùng flex nữa */
    flex-direction: column;
   /*  overflow: hidden; */
    font-family: sans-serif;
}
/* ================================
   TOP MENU GIỐNG RELEBOOK
================================ */
#top-menu {
    width: 100%;
    height: 70px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    box-sizing: border-box;
    position: fixed;          /* ⭐ đè trên viewer */
    top: 0;
    left: 0;
    z-index: 99999;           /* ⭐ nằm trên tất cả */
}

.menu-left {
    display: flex;
    align-items: center;
    gap: 22px;
}

.menu-logo {
    height: 34px;
    object-fit: contain;
}

.menu-link {
    color: #ccc;
    font-size: 15px;
    text-decoration: none;
    font-weight: 500;
}

.menu-link.active,
.menu-link:hover {
    color: #fff;
}

.menu-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-box {
    padding: 8px 14px;
    border-radius: 20px;
    border: none;
    width: 240px;
    background: #222;
    color: white;
}

.menu-btn {
    padding: 8px 18px;
    background: #333;
    border-radius: 20px;
    color: white;
    border: none;
    cursor: pointer;
}

.menu-btn.highlight {
    background: gold;
    color: black;
}
/* ============================
   MOBILE SLIDE MENU (RELEBOOK STYLE)
============================ */
#mobile-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 999999;

    transform: translateY(-100%);   /* Ẩn panel */
    transition: transform 0.35s ease;

    padding-top: 70px; /* tránh che logo */
}

/* Khi mở menu */
#mobile-menu-panel.open {
    transform: translateY(0);
}

.mobile-menu-header {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#mobile-close-btn {
    font-size: 28px;
    color: white;
    cursor: pointer;
}

.mobile-menu-logo {
    height: 26px;
    margin-right: 16px;
}

.mobile-menu-links {
    margin-top: 40px;
    display: grid;
    gap: 24px;
    padding: 0 26px;
}

.menu-item {
    font-size: 22px;
    color: white;
    font-weight: 500;
}

.mobile-menu-bottom {
    width: 100%;
    display: flex;
    margin-top: 40px;
}

.mobile-login {
    width: 50%;
    padding: 14px;
    background: #111;
    color: white;
    border: none;
    font-size: 18px;
}

.mobile-register {
    width: 50%;
    padding: 14px;
    background: white;
    color: black;
    border: none;
    font-size: 18px;
}

/* Ẩn panel trên desktop */
@media (min-width: 769px) {
    #mobile-menu-panel {
        display: none;
    }
}


/* ================================
   VIEWER CHÍNH
   ================================*/
#viewer-container {
   /*  flex: 1;    */                               /* chiếm toàn bộ không gian trống */
      height: calc(100vh - 70px);
	height: 80vh;     /* ⭐ viewer luôn chiếm toàn màn */
    flex: 0 0 auto;    /* ⭐ không cho flex bóp chiều cao */
    width: 100%;
    position: relative;
    background: #eaeaea;
    overflow: hidden;
	margin-top: 70px; /* ⭐ tránh menu che canvas */
}


#v3d-container {
  position: absolute;
  inset: 0;
}
#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}
/* ==========================
   NÚT NỔI TRONG VIEWER
   ==========================*/
   /* Loader phủ toàn màn hình */
#custom-loader {
    position: fixed;
    inset: 0;
    background: #000000dd; /* nền mờ đẹp */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease;
	
}
.v3d-simple-preloader-logo {
    background-image: url("./media/logo-load.png");
    background-size: cover;
}
/* Logo */
#loader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
    animation: pulse 1.6s infinite ease-in-out;
}

/* Vòng xoay */
.loader-ring {
    width: 50px;
    height: 50px;
    border: 5px solid #ffffff44;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    50%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.6; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Ẩn loader */
#custom-loader.hide {
    animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

#model-buttons {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999; /* ⭐ luôn nằm trên canvas */
}

.btn-3d {
    padding: 8px 14px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: 1px solid #888;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(4px);
    transition: 0.2s;
}

.btn-3d:hover {
    background: rgba(255,255,255,0.85);
    color: #000;
    border-color: #fff;
    transform: scale(1.06);
}
/* ================================
   POPUP INFO PANEL (Verge3D style)
================================ */
/* ===============================
   🏛️ INFO PANEL – VÀNG CỔ BẢO TÀNG
================================ */
/* ===============================
   INFO PANEL – CHUẨN ALL DEVICES
================================ */

#info-panel {
    position: absolute;
    inset: 0;
    display: flex;
   /*  align-items: center;
    justify-content: center;
    padding: 12px; */
  align-items: flex-end;
    justify-content: flex-start;
    padding-left: 20px;
    padding-bottom: 20px;
    background: rgba(10, 6, 3, 0.55);
    backdrop-filter: blur(3px);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 20;
}

#info-panel.show {
    opacity: 1;
    pointer-events: auto;
}

/* ===== CONTENT ===== */
#info-panel-content {
    width: 420px;
    max-width: 90%;
    aspect-ratio: 4 / 3;              /* ⭐ CHÌA KHÓA GIỮ TỶ LỆ ẢNH */
    box-sizing: border-box;

    padding: 26px 28px;

    background-image:
        linear-gradient(
            rgba(255, 235, 180, 0.15),
            rgba(120, 80, 20, 0.25)
        ),
        url("images/bg/bginfo.jpg");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    border-radius: 14px;
    border: 1px solid rgba(180, 140, 70, 0.6);

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.55),
        inset 0 0 40px rgba(255, 220, 150, 0.25);

    color: #3b2a14;
    font-family: "Times New Roman", serif;

    animation: fadeUp 0.45s ease;

    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ===== TIÊU ĐỀ ===== */
#info-panel-content h2 {
    margin: 0;
    text-align: center;
    font-size: 22px;
    letter-spacing: 1px;
    color: #ffcc00;
}

/* ===== ĐƯỜNG KẺ ===== */
#info-panel-content .line {
    width: 80px;
    height: 2px;
    margin: 12px auto 16px;
    background: linear-gradient(
        to right,
        transparent,
        #ff9900,
        transparent
    );
}

/* ===== TEXT ===== */
#info-text {
    font-size: 15px;
    line-height: 1.7;
    color: #ffffff;
    text-align: center;
}

/* ===== NÚT ===== */
#btn-close-info {
    margin: 18px auto 0;
    padding: 10px 26px;

    /* background: linear-gradient(#006699, #3399cc); */
	background: linear-gradient(#0066cc, #0099ff);
    border: 1px solid #6a4a1f;
    border-radius: 20px;

    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

#btn-close-info:hover {
   /*  background: linear-gradient(#0066cc, #0099ff); */
	 background: linear-gradient(#006699, #3399cc);
    transform: translateY(-1px);
}

/* ===== TABLET ===== */
@media (max-width: 1024px) {
    #info-panel-content {
        width: 380px;
        aspect-ratio: 4 / 3;
        padding: 22px 24px;
    }

    #info-panel-content h2 {
        font-size: 20px;
    }

    #info-text {
        font-size: 14.5px;
    }
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

    #info-panel {
        align-items: flex-end;
    }

    #info-panel-content {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 4 / 3;      /* ⭐ GIỮ NGUYÊN TỶ LỆ DESKTOP */
        border-radius: 16px 16px 0 0;

        padding: 20px 18px 22px;
        animation: slideUp 0.35s ease;
    }

   #info-panel-content h2 {
        font-size: 21px;
        letter-spacing: 0.5px;
    }

     #info-text {
        font-size: 17px;     
        line-height: 1.75;
    }

    #btn-close-info {
        width: 100%;
        padding: 12px 0;
        font-size: 15px;
    }
}

/* ===== MOBILE NHỎ ===== */
@media (max-width: 480px) {
    #info-panel-content {
        padding: 18px 14px 20px;
    }

    #info-panel-content h2 {
        font-size: 17px;
    }

    #info-text {
        font-size: 13.5px;
    }
}

/* ===== ANIMATION ===== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ================================
   TOOLBAR
   ================================*/
/* #toolbar {
    width: 100%;
    height: 65px;
    background: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;            
    border-top: 2px solid #000;
    box-sizing: border-box;
}

#toolbar button {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #333;
    border: 2px solid #555;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.15s;
}

#toolbar button:hover {
    background: #555;
}

#toolbar img {
    width: 28px;
    height: 28px;
    pointer-events: none;
}
 */
/* ================================
   PREVIEW LIST (CĂN GIỮA + SCROLL)
   ================================*/
   /* ===== Preview card as single image with top tab ===== */
/* ================================
   PREVIEW CARD (ĐẸP GIỐNG HÌNH MẪU)
================================ */
#preview-list {
    width: 100%;
    padding: 30px 0 20px;
    display: flex;
    justify-content: center;
    position: relative;
	 overflow: hidden;        /* ⭐ tab Text KHÔNG cuộn */
  /*   background: transparent; */
	background: #111;
}

/* CARD chứa thumbnail */
#preview-content {
    width: 100%;                 /* ⭐ full ngang */
    max-width: 100%;             /* ⭐ không bị thu lại */
    padding: 20px 26px;

    display: flex;
    justify-content: center;     /* ⭐ ảnh nằm giữa */
    gap: 16px;

    background: #1a1a1a;
    border-radius: 0;            /* ⭐ bỏ bo để sát mép */
    box-shadow: 0 10px 28px rgba(0,0,0,0.55);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
	  overflow-x: auto;         /* ⭐ cuộn ngang chỉ ở phần ảnh */
    overflow-y: hidden;
	scroll-behavior: smooth;
}

/* #preview-content {
    display: flex;
    gap: 14px;
    padding: 18px 24px;
    background: rgba(8, 8, 8, 0.92);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.55);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
    z-index: 2;
}
 */
/* Nút label dạng tab cong giống hình */
/* #preview-label {
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translate(-50%, 90%);
    
    padding: 6px 32px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;

    background: linear-gradient(#1a1a1a, #0c0c0c);
    border-radius: 10px 10px 14px 14px;

    box-shadow: 
        0 6px 16px rgba(0,0,0,0.55),
        inset 0 0 6px rgba(255,255,255,0.12);

    z-index: 5;
}
 */
 #preview-label {
    position: absolute;
    top: 0px;
    left: 50%;
   /*  transform: translate(-50%, 90%); */
      transform: translate(-50%, -8%);   /* ⭐ luôn neo đúng ở đỉnh card */
  /*   padding: 16px 90px;      */           /* tăng để hợp với ảnh nền */
  padding: clamp(10px, 1.8vw, 18px) clamp(30px, 6vw, 90px);

  /*   font-size: 20px; */
	font-size: 18px;  
/* min = 12px, theo viewport 2vw, max = 20px */

    font-weight: 600;
    color: #ffcc33; 

    /* ⭐ HIỂN THỊ TOÀN BỘ PNG */
    background-image: url("icons/2label_btn_bg.png");
   /*  background-size: 100% 100%;   */      /* ⭐ scale đúng theo container */
    background-size: contain;
	background-repeat: no-repeat;
    background-position: center;

    border-radius: 0;                  /* ⭐ bỏ bo vì PNG đã bo sẵn */

    /* ⭐ hiệu ứng đổ bóng đẹp */
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55));

    z-index: 20;
}

/* Thumbnail trong card */
#preview-content img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;

    transition: 0.2s ease;
}

#preview-content img:hover {
    transform: scale(1.25);
    outline: 2px solid #fff;
    z-index: 10;
}

/* #preview-list {
    width: 100%;
    height: 140px;
    background: #111;
    display: flex;
    justify-content: center;    
    align-items: center;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 10px;
    overflow-x: auto;            
  	overflow-y: visible;       
    box-sizing: border-box;
    border-top: 2px solid #000;
z-index: 1000;     
    scroll-behavior: smooth;
} */

/* Không cho các thumbnail bị ép nhỏ */
/* #preview-list img {
    width: 120px;
    height: 120px;
    flex-shrink: 0;              
    object-fit: cover;
    border-radius: 6px;
    background: #333;
    cursor: pointer;
    transition: 0.15s;
}

#preview-list img:hover {
    outline: 2px solid #fff;
    transform: scale(1.4);
	z-index: 999;
} */
#preview-list img {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
    background: #333;
    cursor: pointer;
    transition: transform 0.2s ease, outline 0.2s ease;
    position: relative;     /* ⭐ QUAN TRỌNG: cho phép nổi lên */
    z-index: 1;             /* baseline */
}
#preview-list img:hover {
     transform: scale(1.4) translateY(30px);  /* ⭐ CHÌA KHÓA */
    outline: 2px solid #fff;
    z-index: 9999;          /* ⭐ vượt qua viewer-container */
}
/* Thanh scrollbar đẹp hơn */
#preview-list::-webkit-scrollbar {
    height: 10px;
}
#preview-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
}
#preview-list::-webkit-scrollbar-track {
    background: #222;
}
/* ================================
   PREVIEW LIST 2 – TRANG PHỤC
================================ */
#preview-list-2 {
    width: 100%;
    padding: 30px 0 20px;
    display: flex;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #111;
    margin-top: 10px; /* cách ra 1 tí cho đẹp */
}

#preview-label-2 {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -8%);
   padding: clamp(10px, 1.8vw, 18px) clamp(30px, 6vw, 90px);

   font-size: 18px;  
/* min = 12px, theo viewport 2vw, max = 20px */

    font-weight: 600;
    color: #ffcc33;

    background-image: url("icons/2label_btn_bg.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    border-radius: 0;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.55));
    z-index: 20;
}

/* CARD chứa ảnh trang phục */
#preview-content-2 {
    width: 100%;
    max-width: 100%;
    padding: 20px 26px;

    display: flex;
    justify-content: center;
    gap: 16px;

    background: #1a1a1a;
    border-radius: 0;
    box-shadow: 0 10px 28px rgba(0,0,0,0.55);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);

    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

/* thumbnail trang phục */
#preview-content-2 img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s ease;
}

#preview-content-2 img:hover {
    transform: scale(1.25);
    outline: 2px solid #fff;
    z-index: 10;
}

/* ================================
   RESPONSIVE CHO MOBILE / TABLET
   ================================*/
@media (max-width: 768px) {
    #toolbar {
        height: 55px;
        gap: 10px;
    }

    #toolbar button {
        width: 45px;
        height: 45px;
    }

    #preview-list {
        height: 120px;
    }

    #preview-list img {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    #toolbar {
        height: 50px;
        gap: 8px;
    }

    #toolbar button {
        width: 40px;
        height: 40px;
    }

    #preview-list {
        height: 110px;
        padding: 8px;
        gap: 8px;
    }

    #preview-list img {
        width: 90px;
        height: 90px;
    }
}
/* ===============================
   MOBILE / TABLET AUTO SCALE
=============================== */
@media (max-width: 768px) {
    #info-panel {
        width: 90vw;
        bottom: 10px;
        left: 10px;
    }

    #info-panel h2 {
        font-size: 16px;
    }

    #info-text {
        font-size: 13px;
    }

    #btn-close-info {
        padding: 7px;
    }
}
/* cho menu*/
/* ============================================================
   MOBILE RESPONSIVE MENU
   Áp dụng cho màn hình nhỏ hơn 768px
============================================================ */
/* Hide mobile icons on desktop */
.mobile-icon {
    display: none;
}
@media (max-width: 768px) {

    #top-menu {
        height: 60px;
        padding: 0 16px;
    }

    .menu-logo {
        height: 26px;
    }

    /* Ẩn link menu & search box & big buttons */
    .menu-link,
    .search-box,
    .menu-btn {
        display: none;
    }

    /* Hiển thị icon mobile */
    .mobile-icon {
        display: block;
        font-size: 24px;
        color: white;
        cursor: pointer;
        padding: 6px;
    }

    #mobile-menu-btn {
        margin-left: 10px;
    }

    #mobile-search-btn {
        margin-right: 10px;
    }

    /* Ẩn menu-right */
    .menu-right {
        display: none;
    }

    /* Format left area as space-between */
    .menu-left {
        width: 100%;
        justify-content: space-between;
    }
}
/* =========================================
   IPHONE PORTRAIT – FORCE MOBILE UI
========================================= */
@media screen and (max-width: 480px) {

    /* 1. Scale chữ gốc cho iOS */
    html {
        font-size: 18px; /* 🔥 chìa khóa */
    }

    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* 2. Top menu */
    #top-menu {
        height: 60px;
        padding: 0 14px;
    }

    /* Ẩn menu desktop – dùng mobile hoàn toàn */
    .menu-link,
    .search-box,
    .menu-btn {
        display: none !important;
    }

    /* 3. Icon mobile */
    .mobile-icon {
        font-size: 26px;
        padding: 8px;
    }

    /* 4. Nút trong viewer (Stop Rotate / Info) */
    .btn-3d {
        font-size: 17px;
        padding: 10px 16px;
    }

    /* 5. INFO PANEL – text đọc được */
    #info-panel-content h2 {
        font-size: 20px;
    }

    #info-text {
        font-size: 17px;
        line-height: 1.75;
    }

    #btn-close-info {
        font-size: 16px;
    }

    /* 6. Label “Text”, “Trang phục” */
    #preview-label,
    #preview-label-2 {
        font-size: 19px;   /* bỏ clamp */
    }

    /* 7. Thumbnail list */
    #preview-content img,
    #preview-content-2 img {
        width: 88px;
        height: 88px;
    }
}
/* ============================
   MOBILE FIX SCROLL
============================ */
@media (max-width: 768px) {

    #viewer-container {
        height: 60vh;          /* 🔥 giảm xuống */
        min-height: 360px;     /* đảm bảo không quá bé */
        overflow: visible;     /* cho phép body cuộn */
    }
	html, body {
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* cuộn mượt iOS */
    }
	  #preview-list,
    #preview-list-2 {
        padding-bottom: 24px;
    }
}
/* =====================================
   FIX INFO PANEL – IPHONE PORTRAIT
===================================== */
/* =====================================
   INFO PANEL – MOBILE GỌN GÀNG
===================================== */
@media (max-width: 480px) {

    #info-panel {
        align-items: flex-end;
        padding: 10px;
    }

    #info-panel-content {
        width: 100%;
        max-width: 100%;

        /* 🔥 THU NHỎ BANNER */
        aspect-ratio: auto;
        height: auto;
        max-height: 52vh;          /* ⭐ quan trọng: thấp hơn nữa */

       padding-top: 26px;    /* ⭐ giảm padding */

        overflow-y: auto;
        justify-content: flex-start;

        border-radius: 14px 14px 10px 10px;
    }

    #info-panel-content h2 {
         margin-top: 10px;    
        margin-bottom: 6px;
        font-size: 16px;
        line-height: 1.3;
    }

    #info-panel-content .line {
        margin: 6px auto 10px;
    height: 2px;

    background: rgba(120, 70, 10, 0.6); /* 🔥 THÊM DÒNG NÀY */
    opacity: 1;

    width: 60px;
    border-radius: 2px;
	  position: relative;  
	  box-shadow: 
        0 1px 0 rgba(255,255,255,0.35),
        0 -1px 0 rgba(80,40,5,0.35)
    }

    #info-text {
        margin-top: 0;        
        padding-top: 0;
        font-size: 14.5px;
        line-height: 1.55;
    }

    #btn-close-info {
        margin-top: 10px;
        padding: 10px 0;
        font-size: 14px;
        width: 100%;
    }
}

