/* =========================================================================
   MODULE "KHONG GIAN 3D" - modal xem anh 3D (toan canh 360 do / nghieng sau)
   ========================================================================= */
body.hlx3d-khoa-cuon { overflow: hidden; }

.hlx3d-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.hlx3d-modal.hlx3d-mo { display: flex; animation: hlx3dFadeIn .18s ease; }
@keyframes hlx3dFadeIn { from { opacity: 0; } to { opacity: 1; } }

.hlx3d-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(12,74,110,0.92), rgba(3,20,32,0.97));
  backdrop-filter: blur(3px);
}

.hlx3d-panel {
  position: relative;
  width: min(1200px, 97vw);
  height: min(780px, 94vh);
  background: #06141c;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(34,211,238,.15);
  display: flex;
  flex-direction: column;
}

/* ---------- Man hinh "Bat dau kham pha" (chi hien khi tour co > 1 canh) ---------- */
.hlx3d-start {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.hlx3d-start.hlx3d-start-hien { display: flex; animation: hlx3dFadeIn .25s ease; }
.hlx3d-start-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(16px) brightness(.5) saturate(1.15);
  transform: scale(1.15);
}
.hlx3d-start-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(6,20,28,.35), rgba(3,12,18,.9));
}
.hlx3d-start-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.hlx3d-start-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  padding: 2rem;
  color: #fff;
}
.hlx3d-start-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34,211,238,.16);
  border: 1px solid rgba(34,211,238,.5);
  color: #a5f3fc;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.hlx3d-start-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .5rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.hlx3d-start-count { color: #cfe8f2; font-size: .92rem; margin-bottom: 1.7rem; line-height: 1.5; }
.hlx3d-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold, #fb923c), var(--gold-dark, #ea580c));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: .85rem 1.9rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 10px 26px rgba(234,88,12,.4);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: hlx3dPulseBtn 2.2s ease-in-out infinite;
}
.hlx3d-start-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 32px rgba(234,88,12,.55); }
@keyframes hlx3dPulseBtn {
  0%, 100% { box-shadow: 0 10px 26px rgba(234,88,12,.4); }
  50% { box-shadow: 0 10px 34px rgba(234,88,12,.65); }
}

