/* ========================================
   Serif Editorial Design System
   Based on style-prompt.md specifications
   ======================================== */

/* ----------------------------------------
   1. Design Tokens (CSS Variables)
   ---------------------------------------- */
:root {
  /* Colors - Monochrome with Warmth */
  --background: #FAFAF8;
  --foreground: #1A1A1A;
  --muted: #F5F3F0;
  --muted-foreground: #6B6B6B;
  --accent: #B8860B;
  --accent-secondary: #D4A84B;
  --accent-foreground: #FFFFFF;
  --border: #E8E4DF;
  --border-hover: #D4CFC8;
  --card: #FFFFFF;
  --ring: #B8860B;

  /* Semantic Colors */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  /* Typography */
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --container-max: 64rem;
  --container-padding: 1.5rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 26, 0.06);
  --shadow-lg: 0 8px 24px rgba(26, 26, 26, 0.08);
  --shadow-accent: 0 4px 12px rgba(184, 134, 11, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
}

/* ----------------------------------------
   CRITICAL: Hidden utility (must be early)
   ---------------------------------------- */
.hidden,
[hidden] {
  display: none !important;
  visibility: hidden !important;
}

/* ----------------------------------------
   2. Base Reset & Typography
   ---------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75; /* 優化中文行高 */
  color: var(--foreground);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600; /* 增強標題視覺權重 */
  line-height: 1.3; /* 略增行高 */
  letter-spacing: -0.02em;
  color: var(--foreground);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--accent-secondary);
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* Mono text - 優化對齊 */
.mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: -0.02em;
  vertical-align: baseline;
}

/* Price text */
.price {
  color: var(--accent);
  font-weight: 600;
}

/* Text Utilities - 文字工具類 */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-muted {
  color: var(--muted-foreground);
}

.text-accent {
  color: var(--accent);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

/* Screen Reader Only - 螢幕閱讀器專用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ----------------------------------------
   3. Layout
   ---------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Section Label */
.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.section-label-sm {
  font-size: 0.65rem;
  margin-bottom: var(--space-2);
}

.section-title {
  font-size: var(--text-3xl);
  text-align: center;
  margin-bottom: var(--space-8);
}

/* ----------------------------------------
   4. Buttons
   ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary */
.btn-primary {
  background-color: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-secondary);
  border-color: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
}

/* Secondary */
.btn-secondary {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--muted);
  border-color: var(--foreground);
}

/* Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--muted-foreground);
  border-color: transparent;
  padding: var(--space-2) var(--space-3);
  min-height: auto;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--foreground);
  background-color: var(--muted);
}

/* Danger */
.btn-danger {
  background-color: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background-color: #B91C1C;
  border-color: #B91C1C;
}

/* Google Login */
.btn-google {
  width: 100%;
  background-color: var(--card);
  color: var(--foreground);
  border-color: var(--border);
  gap: var(--space-3);
}

.btn-google:hover:not(:disabled) {
  background-color: var(--muted);
  border-color: var(--border-hover);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

/* Sizes */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  min-height: 52px;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  min-height: 36px;
}

.btn-full {
  width: 100%;
}

/* Loading State */
.btn.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.btn-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after {
  border-color: rgba(107, 107, 107, 0.3);
  border-top-color: var(--foreground);
}

/* ----------------------------------------
   5. Header
   ---------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--foreground);
}

.logo:hover {
  color: var(--foreground);
}

.logo svg {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-links a {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--foreground);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-base);
}

.user-menu-trigger:hover {
  background-color: var(--muted);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  min-width: 180px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown a,
.user-dropdown button {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--foreground);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-base);
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background-color: var(--muted);
}

.user-dropdown hr {
  margin: var(--space-2) 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* Mobile Menu */
.mobile-menu-toggle {
  display: none;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
}

