/* =========================================================
   FutureTek Digital — 將來數位科技
   Global design system (Dark / Neon Blue-Purple)
   ========================================================= */

:root {
  --ftk-bg: #06070d;
  --ftk-bg-soft: #0b0d17;
  --ftk-surface: rgba(255, 255, 255, 0.035);
  --ftk-surface-hover: rgba(255, 255, 255, 0.06);
  --ftk-border: rgba(255, 255, 255, 0.08);
  --ftk-border-strong: rgba(255, 255, 255, 0.16);
  --ftk-text: #e8ecf7;
  --ftk-muted: #8b93ab;
  --ftk-blue: #3b82f6;
  --ftk-cyan: #22d3ee;
  --ftk-violet: #8b5cf6;
  --ftk-fuchsia: #d946ef;
  --ftk-ok: #34d399;
  --ftk-warn: #fbbf24;
  --ftk-danger: #f87171;
  --ftk-radius: 16px;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--ftk-bg);
  color: var(--ftk-text);
  font-family: "Inter", "Noto Sans TC", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Ambient background ---------- */
.ftk-ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(59, 130, 246, 0.20), transparent 60%),
    radial-gradient(50rem 35rem at 85% 5%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(45rem 35rem at 50% 100%, rgba(217, 70, 239, 0.10), transparent 60%);
}

.ftk-grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 100% 60% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 100% 60% at 50% 0%, #000 30%, transparent 80%);
}

/* ---------- Typography helpers ---------- */
.ftk-gradient-text {
  background: linear-gradient(120deg, #60a5fa 0%, #a78bfa 45%, #f0abfc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ftk-gradient-text-anim {
  background: linear-gradient(120deg, #60a5fa, #a78bfa, #f0abfc, #60a5fa);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ftk-hue 8s linear infinite;
}

@keyframes ftk-hue {
  to { background-position: 300% 50%; }
}

/* ---------- Glass surfaces ---------- */
.ftk-glass {
  background: var(--ftk-surface);
  border: 1px solid var(--ftk-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--ftk-radius);
}

.ftk-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--ftk-border);
  border-radius: var(--ftk-radius);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  overflow: hidden;
}

.ftk-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(130deg, rgba(96, 165, 250, 0.7), rgba(167, 139, 250, 0.6), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.ftk-card:hover {
  transform: translateY(-6px);
  border-color: var(--ftk-border-strong);
  box-shadow: 0 24px 60px -24px rgba(99, 102, 241, 0.55);
}

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

/* Spotlight following the cursor (set via JS custom props) */
.ftk-spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    16rem 16rem at var(--mx, 50%) var(--my, 0%),
    rgba(139, 92, 246, 0.16),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.ftk-spotlight:hover::after { opacity: 1; }

/* ---------- Buttons ---------- */
.ftk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.925rem;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease,
    border-color 0.25s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.ftk-btn:active { transform: scale(0.97); }

.ftk-btn-primary {
  background: linear-gradient(120deg, #2563eb, #7c3aed 55%, #a21caf);
  color: #fff;
  box-shadow: 0 10px 30px -12px rgba(124, 58, 237, 0.9);
}

.ftk-btn-primary:hover {
  box-shadow: 0 16px 42px -12px rgba(124, 58, 237, 1);
  transform: translateY(-2px);
}

.ftk-btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--ftk-border);
  color: var(--ftk-text);
}

.ftk-btn-ghost:hover {
  background: var(--ftk-surface-hover);
  border-color: var(--ftk-border-strong);
  transform: translateY(-2px);
}

.ftk-btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.ftk-btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

.ftk-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- Badges / chips ---------- */
.ftk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--ftk-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ftk-muted);
  white-space: nowrap;
}

