/* AR 模擬器樣式 */
.ar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #f8fafc;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden;
}

.ar-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* 全螢幕街景容器 */
.street-view-container.fullscreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* 浮動的頂部控制列 */
.ar-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 70%, rgba(255, 255, 255, 0.6) 100%);
  backdrop-filter: blur(10px);
  z-index: 10;
  transition: transform 0.3s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ar-location-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ar-location-info h2 {
  color: #333;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.ar-info-btn {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.ar-info-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
  transform: scale(1.1);
}

.ar-controls {
  display: flex;
  gap: 0.5rem;
}

.ar-control-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ar-control-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.ar-control-btn svg {
  width: 16px;
  height: 16px;
}

/* 關閉按鈕特殊樣式 - 提高優先級並改善配色 */
.ar-control-btn.close-btn {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #dc2626 !important;
}

.ar-control-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #b91c1c !important;
  transform: translateY(-2px) scale(1.05);
}

.ar-control-btn.minimize-btn {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.ar-control-btn.minimize-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #1d4ed8;
}

/* 浮動的 AI 聊天按鈕 */
.floating-ai-chat {
  position: absolute;
  bottom: 100px;
  right: 30px;
  z-index: 15;
}

.ai-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-chat-toggle.pulsing {
  animation: aiPulse 2s infinite;
}

@keyframes aiPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.ai-indicator {
  font-size: 1.5rem;
  position: absolute;
}

.ai-chat-tooltip {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  transform: translateY(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.floating-ai-chat:hover .ai-chat-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* 浮動的導航控制 */
.floating-navigation {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  gap: 0.5rem;
  z-index: 15;
  transition: transform 0.3s ease;
}

.nav-control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-control-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1f2937;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 最小化控制 */
.minimal-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 0.5rem;
  z-index: 12;
  animation: slideInFromTop 0.3s ease;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.minimal-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.minimal-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1f2937;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* UI 最小化狀態 */
.ar-container.ui-minimized .ar-header-overlay {
  transform: translateY(-100%);
}

.ar-container.ui-minimized .floating-navigation {
  transform: translateX(100%);
}

.fallback-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.fallback-image {
  margin-bottom: 2rem;
}

.location-placeholder {
  text-align: center;
}

.location-placeholder .location-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
}

.location-placeholder h3 {
  font-size: 2rem;
  margin: 0;
}

.fallback-info p {
  margin-bottom: 1rem;
  opacity: 0.8;
}

.retry-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retry-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* AR 覆蓋層 */
.ar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 20;
  backdrop-filter: blur(5px);
}

.ar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* AR 熱點 */
.ar-hotspots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
}

.ar-hotspot {
  position: absolute;
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
}

.ar-hotspot.visible {
  opacity: 1;
  transform: scale(1);
}

.hotspot-marker {
  position: relative;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.hotspot-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #ff6b6b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 2;
  position: relative;
  backdrop-filter: blur(10px);
}

.hotspot-marker:hover .hotspot-icon {
  transform: scale(1.2);
  box-shadow: 0 8px 35px rgba(255, 107, 107, 0.5);
  border-color: #ff5252;
}

.hotspot-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 60px;
  border: 3px solid #ff6b6b;
  border-radius: 50%;
  animation: pulse 2s infinite;
  opacity: 0.7;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.hotspot-tooltip {  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #374151;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 3;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.hotspot-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

.hotspot-tooltip h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.hotspot-tooltip p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.3;
}

.ar-hotspot:hover .hotspot-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* Enhanced AR Mode */
.ar-container.enhanced-ar .ar-hotspots.enhanced .ar-hotspot {
  animation: float 3s ease-in-out infinite;
}

.ar-container.enhanced-ar .ar-hotspots.enhanced .ar-hotspot:nth-child(even) {
  animation-delay: -1.5s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* AR Footer */
.ar-footer {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.ar-navigation {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.ar-nav-btn {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ar-nav-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
  transform: translateY(-2px);
}

/* 詳細資訊卡片 */
.hotspot-detail-card,
.location-info-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 15px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s ease;
}

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

.card-header,
.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-header h3,
.info-header h2 {
  margin: 0;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  font-size: 1.5rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* 通用關閉按鈕樣式 - 避免與 AR 控制按鈕衝突 */
.close-btn:not(.ar-control-btn) {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  font-size: 1.5rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:not(.ar-control-btn):hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #b91c1c;
  transform: scale(1.1);
}

/* 最小化按鈕也改善配色 */
.minimal-btn.close-btn {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #dc2626 !important;
}

.minimal-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #b91c1c !important;
  transform: scale(1.1);
}

/* 卡片動作按鈕樣式 */
.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.ai-ask-btn,
.favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  min-height: 36px;
}

.ai-ask-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ai-ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 100%);
}

