/* ============================================
   NexFlow — B2B SaaS 官網首頁
   CSS Design System
   ============================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* 品牌色彩 */
  --primary: #6C63FF;
  --primary-glow: #7B73FF;
  --primary-dark: #5A52E0;
  --accent: #00D9FF;
  --accent-green: #00E676;

  /* 背景 */
  --bg-dark: #0A0E27;
  --bg-darker: #060918;
  --bg-card: #12162F;
  --bg-card-hover: #1A1F3D;
  --bg-section-alt: #0D1130;

  /* 文字 */
  --text-primary: #FFFFFF;
  --text-secondary: #8B8FAE;
  --text-muted: #5A5E7A;

  /* 邊框與陰影 */
  --border: rgba(108, 99, 255, 0.2);
  --border-light: rgba(255, 255, 255, 0.06);
  --glow-primary: 0 0 30px rgba(108, 99, 255, 0.3);
  --glow-accent: 0 0 30px rgba(0, 217, 255, 0.3);

  /* 狀態色 */
  --error: #FF5252;
  --error-bg: rgba(255, 82, 82, 0.1);
  --success: #00E676;
  --success-bg: rgba(0, 230, 118, 0.1);

  /* 間距 */
  --section-padding: 120px 0;
  --container-width: 1200px;

  /* 圓角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  /* 過渡 */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
}