.mobile-nav {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.mobile-nav a {
  display: block;
  padding: var(--space-3) 0;
  color: var(--foreground);
}

.mobile-nav hr {
  margin: var(--space-3) 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* ----------------------------------------
   6. Hero
   ---------------------------------------- */
.hero {
  padding: var(--space-24) 0;
  text-align: center;
}

.hero .container {
  max-width: 48rem;
}

.hero-title {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-6);
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--muted-foreground);
  margin-bottom: var(--space-8);
  line-height: 1.8;
}

/* ----------------------------------------
   7. Products Section
   ---------------------------------------- */
.products-section {
  padding: var(--space-16) 0;
  background-color: var(--muted);
}

.products-section .container {
  text-align: center;
}

/* Product Tabs */
.product-tabs {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-10);
}

.product-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.product-tab.active {
  background-color: var(--accent);
  color: white;
}

.product-tab:not(.active):hover {
  color: var(--foreground);
  background-color: var(--muted);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  max-width: 900px;
  margin: 0 auto;
}

/* Product Card */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  padding-top: var(--space-10);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card .btn {
  margin-top: auto;
}

/* 金色邊框光暈效果 */
.product-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.product-card:hover:not(.owned)::before {
  opacity: 1;
}

.product-card:hover:not(.owned) {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 12px 32px rgba(26, 26, 26, 0.1),
    0 0 0 1px rgba(184, 134, 11, 0.1);
}

/* 已擁有狀態 - 強化視覺 */
.product-card.owned {
  cursor: default;
  background-color: var(--muted);
  border-style: dashed;
  border-color: var(--border);
}

.product-card.owned::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(16, 185, 129, 0.03) 10px,
    rgba(16, 185, 129, 0.03) 20px
  );
  pointer-events: none;
  border-radius: inherit;
}

.product-card.owned .btn {
  background-color: var(--muted-foreground);
  border-color: var(--muted-foreground);
  cursor: not-allowed;
}

.product-card.owned .btn:hover {
  transform: none;
  box-shadow: none;
}

.product-card.popular {
  border-color: var(--accent);
}

/* Product Label */
.product-label {
  position: absolute;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  white-space: nowrap;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.product-label-popular {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
  letter-spacing: 0.03em;
}

.product-label-owned {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.product-label-new {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.product-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: var(--radius-lg);
}

.product-name {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.product-desc {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  margin-bottom: var(--space-4);
}

.product-pricing {
  margin-bottom: var(--space-4);
}

.product-price {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--accent);
}

.product-period {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.product-features {
  margin: var(--space-6) 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  text-align: left;
}

.product-feature {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  margin-bottom: var(--space-2);
}

.product-feature svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Loading Skeleton */
.loading-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  max-width: 900px;
  margin: 0 auto;
}

.skeleton-card {
  height: 320px;
  background: linear-gradient(90deg, var(--border) 25%, var(--muted) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ----------------------------------------
   8. Footer
   ---------------------------------------- */
.site-footer {
  padding: var(--space-12) 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.footer-brand svg {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.footer-copyright {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

/* ----------------------------------------
   9. Modal
   ---------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

/* Modal 開啟動畫 */
.modal:not(.hidden) .modal-overlay {
  animation: modalFadeIn 0.2s ease-out forwards;
}

.modal:not(.hidden) .modal-content {
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(26, 26, 26, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
}

.modal-content-sm {
  max-width: 380px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
  border: none;
  border-radius: var(--radius-full);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background-color: var(--border);
  color: var(--foreground);
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.modal-icon-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.modal-icon-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.modal-icon-error {
  background-color: var(--error-bg);
  color: var(--error);
}

.modal-icon-info {
  background-color: var(--muted);
  color: var(--accent);
}

.modal-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.modal-desc {
  color: var(--muted-foreground);
  margin-bottom: var(--space-6);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Checkout Modal */
.checkout-product {
  text-align: center;
  margin-bottom: var(--space-4);
}

.checkout-product-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.checkout-product-desc {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  margin-bottom: var(--space-4);
}

.checkout-product-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-2);
}

.checkout-product-price .price-amount {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  color: var(--accent);
}

.checkout-product-price .price-period {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.checkout-step {
  margin-bottom: var(--space-6);
}

.checkout-step-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.checkout-step-desc {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  margin-bottom: var(--space-4);
}

.checkout-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--muted);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.checkout-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.checkout-user-info {
  flex: 1;
}

.checkout-user-name {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
}

.checkout-user-email {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

.checkout-summary {
  padding: var(--space-4);
  background-color: var(--muted);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.summary-row + .summary-row {
  margin-top: var(--space-2);
}

.summary-total {
  font-weight: 600;
  color: var(--foreground);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* ========================================
   信任元素 - Trust Elements
   ======================================== */

.secure-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background-color: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--success);
  font-weight: 500;
}

.secure-badge svg {
  color: var(--success);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 信任橫幅 - Trust Banner */
.checkout-trust-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--success-bg) 0%, rgba(250, 250, 248, 0.5) 100%);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}

.checkout-trust-banner svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--success);
}

.checkout-trust-banner-content {
  flex: 1;
}

.checkout-trust-banner-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: var(--space-1);
}

.checkout-trust-banner-desc {
  font-size: var(--text-xs);
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0;
}

/* 進度指示器 - Progress Indicator */
.checkout-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.checkout-progress-step {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--border);
  transition: all var(--transition-base);
}

.checkout-progress-step.active {
  width: 32px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
}

.checkout-progress-step.completed {
  background-color: var(--success);
}

/* 付款按鈕強化 */
#pay-btn {
  font-size: var(--text-lg);
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.25);
}

#pay-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(184, 134, 11, 0.35);
  transform: translateY(-2px);
}