/* ---------- Nut cong cu (toan man hinh / tu xoay) ---------- */
.hlx3d-tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.hlx3d-tool-btn:hover { background: rgba(255,255,255,.22); }
.hlx3d-tool-btn-active { background: var(--teal, #22d3ee); color: #06141c; border-color: transparent; }

/* ---------- La ban chi huong (chi hien o che do toan canh) ---------- */
.hlx3d-compass {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(6,20,28,.65);
  border: 1px solid rgba(255,255,255,.25);
  display: none;
  align-items: center;
  justify-content: center;
}
.hlx3d-compass-label {
  position: absolute;
  top: 4px;
  font-size: .58rem;
  color: #a5f3fc;
  font-weight: 700;
  letter-spacing: .5px;
}
.hlx3d-compass-dot {
  color: var(--teal, #22d3ee);
  font-size: .95rem;
  transform-origin: 50% 65%;
  transition: transform .05s linear;
}

/* ---------- Thanh chuyen canh (scene strip) - chi hien khi tour co nhieu canh ---------- */
.hlx3d-scene-strip {
  display: none;
  gap: 10px;
  padding: 12px 16px;
  overflow-x: auto;
  background: linear-gradient(0deg, rgba(6,20,28,.98), rgba(6,20,28,.85));
  border-top: 1px solid rgba(34,211,238,.18);
  flex-shrink: 0;
}
.hlx3d-scene-strip::-webkit-scrollbar { height: 6px; }
.hlx3d-scene-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 999px; }
.hlx3d-scene-thumb {
  flex: 0 0 auto;
  width: 108px;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #0a1c26;
  padding: 0;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.hlx3d-scene-thumb:hover { transform: translateY(-2px); }
.hlx3d-scene-thumb img { width: 100%; height: 62px; object-fit: cover; display: block; opacity: .75; transition: opacity .15s ease; }
.hlx3d-scene-thumb:hover img { opacity: 1; }
.hlx3d-scene-thumb-label {
  display: block;
  font-size: .68rem;
  color: #d7ecf3;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hlx3d-scene-thumb-active { border-color: var(--teal, #22d3ee); }
.hlx3d-scene-thumb-active img { opacity: 1; }
.hlx3d-scene-strip-an { display: none !important; }

/* ---------- Nhan ten canh dang xem (giong "Ha Long 360 - 3" tren cac tour VR360) ---------- */
.hlx3d-scene-label {
  position: absolute;
  left: 16px;
  bottom: 68px;
  z-index: 4;
  max-width: 70%;
  background: rgba(6,20,28,.72);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Thanh dieu khien duoi (prev/grid/home/zoom/fullscreen/next) - lay
   cam hung tu thanh dieu khien cua cac tour VR360 chuyen dung ---------- */
.hlx3d-controlbar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(6,20,28,.78);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 6px;
  backdrop-filter: blur(4px);
}
.hlx3d-ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #dcecf2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
  transition: background .15s ease, color .15s ease;
}
.hlx3d-ctrl-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.hlx3d-ctrl-btn.hlx3d-tool-btn-active { background: var(--teal, #22d3ee); color: #06141c; }
.hlx3d-ctrl-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,.2);
  margin: 0 2px;
}

.hlx3d-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(6,20,28,.98), rgba(6,20,28,.85));
  border-bottom: 1px solid rgba(34,211,238,.18);
  z-index: 3;
}
.hlx3d-titles { min-width: 0; }
.hlx3d-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
  color: #06141c;
  background: linear-gradient(90deg, var(--teal, #22d3ee), var(--navy-light, #0ea5e9));
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.hlx3d-title { color: #fff; font-size: 1.05rem; font-weight: 800; margin: 0 0 2px; }
.hlx3d-mota { color: #a9c4d1; font-size: .85rem; margin: 0; max-width: 640px; }

.hlx3d-actions { display: flex; align-items: flex-start; gap: 8px; flex-shrink: 0; }
.hlx3d-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold, #fb923c);
  color: #06141c !important;
  font-weight: 700;
  font-size: .82rem;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease;
}
.hlx3d-link-btn:hover { background: var(--gold-dark, #ea580c); transform: translateY(-1px); }
.hlx3d-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.hlx3d-close:hover { background: rgba(255,255,255,.22); }

.hlx3d-stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}
.hlx3d-stage { position: absolute; inset: 0; }
.hlx3d-canvas-wrap { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.hlx3d-canvas-wrap:active { cursor: grabbing; }
.hlx3d-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

.hlx3d-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #cfe8f2; font-size: .88rem;
}
.hlx3d-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(34,211,238,.25); border-top-color: var(--teal, #22d3ee);
  animation: hlx3dSpin .8s linear infinite;
}
@keyframes hlx3dSpin { to { transform: rotate(360deg); } }

.hlx3d-hint {
  position: absolute; left: 50%; bottom: 68px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 3;
  pointer-events: none;
}
.hlx3d-hint-drag {
  pointer-events: none;
  background: rgba(6,20,28,.72);
  color: #e6f6fb;
  font-size: .78rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.15);
  animation: hlx3dHintPulse 2.4s ease-in-out infinite;
}
@keyframes hlx3dHintPulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }
.hlx3d-hint-gyro {
  pointer-events: all;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(34,211,238,.18);
  border: 1px solid rgba(34,211,238,.5);
  color: #d7fbff;
  font-size: .78rem;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Nghieng sau 3D (tilt/parallax) ---------- */
.hlx3d-tilt-wrap {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  perspective: 1200px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(34,211,238,.10), transparent 60%),
    #050f16;
}
.hlx3d-tilt-stage {
  position: relative;
  max-width: 92%; max-height: 88%;
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 40px 70px rgba(0,0,0,.55);
}
.hlx3d-tilt-stage.hlx3d-tilt-sang { transition: transform .12s ease-out; }
.hlx3d-tilt-img { display: block; max-width: 100%; max-height: 88vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.hlx3d-tilt-glare {
  position: absolute; inset: 0;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ---------- Nut kich hoat "Xem 3D" dung tren cac trang chi tiet ---------- */
.hlx3d-trigger {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6,20,28,.72);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(4px);
  font-size: .8rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
  transition: background .15s ease, transform .15s ease;
}
.hlx3d-trigger:hover { background: var(--navy, #0284c7); transform: translateY(-2px); color: #fff; }
.hlx3d-trigger i { color: var(--teal, #22d3ee); }

@media (max-width: 576px) {
  .hlx3d-panel { border-radius: 0; width: 100vw; height: 100vh; }
  .hlx3d-topbar { flex-wrap: wrap; }
  .hlx3d-mota { display: none !important; }
  .hlx3d-start-title { font-size: 1.25rem; }
  .hlx3d-start-count { font-size: .82rem; }
  .hlx3d-start-content { padding: 1.2rem; }
  .hlx3d-scene-thumb { width: 82px; }
  .hlx3d-scene-thumb img { height: 48px; }
  .hlx3d-compass { width: 38px; height: 38px; top: 10px; right: 10px; }
  .hlx3d-ctrl-btn { width: 30px; height: 30px; font-size: .82rem; }
  .hlx3d-controlbar { gap: 2px; padding: 4px; bottom: 10px; }
  .hlx3d-scene-label { font-size: .72rem; bottom: 58px; left: 10px; max-width: 60%; }
  .hlx3d-hint { bottom: 60px; }
}