input {
  font-family: inherit;
  outline: none;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Utility: Scroll Animation --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.delay-1 { transition-delay: 0.1s; }
.animate-on-scroll.delay-2 { transition-delay: 0.2s; }
.animate-on-scroll.delay-3 { transition-delay: 0.3s; }
.animate-on-scroll.delay-4 { transition-delay: 0.4s; }

/* ============================================
   1. NAVIGATION
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 16px 0;
  transition: background var(--transition-base), box-shadow var(--transition-base), padding var(--transition-base);
}

.navbar.scrolled {
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--border-light);
  padding: 12px 0;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.nav-logo span {
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-base);
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a:hover::after {
  width: 100%;
}

.btn-nav-cta {
  padding: 10px 24px;
  background: var(--primary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn-nav-cta:hover {
  background: var(--primary-glow);
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

/* Mobile Menu Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition-base);
}

/* ============================================
   2. HERO SECTION
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 80px;
}

#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 217, 255, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(108, 99, 255, 0.08) 0%, transparent 40%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 0 24px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(108, 99, 255, 0.12);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary-glow);
  margin-bottom: 28px;
  animation: fadeInDown 0.8s ease forwards;
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 24px;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.2s;
  opacity: 0;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.4s;
  opacity: 0;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.6s;
  opacity: 0;
}

.btn-primary {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  padding: 14px 32px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(108, 99, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: bounce 2s ease-in-out infinite;
}

.hero-scroll-indicator span {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
}

/* ============================================
   3. FEATURES SECTION
   ============================================ */
.features {
  padding: var(--section-padding);
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 72px;
}

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.feature-card {
  position: relative;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(108, 99, 255, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(0, 217, 255, 0.1));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.feature-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   4. METRICS SECTION
   ============================================ */
.metrics {
  padding: var(--section-padding);
  background: var(--bg-section-alt);
  position: relative;
}

.metrics::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.metrics::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.metric-item {
  text-align: center;
  padding: 32px 16px;
}

.metric-value {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   5. PRICING SECTION
   ============================================ */
.pricing {
  padding: var(--section-padding);
  position: relative;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  align-items: center;
}

.pricing-card {
  position: relative;
  padding: 44px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.pricing-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
}

.pricing-card.featured {
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              linear-gradient(135deg, var(--primary), var(--accent)) border-box;
  border: 2px solid transparent;
  padding: 52px 36px;
  transform: scale(1.04);
  box-shadow: 0 24px 64px rgba(108, 99, 255, 0.2);
}

.pricing-card.featured:hover {
  transform: scale(1.04) translateY(-4px);
}

.pricing-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pricing-plan-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.pricing-currency {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.pricing-amount {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
}

.pricing-period {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.pricing-features {
  margin-bottom: 36px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features li .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.pricing-features li .check.yes {
  background: var(--success-bg);
  color: var(--success);
}

.pricing-features li .check.no {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.btn-subscribe {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  transition: all var(--transition-fast);
}

.btn-subscribe.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-primary);
}

.btn-subscribe.primary:hover {
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4);
  transform: translateY(-2px);
}

.btn-subscribe.outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-subscribe.outline:hover {
  background: rgba(108, 99, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ============================================
   6. TESTIMONIALS SECTION
   ============================================ */
.testimonials {
  padding: var(--section-padding);
  background: var(--bg-section-alt);
  position: relative;
  overflow: hidden;
}

.testimonials::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.testimonial-slider {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.testimonial-item {
  display: none;
  text-align: center;
  padding: 40px 20px;
  animation: fadeIn 0.5s ease;
}

.testimonial-item.active {
  display: block;
}

.testimonial-quote {
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 32px;
  font-style: italic;
  position: relative;
}

.testimonial-quote::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 4rem;
  color: var(--primary);
  opacity: 0.3;
  font-family: Georgia, serif;
  line-height: 1;
}

.testimonial-author {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.testimonial-name {
  font-weight: 700;
  font-size: 1rem;
}

.testimonial-role {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.testimonial-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}

.testimonial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.testimonial-dot.active {
  background: var(--primary);
  transform: scale(1.3);
}

/* ============================================
   7. CTA SECTION
   ============================================ */
.cta-section {
  padding: var(--section-padding);
  position: relative;
  overflow: hidden;
}

.cta-box {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 72px 48px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.12), rgba(0, 217, 255, 0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
  overflow: hidden;
}

.cta-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(108, 99, 255, 0.08) 0%, transparent 50%);
  animation: rotateSlow 20s linear infinite;
  pointer-events: none;
}

.cta-box h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 16px;
  position: relative;
}

.cta-box p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 36px;
  position: relative;
}

.cta-form {
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.cta-form input {
  flex: 1;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.cta-form input::placeholder {
  color: var(--text-muted);
}

.cta-form input:focus {
  border-color: var(--primary);
}

.cta-form button {
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}

.cta-form button:hover {
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4);
  transform: translateY(-2px);
}

/* ============================================
   8. FOOTER
   ============================================ */
.footer {
  padding: 64px 0 32px;
  border-top: 1px solid var(--border-light);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand .nav-logo {
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 6px 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.footer-bottom p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  gap: 16px;
}

.footer-social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.footer-social a:hover {
  background: var(--primary);
  color: var(--text-primary);
}

.footer-social a svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ============================================
   MODAL — 模擬支付視窗
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 9, 24, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(108, 99, 255, 0.1);
  overflow: hidden;
  animation: modalSlideIn 0.4s ease;
  max-height: 90vh;
  overflow-y: auto;
}

/* 自訂滾動條 */
.modal::-webkit-scrollbar {
  width: 6px;
}
.modal::-webkit-scrollbar-track {
  background: transparent;
}
.modal::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.modal-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 1.2rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 82, 82, 0.15);
  color: var(--error);
}

.modal-plan-info {
  padding: 20px 32px;
  background: rgba(108, 99, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-plan-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.modal-plan-price {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary-glow);
}

/* --- 支付表單 --- */
.checkout-form {
  padding: 28px 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group label .optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-darker);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 4px;
}

.form-error.show {
  display: flex;
}

.form-divider {
  height: 1px;
  background: var(--border-light);
  margin: 24px 0;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.btn-pay {
  display: block;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  margin-top: 8px;
}

.btn-pay:hover {
  box-shadow: 0 8px 30px rgba(108, 99, 255, 0.4);
  transform: translateY(-2px);
}

.secure-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.secure-notice svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  fill: none;
}

/* --- Loading 狀態 --- */
.payment-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  text-align: center;
}

.payment-loading.show {
  display: flex;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 28px;
}

.payment-loading p {
  font-size: 1rem;
  color: var(--text-secondary);
  animation: loadingDots 1.5s ease-in-out infinite;
}

/* --- 付款成功 --- */
.payment-success {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}

.payment-success.show {
  display: flex;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
}

.success-checkmark .circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-dasharray: 252;
  stroke-dashoffset: 252;
  animation: drawCircle 0.6s ease forwards;
}

.success-checkmark .check {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: drawCheck 0.4s ease forwards;
  animation-delay: 0.5s;
}

.payment-success h3 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--success);
}

.payment-success .success-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.payment-success .order-id {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-family: 'Courier New', monospace;
  padding: 8px 16px;
  background: rgba(0, 230, 118, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 230, 118, 0.15);
}

.btn-back-home {
  padding: 14px 32px;
  background: var(--success);
  color: var(--bg-dark);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn-back-home:hover {
  box-shadow: 0 8px 30px rgba(0, 230, 118, 0.3);
  transform: translateY(-2px);
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes loadingDots {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes rotateSlow {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  .pricing-card.featured {
    transform: none;
    order: -1;
  }

  .pricing-card.featured:hover {
    transform: translateY(-4px);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --section-padding: 80px 0;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 32px 32px;
    gap: 24px;
    transition: right var(--transition-base);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
  }

  .nav-links.open {
    right: 0;
  }

  .nav-toggle {
    display: flex;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-cta-group {
    flex-direction: column;
  }

  .cta-form {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-item {
    padding: 20px 16px;
  }
}
