/* ====== 首次訪問引導提示樣式 ====== */

/* 引導覆蓋層 */
.first-visit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.first-visit-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 引導提示氣泡 */
.guide-tooltip {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 280px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(220, 220, 220, 0.8);

  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.first-visit-overlay.active .guide-tooltip {
  opacity: 1;
  transition-delay: 0.3s;
}

/* 提示氣泡內容 */
.guide-tooltip-content {
  position: relative;
}

.guide-tooltip-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c2c2c;
  margin-bottom: 8px;
  font-family: 'Noto Sans TC', sans-serif;
}

.guide-tooltip-text {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 12px;
  font-family: 'Noto Sans TC', sans-serif;
}

/* Checkbox 容器 */
.guide-checkbox-container {
  margin-bottom: 16px;
}

.guide-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  font-family: 'Noto Sans TC', sans-serif;
  user-select: none;
}

.guide-checkbox {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  cursor: pointer;
  accent-color: #f39c12;
}

.guide-checkbox-text {
  line-height: 1.4;
}

/* 關閉按鈕 */
.guide-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  background: #f3ead8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #a09f97;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.guide-close-btn:hover {
  background: #e9e0c7;
  transform: scale(1.1);
  color: #333;
}

/* 指向箭頭 */
.guide-arrow {
  position: absolute;
  bottom: -12px;
  right: 30px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* 動畫指示線 */
.guide-pointer-line {
  position: fixed;
  bottom: 65px;
  right: 65px;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #f39c12 50%, transparent 100%);
  transform-origin: right center;
  transform: rotate(-45deg) scaleX(0);
  animation: drawLine 1.5s ease-in-out infinite;
  animation-delay: 0.8s;
}

@keyframes drawLine {
  0%, 20% {
    transform: rotate(-45deg) scaleX(0);
    opacity: 0;
  }
  40%, 60% {
    transform: rotate(-45deg) scaleX(1);
    opacity: 1;
  }
  80%, 100% {
    transform: rotate(-45deg) scaleX(0);
    opacity: 0;
  }
}

/* FAB按鈕脈動效果（當引導顯示時） */
.first-visit-overlay.active ~ .fab-container .fab {
  animation: fabPulse 2s ease-in-out infinite;
  animation-delay: 1s;
}

@keyframes fabPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.25);
  }
  50% {
    transform: scale(1.1);
    box-shadow: -6px 6px 16px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(243, 234, 216, 0.3);
  }
}

/* 響應式設計 */
@media (max-width: 768px) {
  .guide-tooltip {
    right: 15px;
    bottom: 70px;
    max-width: 250px;
    padding: 16px 20px;
  }
  
  .guide-tooltip-title {
    font-size: 16px;
  }
  
  .guide-tooltip-text {
    font-size: 13px;
  }
  
  .guide-pointer-line {
    width: 40px;
    right: 50px;
    bottom: 55px;
  }
}

@media (max-width: 480px) {
  .guide-tooltip {
    right: 10px;
    bottom: 60px;
    max-width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }
  
  .guide-arrow {
    right: 50%;
    transform: translateX(50%);
  }
  
  .guide-pointer-line {
    display: none; /* 在小螢幕上隱藏指示線 */
  }
}

/* 淡出動畫 */
.first-visit-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

.first-visit-overlay.fade-out .guide-tooltip {
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

/* 確保引導提示在FAB按鈕上方但不會被其他元素遮蓋 */
.first-visit-overlay {
  pointer-events: auto;
}

.first-visit-overlay.active {
  pointer-events: auto;
}

/* 當引導顯示時，防止背景滾動 */
body.guide-active {
  overflow: hidden;
}

/* 高對比度模式支援 */
@media (prefers-contrast: high) {
  .guide-tooltip {
    border: 2px solid #333;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }

  .guide-tooltip-title {
    color: #000;
  }

  .guide-tooltip-text {
    color: #333;
  }

  .guide-arrow {
    border-top-color: #ffffff;
  }
}

/* 減少動畫模式支援 */
@media (prefers-reduced-motion: reduce) {
  .guide-tooltip,
  .first-visit-overlay,
  .guide-close-btn {
    transition: none;
  }

  .first-visit-overlay.active .guide-tooltip {
    transition-delay: 0s;
  }

  .guide-pointer-line {
    animation: none;
    opacity: 0.7;
    transform: rotate(-45deg) scaleX(1);
  }

  .fab {
    animation: none !important;
  }
}
