/* ══════════════════════════════════════════════
   ALN-X Dashboard Design System — Copywriting
   ══════════════════════════════════════════════ */

:root {
  /* ── 基底色 ── */
  --bg-color: #050a14;
  --panel-bg: rgba(13, 22, 38, 0.7);

  /* ── 強調色 ── */
  --accent-primary: #00d2ff;
  --accent-secondary: #9d50bb;

  /* ── 文字色 ── */
  --text-main: #e0e0e0;
  --text-dim: #a0a0a0;

  /* ── 功能色 ── */
  --card-glow: rgba(0, 210, 255, 0.2);
  --border-color: rgba(255, 255, 255, 0.1);

  /* ── 字型 ── */
  --font-title: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;

  /* ── 字級 Token ── */
  --fs-hero: 3rem;
  --fs-page-title: 2rem;
  --fs-logo: 1.8rem;
  --fs-section: 1.4rem;
  --fs-subtitle: 1.2rem;
  --fs-body: 0.95rem;
  --fs-input: 0.9rem;
  --fs-label: 0.85rem;
  --fs-footer: 0.85rem;
  --fs-badge: 0.75rem;
  --fs-micro: 0.7rem;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── 背景效果 ── */
.stars-bg {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.15; z-index: -2; pointer-events: none;
}

.grid-overlay {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    linear-gradient(rgba(18,16,16,0) 50%, rgba(0,210,255,0.05) 50%),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 100% 4px, 40px 40px, 40px 40px;
  pointer-events: none; z-index: -1;
  animation: gridMove 20s linear infinite;
}

.grid-overlay::after {
  content: '';
  position: absolute; top: -10%; left: 0;
  width: 100%; height: 5px;
  background: rgba(0,210,255,0.3);
  box-shadow: 0 0 15px rgba(0,210,255,0.8), 0 0 30px rgba(0,210,255,0.5);
  animation: scanline 10s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes gridMove { 0%{transform:translateY(0)} 100%{transform:translateY(40px)} }
@keyframes scanline { 0%{top:-10%;opacity:0} 10%{opacity:.8} 90%{opacity:.8} 100%{top:110%;opacity:0} }

/* ── 導覽列 ── */
.glass-header {
  height: 80px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 5%;
  background: rgba(13,22,38,0.4);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border-color);
  position: sticky; top: 0; z-index: 100;
}

.logo-text {
  font-family: var(--font-title);
  font-size: var(--fs-logo);
  letter-spacing: 4px; font-weight: 700;
  color: var(--text-main);
}
.logo-text .accent {
  color: var(--accent-primary);
  text-shadow: 0 0 15px var(--accent-primary);
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.btn-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.btn-icon:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(0,210,255,0.2);
}

/* ── 主要容器 ── */
.app-container { max-width: 1200px; margin: 30px auto; padding: 0 20px; }

/* ── 頁面標題 ── */
.page-hero { text-align: center; margin-bottom: 30px; }
.page-hero h1 {
  font-family: var(--font-title);
  font-size: var(--fs-page-title);
  margin-bottom: 8px; letter-spacing: 2px;
}
.page-hero p { color: var(--text-dim); font-size: var(--fs-subtitle); letter-spacing: 1px; }

/* ── 設定面板 ── */
.settings-panel {
  background: var(--panel-bg); backdrop-filter: blur(10px);
  border-radius: 16px; border: 1px solid var(--border-color);
  padding: 30px; margin-bottom: 24px;
  position: relative; overflow: hidden;
  animation: fadeIn 0.3s ease-out;
}
.settings-panel::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}
.settings-panel h2 {
  font-family: var(--font-title);
  font-size: var(--fs-section);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 1px;
}
.settings-group {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.field-label {
  display: block; font-size: var(--fs-micro);
  font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px;
}
.field-input {
  width: 100%; padding: 10px 14px;
  background: rgba(5,10,20,0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px; color: var(--text-main);
  font-family: var(--font-body); font-size: var(--fs-input);
  transition: all 0.3s; outline: none;
}
.field-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 12px rgba(0,210,255,0.15); }
.field-input::placeholder { color: rgba(160,160,160,0.5); }

.btn-settings-save {
  width: 100%; padding: 14px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff; font-family: var(--font-body);
  font-weight: 700; font-size: var(--fs-input);
  letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; transition: all 0.3s;
}
.btn-settings-save:hover { box-shadow: 0 0 20px rgba(0,210,255,0.3); transform: translateY(-1px); }

/* ── 兩欄佈局 ── */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; align-items: start;
}

/* ── 玻璃面板 ── */
.glass-panel {
  background: var(--panel-bg); backdrop-filter: blur(10px);
  border-radius: 20px; border: 1px solid var(--border-color);
  padding: 30px; position: relative; overflow: hidden;
  transition: all 0.3s;
}
.glass-panel::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(transparent, transparent, transparent, var(--accent-primary));
  animation: rotateBorder 7s linear infinite;
  z-index: -2; opacity: 0.15; transition: opacity 0.3s;
}
.glass-panel::after {
  content: ''; position: absolute; inset: 2px;
  background: var(--panel-bg); border-radius: 18px; z-index: -1;
}
.glass-panel:hover::before { opacity: 0.4; }

@keyframes rotateBorder { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }

/* ── 面板標題 ── */
.panel-title {
  font-family: var(--font-title); font-size: var(--fs-section);
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 1px;
}
.panel-title .step-num {
  font-size: var(--fs-micro); padding: 2px 6px;
  background: rgba(0,210,255,0.1); border: 1px solid rgba(0,210,255,0.2);
  border-radius: 4px; color: var(--accent-primary);
  font-weight: 700; letter-spacing: 1px;
}

