/* ==========================================================================
   BTH Virtual Tour — Voice Note (VN) & Transparent YouTube-style Comment Pop-up
   Specifically tailored for 360 Virtual Tour Fullscreen Viewer (Non-overlapping layout)
   ========================================================================== */

/* Container & Reset */
#bthTourVoiceContainer {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  pointer-events: none;
  z-index: 10000;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#bthTourVoiceContainer * {
  box-sizing: border-box;
}

/* ==========================================================================
   1. Control Dock di Kanan Bawah (Di Atas Menu Bar 3DVista, Anti-Tabrakan)
   ========================================================================== */
.bth-tour-control-dock {
  pointer-events: auto;
  position: absolute;
  bottom: 78px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10001;
}

/* Voice Note (VN) Primary Action Button (Right Bottom) */
.bth-vn-mic-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  position: relative;
  flex-shrink: 0;
}

.bth-vn-mic-btn:hover {
  transform: scale(1.08) translateY(-2px);
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

.bth-vn-mic-btn:active {
  transform: scale(1.14);
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.35), 0 14px 40px rgba(239, 68, 68, 0.5);
}

.bth-vn-mic-btn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

/* VN Button Tooltip (Melayang di atas tombol mic) */
.bth-vn-tooltip {
  position: absolute;
  bottom: 68px;
  right: 0;
  transform: translateY(6px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.bth-vn-mic-btn:hover .bth-vn-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Recording State Pulse & Waves */
.bth-vn-mic-btn.is-recording {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7), 0 8px 24px rgba(220, 38, 38, 0.4);
  animation: bth-mic-pulse 1.5s infinite;
}

@keyframes bth-mic-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.8);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
    transform: scale(1.1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    transform: scale(1);
  }
}

/* ==========================================================================
   2. Recording Status Floating HUD (Mengapung Tepat di Atas Dock Mic)
   ========================================================================== */
.bth-vn-recording-hud {
  pointer-events: auto;
  position: absolute;
  bottom: 144px;
  right: 24px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.95);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10002;
  white-space: nowrap;
  max-width: 380px;
}

.bth-vn-recording-hud.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Sound Wave Equalizer Animation */
.bth-vn-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  flex-shrink: 0;
}

.bth-vn-wave-bar {
  width: 3px;
  background: #f87171;
  border-radius: 3px;
  animation: bth-wave 1s ease-in-out infinite alternate;
}

.bth-vn-wave-bar:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.bth-vn-wave-bar:nth-child(2) { height: 18px; animation-delay: 0.3s; }
.bth-vn-wave-bar:nth-child(3) { height: 11px; animation-delay: 0.15s; }
.bth-vn-wave-bar:nth-child(4) { height: 20px; animation-delay: 0.4s; }
.bth-vn-wave-bar:nth-child(5) { height: 13px; animation-delay: 0.25s; }

@keyframes bth-wave {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.4); }
}

.bth-vn-hud-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.bth-vn-hud-cancel {
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #cbd5e1;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.bth-vn-hud-cancel:hover {
  background: rgba(239, 68, 68, 0.6);
  color: #ffffff;
}

/* ==========================================================================
   3. Keyboard Text Chat Form (Ramping & Expandable di Kanan Bawah)
   ========================================================================== */
.bth-tour-text-fallback {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  padding: 4px 6px 4px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  width: 230px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  height: 44px;
}

.bth-tour-text-fallback:focus-within {
  width: 310px;
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px rgba(59, 130, 246, 0.25);
}

.bth-tour-text-fallback input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.82rem;
  font-family: inherit;
}

.bth-tour-text-fallback input::placeholder {
  color: #94a3b8;
}

.bth-tour-text-fallback button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.bth-tour-text-fallback button:hover {
  background: #2563eb;
  transform: scale(1.05);
}

/* ==========================================================================
   4. YouTube Fullscreen Style Transparent Comment Pop-up (Pojok Kiri Bawah)
   ========================================================================== */
.bth-tour-popup {
  pointer-events: auto;
  position: absolute;
  bottom: 78px;
  left: 24px;
  max-width: 400px;
  width: calc(100% - 48px);
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  padding: 16px 18px;
  color: #ffffff;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10001;
}

.bth-tour-popup.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.bth-tour-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bth-tour-popup-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bth-tour-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.bth-tour-avatar svg {
  width: 18px;
  height: 18px;
}

.bth-tour-author-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bth-tour-author-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.3);
}

.bth-tour-user-prompt {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.bth-tour-popup-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.bth-tour-popup-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.bth-tour-popup-body {
  font-size: 0.84rem;
  line-height: 1.55;
  color: #e2e8f0;
  word-wrap: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.bth-tour-popup-body::-webkit-scrollbar {
  width: 4px;
}
.bth-tour-popup-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Dynamic Auto-Teleport Banner */
.bth-tour-nav-banner {
  margin-top: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.7) 0%, rgba(37, 99, 235, 0.5) 100%);
  border: 1px solid rgba(147, 197, 253, 0.4);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #bfdbfe;
}

.bth-tour-nav-banner svg {
  animation: bth-spin 3s linear infinite;
  color: #60a5fa;
  flex-shrink: 0;
}

@keyframes bth-spin {
  100% { transform: rotate(360deg); }
}

.bth-tour-teleport-again-btn {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.8) 0%, rgba(29, 78, 216, 0.9) 100%);
  border: 1px solid rgba(147, 197, 253, 0.6);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 8px;
  pointer-events: auto !important;
  user-select: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bth-tour-teleport-again-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.55);
}

.bth-tour-teleport-again-btn:active {
  transform: translateY(0) scale(0.94);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* ==========================================================================
   5. AI Remote Control Top Floating HUD
   ========================================================================== */
.bth-ai-remote-hud {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-24px) scale(0.92);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(59, 130, 246, 0.5);
  border-radius: 36px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(37, 99, 235, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100000;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bth-ai-remote-hud.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

.bth-remote-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
  animation: bth-radar-pulse 2s infinite ease-in-out;
}

@keyframes bth-radar-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.bth-remote-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bth-remote-badge {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #38bdf8;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bth-remote-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  animation: bth-dot-blink 1s infinite alternate;
}

@keyframes bth-dot-blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.bth-remote-title {
  font-size: 0.82rem;
  color: #f1f5f9;
  font-weight: 500;
  white-space: nowrap;
}

.bth-remote-title strong {
  color: #67e8f9;
  font-weight: 700;
}

/* ==========================================================================
   6. Responsif Layar Kecil / Mobile
   ========================================================================== */
@media (max-width: 640px) {
  .bth-tour-control-dock {
    bottom: 74px;
    right: 16px;
  }
  .bth-tour-text-fallback {
    width: 170px;
  }
  .bth-tour-text-fallback:focus-within {
    width: 240px;
  }
  .bth-tour-popup {
    left: 16px;
    bottom: 74px;
    width: calc(100% - 32px);
    max-width: 100%;
  }
  .bth-vn-recording-hud {
    bottom: 76px;
    right: 80px;
    max-width: 230px;
  }
  .bth-ai-remote-hud {
    top: 14px;
    width: calc(100% - 32px);
    padding: 8px 16px;
  }
}
