/* ========================
   任務解鎖系統樣式
   ======================== */

/* 浮動按鈕（右下角）*/
.quest-float-btn {
  position: fixed !important;
  bottom: 30px !important;
  right: 30px !important;
  z-index: 9990 !important;
  cursor: pointer;
  transition: all 0.3s var(--ease-apple);
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.quest-float-btn:hover {
  transform: scale(1.05);
}

.quest-btn-wrapper {
  position: relative;
  width: 70px;
  height: 70px;
}

/* 圓形進度環 */
.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 70px;
  height: 70px;
  transform: rotate(-90deg);
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
  stroke: var(--primary);
  stroke-width: 3;
  fill: none;
  filter: drop-shadow(0 0 8px rgba(0, 205, 180, 0.6));
}

.progress-ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 3;
  fill: none;
}

/* 按鈕核心 */
.quest-btn-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 205, 180, 0.4);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(0, 205, 180, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(0, 205, 180, 0.8);
  }
}

.quest-icon {
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.quest-progress-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

/* 脈衝動畫（未完成時） */
.quest-float-btn.incomplete .quest-btn-core {
  animation: pulse-glow 2s infinite, bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* 面板遮罩層 */
.quest-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 997;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

/* 任務面板（側邊滑出）*/
.quest-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: rgba(10, 10, 15, 0.98);
  backdrop-filter: blur(30px);
  border-left: 2px solid var(--primary);
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 999;
  transition: right 0.4s var(--ease-apple);
  overflow-y: auto;
  visibility: hidden;
}

.quest-panel.active {
  right: 0;
  visibility: visible;
}

/* 面板頭部 */
.quest-header {
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, rgba(0, 205, 180, 0.2) 0%, rgba(255, 193, 7, 0.1) 100%);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px);
}

.quest-close-btn {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quest-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.quest-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.quest-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 整體進度 */
.quest-overall-progress {
  padding: var(--spacing-lg);
  background: rgba(0, 0, 0, 0.3);
  margin: var(--spacing-lg);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.progress-bar-quest {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-fill-quest {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 6px;
  transition: width 0.6s var(--ease-apple);
  position: relative;
  overflow: hidden;
}

.progress-fill-quest::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 任務列表 */
.quest-tasks {
  padding: var(--spacing-lg);
}

.task-item {
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  transition: all 0.3s ease;
  cursor: pointer;
}

.task-item:hover {
  border-color: var(--primary);
  transform: translateX(-4px);
}

.task-item.completed {
  border-color: #4caf50;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, var(--glass-bg) 100%);
}

.task-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.task-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.task-item.completed .task-icon {
  background: #4caf50;
}

.task-info {
  flex: 1;
}

.task-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.task-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.task-status {
  flex-shrink: 0;
  font-size: 1.5rem;
}

.task-action {
  margin-top: var(--spacing-md);
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.task-action:hover {
  background: var(--accent);
  transform: scale(1.02);
}

.task-item.completed .task-action {
  background: #4caf50;
  cursor: default;
}

/* 獎勵區塊 */
.quest-reward {
  margin: var(--spacing-lg);
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(0, 205, 180, 0.15) 100%);
  border: 2px solid var(--accent);
  border-radius: 16px;
  text-align: center;
}

.quest-reward.locked {
  opacity: 0.6;
  filter: grayscale(1);
}

.reward-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
}

.reward-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.reward-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.reward-value {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.original-price {
  font-size: 1rem;
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.discounted-price {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.savings {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 600;
}

.unlock-btn {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 205, 180, 0.4);
}

.unlock-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 205, 180, 0.6);
}

.unlock-btn:disabled {
  background: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================
   分享模態框
   ======================== */

.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.share-modal.active {
  display: flex;
}

.share-modal-content {
  background: rgba(20, 20, 30, 0.98);
  border: 2px solid var(--primary);
  border-radius: 24px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.4s var(--ease-apple);
}

.share-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.share-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.share-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.share-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.share-header p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.share-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}

.share-option-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.share-option-info {
  flex: 1;
}

.share-option-info h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.share-option-info p {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.share-btn {
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.share-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 205, 180, 0.4);
}

.share-btn-line {
  background: #06C755;
}

.share-btn-line:hover {
  box-shadow: 0 4px 12px rgba(6, 199, 85, 0.4);
}

.share-btn-fb {
  background: #1877F2;
}

.share-btn-fb:hover {
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.share-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.share-divider::before,
.share-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.share-email-section {
  margin-bottom: 1.5rem;
}

.email-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.share-email-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all 0.3s ease;
}

.share-email-input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.share-email-input::placeholder {
  color: var(--text-tertiary);
}

.share-submit-btn {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.share-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 205, 180, 0.4);
}

.share-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

.share-footer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* 文章預覽 */
.share-article-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(24, 119, 242, 0.1);
  border: 1px solid rgba(24, 119, 242, 0.3);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.article-thumbnail {
  width: 60px;
  height: 60px;
  background: #1877F2;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.article-info {
  flex: 1;
}

.article-source {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.article-title {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* 分享步驟 */
.share-steps {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin: 1.5rem 0;
}

.steps-title {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.share-complete-btn {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 205, 180, 0.3);
}

.share-complete-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 205, 180, 0.5);
}

/* 分享模態框響應式 */
@media (max-width: 480px) {
  .share-modal-content {
    padding: 1.5rem 1rem;
    border-radius: 16px;
  }

  .share-header h2 {
    font-size: 1.25rem;
  }

  .share-option {
    padding: 0.875rem;
  }

  .share-option-icon {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .share-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }
}

/* 解鎖成功模態框 */
.unlock-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.unlock-modal.active {
  display: flex;
}

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

.unlock-content {
  max-width: 600px;
  width: 90%;
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 2px solid var(--primary);
  border-radius: 24px;
  padding: var(--spacing-xxl);
  text-align: center;
  position: relative;
  animation: slideUp 0.5s var(--ease-apple);
}

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

.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary);
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.celebration-icon {
  font-size: 5rem;
  margin-bottom: var(--spacing-lg);
  animation: bounce-in 0.6s ease;
}

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

