/* ─── Variables ─── */
:root {
  --bg:           #07090F;
  --surface:      rgba(255,255,255,.03);
  --surface-2:    rgba(255,255,255,.06);
  --border:       rgba(255,255,255,.08);
  --border-bright:rgba(255,255,255,.15);
  --text:         #F1F5F9;
  --text-2:       #94A3B8;
  --text-3:       #475569;
  --accent:       #3B82F6;
  --accent-dim:   rgba(59,130,246,.15);
  --accent-glow:  rgba(59,130,246,.25);
  --gold:         #F59E0B;
  --gold-dim:     rgba(245,158,11,.12);
  --danger:       #F87171;
  --danger-dim:   rgba(248,113,113,.1);
  --success:      #34D399;
  --radius:       20px;
  --radius-sm:    12px;
  --shadow:       0 40px 80px rgba(0,0,0,.5);
  --font-display: 'Playfair Display', Georgia, 'Noto Serif TC', serif;
  --font-sans:    'Sora', 'Noto Sans TC', sans-serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;
  --nav-h:        56px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── Background dot grid ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Atmospheric glows ─── */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 60vw; height: 60vw;
  top: -20%; right: -15%;
  background: radial-gradient(circle, rgba(59,130,246,.09), transparent 70%);
  animation: driftA 20s ease-in-out infinite alternate;
}
.bg-glow-2 {
  width: 40vw; height: 40vw;
  bottom: -10%; left: -10%;
  background: radial-gradient(circle, rgba(245,158,11,.06), transparent 70%);
  animation: driftB 25s ease-in-out infinite alternate;
}
@keyframes driftA {
  from { transform: translate(0, 0); }
  to   { transform: translate(-4vw, 6vh); }
}
@keyframes driftB {
  from { transform: translate(0, 0); }
  to   { transform: translate(3vw, -5vh); }
}

/* ─── Layout ─── */
.wrap {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
}

/* ─── Navbar ─── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(7,9,15,.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  animation: slideDown .4s cubic-bezier(.16,1,.3,1) both;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}
.nav-inner {
  height: 100%;
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-diamond, .footer-diamond {
  width: 14px;
  height: 14px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  flex-shrink: 0;
}
.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s cubic-bezier(.16,1,.3,1);
  white-space: nowrap;
}
.btn:active { transform: scale(.97) !important; }

.btn-outline {
  color: var(--text-2);
  border-color: var(--border);
  background: var(--surface);
}
.btn-outline:hover {
  color: var(--text);
  border-color: var(--border-bright);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  background: #60A5FA;
  border-color: #60A5FA;
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Hero ─── */
.hero {
  padding: 56px 0 36px;
  animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .1s both;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid rgba(245,158,11,.3);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulseDot 2.5s ease infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.7); }
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.5vw, 68px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, #F1F5F9 30%, #64748B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  max-width: 800px;
}

.subtitle {
  margin-top: 14px;
  font-size: 17px;
  font-weight: 300;
  color: var(--text-2);
  letter-spacing: .01em;
}

/* ─── Error box ─── */
.error-box {
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,.2);
  font-size: 14px;
}
.hidden { display: none; }

/* ─── Report card ─── */
.report-card {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(59,130,246,.08);
  overflow: hidden;
  animation: fadeUp .5s cubic-bezier(.16,1,.3,1) .2s both;
}

/* top accent line */
.report-card-topline {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59,130,246,.8) 30%,
    rgba(245,158,11,.5) 70%,
    transparent 100%);
}

.report-host {
  min-height: 540px;
}
.report-host iframe {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
}

/* ─── Loading state ─── */
.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 540px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.spinner {
  position: relative;
  width: 44px;
  height: 44px;
}
.spinner::before,
.spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.spinner::before {
  border-top-color: var(--accent);
  border-right-color: rgba(59,130,246,.3);
  animation: spin .8s cubic-bezier(.5,0,.5,1) infinite;
}
.spinner::after {
  inset: 6px;
  border-top-color: var(--gold);
  animation: spin 1.4s cubic-bezier(.5,0,.5,1) infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Setup form ─── */
.setup-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 32px 56px;
  min-height: 540px;
  justify-content: center;
  gap: 0;
}

.setup-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  border: 1px solid var(--border-bright);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 32px var(--accent-dim);
}
.setup-icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--accent);
}

.setup-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  background: linear-gradient(135deg, #F1F5F9, #94A3B8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.setup-desc {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 300;
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.setup-input-wrap {
  width: 100%;
  max-width: 560px;
  position: relative;
  margin-bottom: 16px;
}

.setup-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 12.5px;
  font-family: var(--font-mono);
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.setup-input:focus {
  border-color: rgba(59,130,246,.6);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.setup-input::placeholder {
  color: var(--text-3);
}

.setup-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.setup-hint {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .01em;
}

/* ─── Power BI status notice ─── */
.pbi-notice {
  padding: 10px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .01em;
  line-height: 1.6;
  transition: opacity .4s ease;
}
.pbi-notice a {
  color: var(--accent);
  text-decoration: none;
}
.pbi-notice a:hover { color: #60A5FA; }
.pbi-notice-hidden { display: none; }

/* ─── Reset link ─── */
.reset-link {
  padding: 12px 20px;
  text-align: right;
  border-top: 1px solid var(--border);
}
.reset-link a {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  letter-spacing: .03em;
  transition: color .15s ease;
}
.reset-link a:hover {
  color: var(--text-2);
}

/* ─── Footer ─── */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.footer-copy {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .02em;
}

/* ─── Animations ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .hero { padding: 36px 0 24px; }
  .report-card { border-radius: 16px; }
  .setup-form { padding: 40px 20px; }
  .setup-label { font-size: 19px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
