/* ============================================================
   XDLS 星鼎網域鏈接系統 — Design System
   Theme: Dark Celestial Luxury
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700;900&family=Playfair+Display:wght@400;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #060a1a;
  --bg-secondary: #0c1130;
  --bg-card: #111842;
  --bg-card-hover: #162050;
  --gold: #d4a853;
  --gold-light: #f0d48a;
  --gold-dark: #a07830;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --text-primary: #f0f0f5;
  --text-secondary: #9ca3bf;
  --text-muted: #5b6180;
  --border: #1e2550;
  --border-gold: rgba(212, 168, 83, 0.3);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-gold: 0 4px 30px rgba(212, 168, 83, 0.15);
  --font-display: 'Playfair Display', serif;
  --font-body: 'Noto Sans TC', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* ============================================================
   DYNAMIC BACKGROUND SYSTEM
   ============================================================ */
#bg-canvas {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}

/* Background Themes */
body[data-bg="starfield"] { --bg-primary: #060a1a; --bg-secondary: #0c1130; }
body[data-bg="aurora"] { --bg-primary: #0a0f1e; --bg-secondary: #0d1a2d; }
body[data-bg="nebula"] { --bg-primary: #0f0520; --bg-secondary: #1a0a30; }
body[data-bg="ocean"] { --bg-primary: #021520; --bg-secondary: #042030; }
body[data-bg="sunset"] { --bg-primary: #1a0a15; --bg-secondary: #2a0f20; }
body[data-bg="matrix"] { --bg-primary: #000a00; --bg-secondary: #001500; }
body[data-bg="minimal"] { --bg-primary: #0a0a0a; --bg-secondary: #141414; }
body[data-bg="cosmic"] { --bg-primary: #0a0520; --bg-secondary: #150a35; }

/* Background Control Panel */
.bg-control-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.4);
  transition: var(--transition);
  font-size: 1.3rem;
}

.bg-control-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 30px rgba(212, 168, 83, 0.6);
}

.bg-control-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 320px;
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  z-index: 9998;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  display: none;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.bg-control-panel.active { display: block; }

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

.bg-panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-section {
  margin-bottom: 1.2rem;
}

.bg-section-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
}

.bg-themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.bg-theme-btn {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.bg-theme-btn:hover { border-color: var(--gold); transform: scale(1.05); }
.bg-theme-btn.active { border-color: var(--gold); box-shadow: 0 0 12px rgba(212, 168, 83, 0.4); }

.bg-theme-btn[data-theme="starfield"] { background: radial-gradient(circle at 30% 40%, #1a2050, #060a1a); }
.bg-theme-btn[data-theme="aurora"] { background: linear-gradient(135deg, #0a2a3a, #1a4060, #0a3050); }
.bg-theme-btn[data-theme="nebula"] { background: radial-gradient(circle at 60% 30%, #3a1060, #1a0530); }
.bg-theme-btn[data-theme="ocean"] { background: linear-gradient(180deg, #042030, #021020); }
.bg-theme-btn[data-theme="sunset"] { background: linear-gradient(135deg, #3a1020, #2a0a15, #1a0510); }
.bg-theme-btn[data-theme="matrix"] { background: linear-gradient(180deg, #001a00, #000a00); }
.bg-theme-btn[data-theme="minimal"] { background: #0a0a0a; }
.bg-theme-btn[data-theme="cosmic"] { background: radial-gradient(circle at 40% 50%, #2a1050, #0a0520); }

.bg-theme-name {
  position: absolute;
  bottom: 2px;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.55rem;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.bg-slider-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bg-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bg-slider-row label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 60px;
}

.bg-slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.bg-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(212, 168, 83, 0.4);
}

.bg-slider-row .value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  min-width: 35px;
  text-align: right;
}

.bg-color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bg-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.bg-color-swatch:hover { border-color: var(--gold); transform: scale(1.15); }
.bg-color-swatch.active { border-color: var(--gold); box-shadow: 0 0 8px rgba(212, 168, 83, 0.5); }

.bg-reset-btn {
  width: 100%;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}

.bg-reset-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(6, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.nav-brand .logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--bg-primary);
}

.nav-brand span {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

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

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

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-links a:hover::after { transform: scaleX(1); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg-primary);
  box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(212, 168, 83, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-gold);
  color: var(--gold);
}

.btn-outline:hover {
  background: rgba(212, 168, 83, 0.1);
  border-color: var(--gold);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

/* ============================================================
   SECTION LAYOUT
   ============================================================ */
.section {
  position: relative;
  z-index: 1;
  padding: 6rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem 2rem 4rem;
}

.hero-content { max-width: 800px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold) 50%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   GRID
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .section { padding: 4rem 1.5rem; }
  .section-title { font-size: 2rem; }
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

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

select.form-input { cursor: pointer; }

/* ============================================================
   PRICING CARDS
   ============================================================ */
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.pricing-card.featured {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.pricing-card.featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
}

.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow);
}

.pricing-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pricing-original {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 0.9rem;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--gold);
  margin: 0.5rem 0;
}

.pricing-price small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.pricing-features {
  list-style: none;
  margin: 1.5rem 0;
  text-align: left;
}

.pricing-features li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-features li::before {
  content: '✓';
  color: var(--gold);
  font-weight: 700;
}

/* ============================================================
   BADGE / TAG
   ============================================================ */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-gold { background: rgba(212, 168, 83, 0.15); color: var(--gold); }
.badge-success { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.badge-accent { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

td { color: var(--text-primary); }

tr:hover td { background: rgba(212, 168, 83, 0.03); }

/* ============================================================
   COUNTDOWN TIMER
   ============================================================ */
.countdown {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.countdown-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  min-width: 60px;
}

.countdown-item .num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
}

.countdown-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--gold);
  text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--gold);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.tab {
  padding: 12px 24px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

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

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

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.2s; }
.animate-in:nth-child(4) { animation-delay: 0.3s; }

/* ============================================================
   TEMPLATE SELECTOR
   ============================================================ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.template-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover, .template-card.selected {
  border-color: var(--gold);
  background: var(--bg-card);
}

.template-card .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.template-card .name {
  font-weight: 600;
  font-size: 0.95rem;
}

.template-card .desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--gold);
}

.stat-card .stat-change {
  font-size: 0.8rem;
  color: var(--success);
  margin-top: 0.25rem;
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-gold { color: var(--gold); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none; }