.ai-ask-btn:active {
  transform: translateY(0);
}

.favorite-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.favorite-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  background: linear-gradient(135deg, #ff5252 0%, #ff7979 100%);
}

.favorite-btn:active {
  transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .ar-header-overlay {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.9) 70%, rgba(255, 255, 255, 0.7) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .ar-location-info h2 {
    font-size: 1.25rem;
  }

  .ar-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .ar-control-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .floating-ai-chat {
    bottom: 80px;
    right: 20px;
  }

  .ai-chat-toggle {
    width: 55px;
    height: 55px;
  }

  .floating-navigation {
    bottom: 20px;
    right: 20px;
  }

  .nav-control-btn {
    width: 45px;
    height: 45px;
  }

  .hotspot-detail-card,
  .location-info-card {
    padding: 1.5rem;
    width: 95%;
    max-width: 350px;
  }

  .hotspot-marker {
    width: 50px;
    height: 50px;
  }

  .hotspot-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .hotspot-pulse {
    width: 50px;
    height: 50px;
  }

  .hotspot-tooltip {
    bottom: 60px;
    padding: 0.5rem 1rem;
  }

  .hotspot-tooltip h4 {
    font-size: 0.9rem;
  }

  .hotspot-tooltip p {
    font-size: 0.8rem;
  }

  .card-actions {
    flex-direction: column;
  }
  
  .ai-ask-btn,
  .favorite-btn {
    width: 100%;
    justify-content: center;
  }
}

/* 極小螢幕優化 */
@media (max-width: 480px) {
  .ar-header-overlay {
    padding: 0.5rem;
  }

  .ar-location-info h2 {
    font-size: 1.1rem;
  }

  .ar-info-btn {
    width: 35px;
    height: 35px;
  }

  .ar-control-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  .floating-ai-chat {
    bottom: 70px;
    right: 15px;
  }

  .ai-chat-toggle {
    width: 50px;
    height: 50px;
  }

  .ai-indicator {
    font-size: 1.3rem;
  }

  .floating-navigation {
    bottom: 15px;
    right: 15px;
    gap: 0.3rem;
  }

  .nav-control-btn {
    width: 40px;
    height: 40px;
  }

  .hotspot-marker {
    width: 45px;
    height: 45px;
  }

  .hotspot-icon {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }

  .hotspot-pulse {
    width: 45px;
    height: 45px;
  }
}

/* 無障礙設計 */
@media (prefers-reduced-motion: reduce) {
  .ar-hotspot,
  .hotspot-marker,
  .hotspot-icon,
  .ar-control-btn,
  .nav-control-btn,
  .ai-chat-toggle {
    transition: none;
  }

  .hotspot-pulse {
    animation: none;
  }

  .ar-container.enhanced-ar .ar-hotspots.enhanced .ar-hotspot {
    animation: none;
  }

  .ai-chat-toggle.pulsing {
    animation: none;
  }
}

/* 高對比模式 */
@media (prefers-contrast: high) {  .ar-header-overlay {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.9) 70%, rgba(255, 255, 255, 0.7) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .hotspot-icon {
    background: #fff;
    border-color: #000;
    color: #000;
  }

  .hotspot-detail-card,
  .location-info-card {
    background: #fff;
    border: 3px solid #000;
  }
  .ai-chat-toggle {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
  }
  .nav-control-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    color: #374151;
  }

  .nav-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.2);
  }
}

/* AR 模式下聊天面板特殊樣式 */
.ar-container ~ .chat-panel {
  z-index: 1100; /* 確保在 AR 容器之上 */
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.ar-container ~ .chat-panel .chat-header {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ar-container ~ .chat-panel .chat-messages {
  background: rgba(255, 255, 255, 0.8);
}

.ar-container ~ .chat-panel .message.assistant {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.ar-container ~ .chat-panel .message.user {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* 確保聊天面板在 AR 模式下可見 */
body:has(.ar-container:not(.hidden)) .chat-panel {
  z-index: 1100;
}
/* AR 模式下聊天面板特殊樣式 */
.ar-container ~ .chat-panel {
  z-index: 1100; /* 確保在 AR 容器之上 */
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.ar-container ~ .chat-panel .chat-header {
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ar-container ~ .chat-panel .chat-messages {
  background: rgba(255, 255, 255, 0.8);
}

.ar-container ~ .chat-panel .message.assistant {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.ar-container ~ .chat-panel .message.user {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* 確保聊天面板在 AR 模式下可見 */
body:has(.ar-container:not(.hidden)) .chat-panel {
  z-index: 1100;
}