.ftk-badge-blue { border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.12); color: #93c5fd; }
.ftk-badge-violet { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.12); color: #c4b5fd; }
.ftk-badge-green { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.12); color: #6ee7b7; }
.ftk-badge-amber { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.ftk-badge-rose  { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.12); color: #fca5a5; }

/* ---------- Forms ---------- */
.ftk-input,
.ftk-select,
.ftk-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ftk-border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  color: var(--ftk-text);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ftk-input::placeholder,
.ftk-textarea::placeholder { color: #5f6781; }

.ftk-input:focus,
.ftk-select:focus,
.ftk-textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}

.ftk-select option { background: #0b0d17; color: var(--ftk-text); }

.ftk-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ftk-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

/* ---------- Navbar ---------- */
.ftk-nav {
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  border-bottom: 1px solid transparent;
}

.ftk-nav.is-scrolled {
  background: rgba(6, 7, 13, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--ftk-border);
}

.ftk-nav-link {
  position: relative;
  padding: 0.45rem 0.15rem;
  font-size: 0.9rem;
  color: var(--ftk-muted);
  transition: color 0.25s ease;
}

.ftk-nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  transition: right 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.ftk-nav-link:hover,
.ftk-nav-link.is-active { color: #fff; }
.ftk-nav-link:hover::after,
.ftk-nav-link.is-active::after { right: 0; }

/* ---------- Command palette (Cmd+K) ---------- */
.ftk-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 4, 9, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.ftk-palette-backdrop.is-open { opacity: 1; pointer-events: auto; }

.ftk-palette {
  position: fixed;
  z-index: 91;
  top: 12vh;
  left: 50%;
  width: min(680px, calc(100vw - 2rem));
  transform: translate(-50%, -12px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  background: linear-gradient(180deg, rgba(20, 22, 38, 0.96), rgba(11, 13, 23, 0.98));
  border: 1px solid var(--ftk-border-strong);
  border-radius: 18px;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(139, 92, 246, 0.12);
  overflow: hidden;
}

.ftk-palette.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.ftk-palette-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ftk-palette-item.is-active {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.35);
}

.ftk-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--ftk-border-strong);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ftk-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Modal ---------- */
.ftk-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 4, 9, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ftk-modal-backdrop.is-open { opacity: 1; pointer-events: auto; }

.ftk-modal {
  width: min(640px, 100%);
  background: linear-gradient(180deg, rgba(20, 22, 38, 0.98), rgba(11, 13, 23, 0.99));
  border: 1px solid var(--ftk-border-strong);
  border-radius: 18px;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9);
  transform: translateY(-10px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ftk-modal-backdrop.is-open .ftk-modal { transform: translateY(0) scale(1); }

/* ---------- Toast ---------- */
.ftk-toast-wrap {
  position: fixed;
  z-index: 120;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.ftk-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(17, 19, 32, 0.96);
  border: 1px solid var(--ftk-border-strong);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  font-size: 0.875rem;
  animation: ftk-toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.ftk-toast.is-out { animation: ftk-toast-out 0.25s ease forwards; }
.ftk-toast-ok { border-color: rgba(52, 211, 153, 0.4); }
.ftk-toast-err { border-color: rgba(248, 113, 113, 0.45); }

@keyframes ftk-toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes ftk-toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

/* ---------- Scroll reveal ---------- */
.ftk-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ftk-reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Misc effects ---------- */
.ftk-glow-ring {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 0 40px -10px rgba(139, 92, 246, 0.7);
}

.ftk-marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: ftk-marquee 32s linear infinite;
}

@keyframes ftk-marquee {
  to { transform: translateX(-50%); }
}

.ftk-pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ftk-ok);
}

.ftk-pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: ftk-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ftk-ping {
  75%, 100% { transform: scale(2.6); opacity: 0; }
}

/* Counter numbers stay aligned while animating */
.ftk-tabular { font-variant-numeric: tabular-nums; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); background-clip: content-box; }

/* ---------- Admin layout ---------- */
.ftk-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--ftk-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ftk-sidebar-link:hover { background: var(--ftk-surface-hover); color: #fff; }

.ftk-sidebar-link.is-active {
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.18), rgba(139, 92, 246, 0.18));
  border-color: rgba(139, 92, 246, 0.35);
  color: #fff;
}

.ftk-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }

.ftk-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ftk-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ftk-border);
  white-space: nowrap;
}

.ftk-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.875rem;
  vertical-align: middle;
}

.ftk-table tbody tr { transition: background 0.2s ease; }
.ftk-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* ---------- 帳號安全：密碼強度計 ---------- */
.ftk-strength {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ftk-strength > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--ftk-danger);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s ease;
}

.ftk-strength[data-score="0"] > span { background: #f87171; }
.ftk-strength[data-score="1"] > span { background: #fb923c; }
.ftk-strength[data-score="2"] > span { background: #fbbf24; }
.ftk-strength[data-score="3"] > span { background: #34d399; }
.ftk-strength[data-score="4"] > span { background: linear-gradient(90deg, #34d399, #22d3ee); }

.ftk-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ftk-muted);
  transition: color 0.2s ease;
}

.ftk-check.is-pass { color: #6ee7b7; }
.ftk-check.is-fail-required { color: #fca5a5; }

/* ---------- 帳號安全：一次性驗證碼輸入 ---------- */
.ftk-otp {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.ftk-otp::placeholder { letter-spacing: 0.45em; color: #3d445c; }

.ftk-otp-recovery {
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  font-size: 1.05rem;
}

/* ---------- 初始化精靈步驟指示 ---------- */
.ftk-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.75rem;
  color: var(--ftk-muted);
}

.ftk-step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--ftk-border-strong);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.ftk-step.is-active { color: #fff; }
.ftk-step.is-active .ftk-step-dot {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-color: transparent;
  color: #fff;
}

.ftk-step.is-done .ftk-step-dot {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

/* ---------- 備援還原碼 ---------- */
.ftk-recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--ftk-border);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  color: var(--ftk-text);
}

.ftk-qr-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 18px 40px -18px rgba(139, 92, 246, 0.8);
}

.ftk-qr-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 172px;
  height: 172px;
}

.ftk-qr-slot svg,
.ftk-qr-slot canvas,
.ftk-qr-slot img {
  display: block;
  width: 172px;
  height: 172px;
  shape-rendering: crispEdges;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ftk-reveal { opacity: 1; transform: none; }
}