/* ── 輸入區域 ── */
.input-section label {
  display: block; font-size: var(--fs-label);
  font-weight: 600; color: var(--text-dim); margin-bottom: 8px;
}
.text-input {
  width: 100%; min-height: 160px; padding: 16px;
  background: rgba(5,10,20,0.6);
  border: 1px solid var(--border-color);
  border-radius: 14px; color: var(--text-main);
  font-family: var(--font-body); font-size: var(--fs-body);
  line-height: 1.6; resize: vertical; outline: none;
  transition: all 0.3s;
}
.text-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 15px rgba(0,210,255,0.12); }
.text-input::placeholder { color: rgba(160,160,160,0.5); }

/* ── 選項按鈕 (2x2 Grid) ── */
.option-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 14px 10px;
  background: rgba(5,10,20,0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-dim);
  cursor: pointer; transition: all 0.3s;
  text-align: center;
}
.option-btn:hover {
  border-color: rgba(0,210,255,0.3);
  color: var(--text-main);
  background: rgba(0,210,255,0.03);
}
.option-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0,210,255,0.08);
  box-shadow: 0 0 15px rgba(0,210,255,0.1);
}
.option-icon { font-size: 1.4rem; }
.option-label {
  font-family: var(--font-body);
  font-size: var(--fs-body); font-weight: 700;
}
.option-desc {
  font-size: var(--fs-micro); opacity: 0.6;
  font-family: var(--font-body);
}

/* ── Chip 按鈕 (橫排) ── */
.chip-group {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.chip-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: rgba(5,10,20,0.5);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: var(--fs-label); font-weight: 600;
  cursor: pointer; transition: all 0.3s;
}
.chip-btn:hover {
  border-color: rgba(0,210,255,0.3);
  color: var(--text-main);
}
.chip-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0,210,255,0.08);
}

/* ── 主要按鈕 ── */
.btn-primary {
  width: 100%; padding: 14px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--accent-primary), #00a8ff);
  color: #000; font-family: var(--font-body);
  font-weight: 700; font-size: var(--fs-body);
  letter-spacing: 1px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 25px rgba(0,210,255,0.4); }
.btn-primary:disabled {
  background: rgba(255,255,255,0.08); color: var(--text-dim);
  cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-copy { flex: 1; }

/* ── 清除按鈕 ── */
.btn-clear {
  padding: 14px 20px; border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.btn-clear:hover { border-color: #ff4444; color: #ff4444; background: rgba(255,68,68,0.08); }

/* ── 結果面板 ── */
.result-panel {
  min-height: 600px; display: flex; flex-direction: column;
}

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-dim); opacity: 0.5;
}
.empty-state .empty-icon {
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.03); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.empty-state .empty-icon svg { opacity: 0.3; }
.empty-state p.empty-title { font-weight: 700; font-size: var(--fs-body); margin-bottom: 4px; }
.empty-state p.empty-sub { font-size: var(--fs-label); }

/* ── 載入中 ── */
.loading-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--accent-primary);
}

.loading-spinner {
  width: 50px; height: 50px;
  border: 3px solid rgba(0,210,255,0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loading-text { font-weight: 700; font-size: var(--fs-body); margin-bottom: 4px; }
.loading-sub { font-size: var(--fs-label); color: var(--text-dim); }

@keyframes spin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }

/* ── 結果內容 ── */
.result-content { flex: 1; display: flex; flex-direction: column; }

.result-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.result-tag {
  padding: 4px 10px;
  border-radius: 4px; font-size: var(--fs-badge);
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px;
}
.result-tag.tone { background: rgba(0,210,255,0.15); color: var(--accent-primary); }
.result-tag.platform { background: rgba(157,80,187,0.15); color: #c77dff; }
.result-tag.framework { background: rgba(79,172,254,0.15); color: #4facfe; }

.result-body {
  flex: 1;
  background: rgba(5,10,20,0.5);
  border: 1px solid var(--border-color);
  border-radius: 14px; padding: 20px;
  font-size: var(--fs-body); line-height: 1.8;
  white-space: pre-wrap; word-wrap: break-word;
  overflow-y: auto; max-height: 500px;
  margin-bottom: 16px;
}

.result-body h3 {
  color: var(--accent-primary);
  font-family: var(--font-body);
  font-size: 1.05rem; font-weight: 700;
  margin: 16px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0,210,255,0.15);
}
.result-body h3:first-child { margin-top: 0; }

.result-actions {
  display: flex; gap: 12px;
}

/* ── 頁尾 ── */
.glass-footer {
  text-align: center; padding: 40px;
  color: var(--text-dim); font-size: var(--fs-footer);
  border-top: 1px solid var(--border-color);
  margin-top: 50px; letter-spacing: 1px;
}

/* ── 動畫 ── */
@keyframes fadeIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

/* ── 間距 ── */
.space-y-lg > * + * { margin-top: 24px; }

/* ── Toast 通知 ── */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0,210,255,0.15);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 12px 24px; border-radius: 10px;
  font-weight: 700; font-size: var(--fs-body);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
  z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── 響應式 ── */
@media (max-width: 768px) {
  .glass-header { height: 60px; padding: 0 16px; }
  .logo-text { font-size: 1.4rem; letter-spacing: 2px; }
  .app-container { padding: 0 12px; margin: 16px auto; }
  .page-hero h1 { font-size: 1.5rem; }
  .two-col { grid-template-columns: 1fr; }
  .glass-panel { padding: 20px; }
  .option-grid { grid-template-columns: 1fr; }
}