.unlock-message {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

.coupon-display {
  background: rgba(0, 0, 0, 0.3);
  padding: var(--spacing-xl);
  border-radius: 12px;
  border: 2px dashed var(--primary);
  margin: var(--spacing-xl) 0;
}

.coupon-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.coupon-code {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
  letter-spacing: 4px;
  margin-bottom: var(--spacing-md);
}

.copy-coupon-btn {
  padding: var(--spacing-sm) var(--spacing-xl);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-coupon-btn:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.discount-info {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(0, 205, 180, 0.1) 100%);
  border-radius: 12px;
}

.discount-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.countdown-timer {
  margin-top: var(--spacing-lg);
  font-size: 1rem;
  color: var(--text-secondary);
}

.timer-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
}

.cta-buttons {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.cta-buttons .btn {
  flex: 1;
}

/* 響應式 */
@media (max-width: 768px) {
  .quest-float-btn {
    bottom: 20px;
    right: 15px;
  }

  .quest-btn-wrapper {
    width: 56px;
    height: 56px;
  }

  .progress-ring {
    width: 56px !important;
    height: 56px !important;
  }

  .quest-btn-core {
    width: 44px;
    height: 44px;
  }

  .quest-icon {
    font-size: 1.125rem;
  }

  .quest-progress-text {
    font-size: 0.5625rem;
  }

  .quest-panel {
    width: 100%;
    max-width: 100%;
    right: -100% !important;
    visibility: hidden !important;
  }

  .quest-panel.active {
    right: 0 !important;
    visibility: visible !important;
  }

  .quest-header {
    padding: 1rem;
  }

  .quest-title {
    font-size: 1.25rem;
  }

  .quest-subtitle {
    font-size: 0.875rem;
  }

  .quest-overall-progress {
    margin: 1rem;
    padding: 1rem;
  }

  .quest-tasks {
    padding: 1rem;
  }

  .task-item {
    padding: 1rem;
  }

  .task-header {
    gap: 0.75rem;
  }

  .task-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .task-name {
    font-size: 0.9375rem;
  }

  .task-desc {
    font-size: 0.8125rem;
  }

  .task-status {
    font-size: 1.25rem;
  }

  .quest-reward {
    margin: 1rem;
    padding: 1.25rem;
  }

  .reward-icon {
    font-size: 2.5rem;
  }

  .reward-title {
    font-size: 1.125rem;
  }

  .reward-value {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .discounted-price {
    font-size: 1.5rem;
  }

  .unlock-content {
    width: 95%;
    padding: 1.5rem 1rem;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  .celebration-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
  }

  .unlock-message {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .coupon-display {
    padding: 1rem;
    margin: 1rem 0;
  }

  .coupon-code {
    font-size: 1.5rem;
    letter-spacing: 2px;
    word-break: break-all;
  }

  .discount-info {
    padding: 1rem;
  }

  .discount-amount {
    font-size: 1.25rem;
  }

  .quest-panel .cta-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .quest-panel .cta-buttons .btn {
    width: 100%;
  }
}

/* 更小螢幕 */
@media (max-width: 375px) {
  .quest-float-btn {
    right: 12px;
    bottom: 12px;
  }

  .quest-btn-wrapper {
    width: 50px;
    height: 50px;
  }

  .progress-ring {
    width: 50px !important;
    height: 50px !important;
  }

  .quest-btn-core {
    width: 40px;
    height: 40px;
  }

  .quest-icon {
    font-size: 1rem;
  }

  .quest-progress-text {
    font-size: 0.5rem;
  }

  .quest-header {
    padding: 0.875rem;
  }

  .quest-title {
    font-size: 1.125rem;
  }

  .task-item {
    padding: 0.875rem;
  }

  .unlock-message {
    font-size: 1.25rem;
  }

  .coupon-code {
    font-size: 1.25rem;
  }
}