#pay-btn:disabled {
  background: var(--muted-foreground);
  box-shadow: none;
  transform: none;
}

.captcha-wrapper {
  display: flex;
  justify-content: center;
  margin-top: var(--space-4);
}

.error-message {
  padding: var(--space-3) var(--space-4);
  background-color: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
}

/* ----------------------------------------
   10. Loading
   ---------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(250, 250, 248, 0.9);
}

/* .loading-overlay.hidden uses global .hidden rule */

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  text-align: center;
  padding: var(--space-16);
  color: var(--muted-foreground);
}

.loading-state .loading-spinner {
  margin: 0 auto var(--space-4);
}

/* ----------------------------------------
   11. Status Badges
   ---------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.status-paid,
.status-active {
  background-color: var(--success-bg);
  color: var(--success);
}

.status-failed,
.status-cancelled {
  background-color: var(--error-bg);
  color: var(--error);
}

.status-pending {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.status-authorized,
.status-scheduled {
  background-color: var(--info-bg);
  color: var(--info);
}

/* ----------------------------------------
   12. Result Page
   ---------------------------------------- */
.result-page {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) 0;
}

.result-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.result-icon {
  margin-bottom: var(--space-6);
}

.result-icon-loading .loading-spinner {
  margin: 0 auto;
}

.result-icon-success,
.result-icon-fail {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.result-icon-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.result-icon-fail {
  background-color: var(--error-bg);
  color: var(--error);
}

.result-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.result-message {
  color: var(--muted-foreground);
  margin-bottom: var(--space-8);
}

.result-details {
  text-align: left;
  margin-bottom: var(--space-6);
}

.result-card {
  background-color: var(--muted);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.result-card-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.result-card-label {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.result-card-value {
  font-size: var(--text-sm);
  font-weight: 500;
}

.result-card-value.price {
  color: var(--accent);
  font-weight: 600;
}

.result-card-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-3) 0;
}

.result-card-row-highlight {
  font-size: var(--text-base);
}

.result-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background-color: var(--success-bg);
  color: var(--success);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
}

.result-error {
  margin-bottom: var(--space-6);
}

