/* =========================================================================
   SEOscope — AI SEO Auditor
   Custom styles layered on top of Tailwind (CDN).
   Theme: dark, glassmorphism, gradient accents, smooth motion.
   ========================================================================= */

:root {
  --brand-400: #599dff;
  --brand-500: #3576f6;
  --brand-600: #1f57e0;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-brd: rgba(255, 255, 255, 0.09);
}

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

html { scroll-behavior: smooth; }

body { overflow-x: hidden; }

/* ---------- Animated background ---------- */
.bg-aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 20%, rgba(53, 118, 246, 0.28), transparent 70%),
    radial-gradient(35% 45% at 80% 10%, rgba(139, 92, 246, 0.22), transparent 70%),
    radial-gradient(30% 40% at 60% 40%, rgba(14, 165, 233, 0.18), transparent 70%);
  filter: blur(40px);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.08); }
  100% { transform: translate3d(-3%, -1%, 0) scale(1.04); }
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 8px 40px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.4rem; border-radius: .85rem;
  font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  box-shadow: 0 8px 24px -8px rgba(31, 87, 224, 0.6);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
  white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 30px -8px rgba(31, 87, 224, 0.7); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: .7rem; font-weight: 500; font-size: .9rem;
  color: #e2e8f0; background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-brd);
  transition: background .15s ease, transform .15s ease;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: .7rem; font-weight: 500; font-size: .9rem;
  color: #cbd5e1; transition: background .15s ease, color .15s ease;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  padding: .25rem .6rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-brd);
  color: #94a3b8; font-size: .72rem; transition: all .15s ease;
}
.chip:hover { color: #fff; border-color: var(--brand-400); }

.badge-ai {
  font-size: .7rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px;
  color: #c4b5fd; background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.3);
}

/* ---------- Settings modal ---------- */
.settings-label { display: block; font-size: .82rem; font-weight: 600; color: #cbd5e1; margin-bottom: .35rem; }
.settings-label .req { font-size: .68rem; color: #fca5a5; font-weight: 500; margin-left: .35rem; }
.settings-label .opt { font-size: .68rem; color: #64748b; font-weight: 500; margin-left: .35rem; }
.settings-input {
  width: 100%; padding: .6rem .8rem; border-radius: .6rem;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-brd);
  color: #fff; font-size: .9rem; transition: border-color .15s ease;
}
.settings-input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(53, 118, 246, 0.15); }
.settings-hint { display: inline-block; font-size: .72rem; color: #64748b; margin-top: .35rem; }
.settings-hint code { background: rgba(255,255,255,.08); padding: 0 .3rem; border-radius: .25rem; color: #cbd5e1; }

/* ---------- Tabs ---------- */
.tab-btn {
  padding: .5rem 1rem; border-radius: .6rem; font-size: .85rem; font-weight: 500;
  color: #94a3b8; transition: all .15s ease; white-space: nowrap;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #fff; background: linear-gradient(135deg, var(--brand-500), var(--brand-600)); box-shadow: 0 4px 14px -4px rgba(31,87,224,.5); }

.tab-panel { animation: fadePanel .35s ease both; }
@keyframes fadePanel { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Score gauge ---------- */
.gauge-wrap { position: relative; width: 200px; height: 200px; }
.gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}

/* ---------- Score cards ---------- */
.score-card {
  position: relative; overflow: hidden;
  background: var(--glass-bg); border: 1px solid var(--glass-brd);
  border-radius: 1rem; padding: 1.1rem;
  backdrop-filter: blur(12px);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.score-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.18); box-shadow: 0 16px 40px -16px rgba(0,0,0,.6); }
.score-card .ring { position: relative; width: 64px; height: 64px; }
.score-card .ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: .95rem; }

/* trend pill */
.trend { display: inline-flex; align-items: center; gap: .2rem; font-size: .68rem; font-weight: 600; padding: .12rem .45rem; border-radius: 999px; }
.trend.up { color: var(--good); background: rgba(52, 211, 153, .12); }
.trend.down { color: var(--bad); background: rgba(251, 113, 133, .12); }
.trend.flat { color: #94a3b8; background: rgba(148,163,184,.12); }

/* ---------- Generic data rows / pills ---------- */
.data-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.data-row:last-child { border-bottom: none; }
.data-key { color: #94a3b8; font-size: .85rem; flex-shrink: 0; }
.data-val { color: #e2e8f0; font-size: .88rem; text-align: right; word-break: break-word; }

.status-pill { font-size: .7rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .3rem; }
.status-pass { color: var(--good); background: rgba(52,211,153,.12); }
.status-warn { color: var(--warn); background: rgba(251,191,36,.12); }
.status-fail { color: var(--bad); background: rgba(251,113,133,.12); }

.section-card { background: var(--glass-bg); border: 1px solid var(--glass-brd); border-radius: 1rem; padding: 1.4rem; backdrop-filter: blur(12px); }
.section-title { font-weight: 700; color: #fff; font-size: 1.05rem; margin-bottom: .25rem; display: flex; align-items: center; gap: .5rem; }

/* issue list */
.issue {
  display: flex; gap: .75rem; padding: .85rem 1rem; border-radius: .75rem;
  border: 1px solid var(--glass-brd); margin-bottom: .6rem; background: rgba(255,255,255,.02);
  animation: fade-up .4s ease both;
}
.issue.critical { border-left: 3px solid var(--bad); }
.issue.warning  { border-left: 3px solid var(--warn); }
.issue.win      { border-left: 3px solid var(--good); }
.issue-icon { font-size: 1.1rem; line-height: 1.4; }
.issue h4 { font-weight: 600; color: #fff; font-size: .92rem; }
.issue p  { color: #94a3b8; font-size: .82rem; margin-top: .15rem; line-height: 1.5; }
.issue .impact { font-size: .68rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; margin-left: auto; flex-shrink: 0; align-self: flex-start; }
.impact.high { color: var(--bad); background: rgba(251,113,133,.12); }
.impact.medium { color: var(--warn); background: rgba(251,191,36,.12); }
.impact.low { color: #94a3b8; background: rgba(148,163,184,.12); }

@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Verdict stat cards ---------- */
.verdict-stat-card { transition: background .2s, transform .15s; }
.verdict-stat-card:hover { background: rgba(255,255,255,.1) !important; transform: translateY(-2px); }

/* ---------- How-to-fix accordion ---------- */
.how-to-fix { margin-top: .5rem; }
.fix-toggle {
  font-size: .78rem; font-weight: 600; color: #60a5fa; background: none; border: none;
  cursor: pointer; padding: 0; letter-spacing: .01em;
}
.fix-toggle:hover { color: #93c5fd; }
.fix-steps { margin-top: .5rem; padding: .7rem .9rem; border-radius: .6rem; background: rgba(96,165,250,.06); border: 1px solid rgba(96,165,250,.15); }
.fix-steps p { color: #cbd5e1; font-size: .82rem; line-height: 1.65; white-space: pre-line; }
.code-snippet {
  margin-top: .6rem; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.08);
  border-radius: .5rem; padding: .7rem .9rem; overflow-x: auto;
}
.code-snippet code { font-family: 'Fira Code', 'Consolas', monospace; font-size: .75rem; color: #a5f3a5; white-space: pre; }

/* ---------- Content Suggestions ---------- */
.content-suggestion { padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.content-suggestion:last-child { border-bottom: none; }
.cs-label { font-size: .72rem; font-weight: 700; color: #60a5fa; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .35rem; }
.cs-value { font-size: .9rem; color: #e2e8f0; line-height: 1.55; }
.cs-list { padding-left: 1rem; margin-top: .3rem; }
.cs-list li { color: #94a3b8; font-size: .82rem; line-height: 1.6; list-style: disc; }
.blog-topic { padding: .5rem .75rem; border-radius: .5rem; background: rgba(255,255,255,.03); margin-bottom: .4rem; }

/* ---------- Skeleton loaders ---------- */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.05); border-radius: .5rem; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Vitals metric ---------- */
.vital { text-align: center; padding: 1rem; border-radius: .85rem; background: rgba(255,255,255,.03); border: 1px solid var(--glass-brd); }
.vital .v-val { font-size: 1.6rem; font-weight: 800; }
.vital .v-label { font-size: .72rem; color: #94a3b8; margin-top: .2rem; letter-spacing: .03em; }
.v-good { color: var(--good); } .v-warn { color: var(--warn); } .v-bad { color: var(--bad); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { text-align: left; color: #64748b; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: .55rem .65rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.data-table td { padding: .6rem .65rem; border-bottom: 1px solid rgba(255,255,255,.05); color: #cbd5e1; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,.03); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Toasts ---------- */
.toast {
  min-width: 260px; max-width: 360px; padding: .85rem 1rem; border-radius: .8rem;
  color: #fff; font-size: .88rem; display: flex; gap: .6rem; align-items: flex-start;
  background: rgba(15, 20, 36, 0.92); border: 1px solid var(--glass-brd);
  backdrop-filter: blur(12px); box-shadow: 0 12px 30px -10px rgba(0,0,0,.7);
  animation: toastIn .3s cubic-bezier(.21,1,.36,1) both;
}
.toast.success { border-left: 3px solid var(--good); }
.toast.error   { border-left: 3px solid var(--bad); }
.toast.info    { border-left: 3px solid var(--brand-400); }
.toast.leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------- Progress steps ---------- */
.pstep { display: flex; align-items: center; gap: .65rem; color: #64748b; transition: color .3s ease; }
.pstep .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; flex-shrink: 0; font-size: .6rem; }
.pstep.active { color: var(--brand-400); }
.pstep.done { color: var(--good); }
.pstep.done .dot { background: var(--good); border-color: var(--good); color: #052e1f; }
.pstep.active .dot { border-color: var(--brand-400); animation: pulseDot 1s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(53,118,246,.4); } 50% { box-shadow: 0 0 0 5px rgba(53,118,246,0); } }

/* ---------- Counter ---------- */
.counter { font-variant-numeric: tabular-nums; }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; border-radius: .35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .bg-aurora { animation: none; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); background-clip: padding-box; }