.error-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: var(--text-sm);
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* ----------------------------------------
   13. Page Content (Orders, Subscriptions)
   ---------------------------------------- */
.page-content {
  min-height: calc(100vh - 64px - 120px);
  padding: var(--space-12) 0;
}

.page-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.page-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-2);
}

.page-desc {
  color: var(--muted-foreground);
}

/* Auth Prompt */
.auth-prompt {
  text-align: center;
  padding: var(--space-16);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 400px;
  margin: 0 auto;
}

.auth-prompt-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
  border-radius: var(--radius-full);
  color: var(--muted-foreground);
}

.auth-prompt-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.auth-prompt-desc {
  color: var(--muted-foreground);
  margin-bottom: var(--space-6);
}

/* Empty State - 情感化設計 */
.empty-state {
  text-align: center;
  padding: var(--space-20);
}

.empty-state-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--muted) 0%, var(--background) 100%);
  border: 2px dashed var(--border);
  border-radius: var(--radius-full);
  color: var(--muted-foreground);
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  opacity: 0.6;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.empty-state-desc {
  color: var(--muted-foreground);
  margin-bottom: var(--space-6);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* Orders Container */
.orders-container,
.subscriptions-container {
  max-width: 800px;
  margin: 0 auto;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}

.stat-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  margin-bottom: var(--space-1);
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--foreground);
}

/* Orders Grid */
.orders-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.orders-list,
.subscriptions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Order Card */
.order-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.order-card-title h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.order-card-id {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

.order-card-body {
  padding: var(--space-4) var(--space-6);
}

.order-info-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.order-info-label {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.order-info-value {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.order-info-value svg {
  color: var(--muted-foreground);
}

.order-card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* Subscription Card */
.subscription-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.subscription-card-inactive {
  opacity: 0.7;
}

.subscription-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.subscription-card-title h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.subscription-card-subtitle {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

.subscription-card-body {
  padding: var(--space-4) var(--space-6);
}

.subscription-info-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.subscription-info-label {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.subscription-info-value {
  font-size: var(--text-sm);
}

.subscription-info-value.highlight {
  color: var(--accent);
  font-weight: 600;
}

.subscription-card-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* Progress Bar */
.subscription-progress {
  padding: var(--space-4) var(--space-6);
}

.subscription-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
  margin-bottom: var(--space-2);
}

.subscription-progress-bar {
  height: 6px;
  background-color: var(--muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.subscription-progress-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: var(--radius-full);
}

.subscriptions-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.subscriptions-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted-foreground);
  margin: var(--space-8) 0 var(--space-4);
}

/* ----------------------------------------
   14. Utilities
   ---------------------------------------- */
.text-center {
  text-align: center;
}

/* ----------------------------------------
   14.1 Focus States - 無障礙設計
   ---------------------------------------- */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.btn:focus-visible {
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(184, 134, 11, 0.2);
}

a:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.product-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* 高對比度模式支援 */
@media (prefers-contrast: high) {
  :root {
    --border: #999999;
    --muted-foreground: #4A4A4A;
  }

  .btn-primary {
    border: 2px solid var(--foreground);
  }
}

/* ----------------------------------------
   15. Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
  h1, .hero-title {
    font-size: var(--text-3xl);
  }

  .nav-links {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .hero {
    padding: var(--space-12) 0;
  }

  .hero-subtitle br {
    display: none;
  }

  .product-grid,
  .loading-skeleton {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-height: 100vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: auto;
  }

  /* Mobile 觸控回饋 */
  .product-card:active:not(.owned) {
    transform: scale(0.98);
    border-color: var(--accent);
  }

  .btn:active:not(:disabled) {
    transform: scale(0.97);
  }

  /* 增加觸控目標尺寸 */
  .btn {
    min-height: 48px;
  }

  .btn-sm {
    min-height: 40px;
  }

  /* 表單輸入框放大（防止 iOS Safari 自動縮放） */
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* 減少動畫模式 - 無障礙支援 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
