/* AI Sports Prediction — scoped styles (.aip-* namespace).
   Mobile-first. Colours come from CSS vars set inline in <head> from ACF. */

:root {
  --aip-bg: #0a0f1e;
  --aip-surface: #141b2e;
  --aip-primary: #22d3ee;
  --aip-accent: #34d399;
  --aip-text: #e2e8f0;
  --aip-muted: #94a3b8;
  --aip-cta-bg: #22c55e;
  --aip-cta-text: #06241a;
  --aip-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

.aip-body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
    var(--aip-bg);
  color: var(--aip-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Pointer cursor on every interactive element in the module. */
.aip-body a,
.aip-body button,
.aip-cta,
.aip-other__link,
.aip-modal__close,
[data-aip-modal-close] { cursor: pointer; }

/* Base = mobile-first. Compact by default; desktop scales UP at >=640px. */
.aip-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 40px;
}

/* ---- Hero (mobile: tight, punchy — fixture card should start high) ---- */
.aip-hero { text-align: center; margin-bottom: 12px; }
.aip-hero__brand {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--aip-primary);
  border: 1px solid var(--aip-border);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 8px;
}
.aip-hero__headline {
  font-size: 26px;
  line-height: 1.05;
  font-weight: 900;
  margin: 0 0 6px;
  text-wrap: balance;
}
.aip-hero__sub {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--aip-muted);
  margin: 0 auto;
  /* Wider wrap → fewer lines → less vertical space (instead of shrinking text). */
  max-width: 40ch;
}

/* ---- Engine wrapper / fixture ---- */
.aip-engine {
  position: relative;
  background: var(--aip-surface);
  border: 1px solid var(--aip-border);
  border-radius: 16px;
  padding: 16px;
  margin-top: 6px;
}

.aip-fixture { text-align: center; margin-bottom: 14px; }
.aip-fixture__league {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--aip-muted); margin-bottom: 14px;
}
.aip-fixture__league-logo { width: 16px; height: 16px; object-fit: contain; }
.aip-fixture__teams {
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.aip-fixture__team { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.aip-fixture__team-logo { width: 52px; height: 52px; object-fit: contain; }
.aip-fixture__team-name { font-size: 14px; font-weight: 700; }
.aip-fixture__vs { font-size: 12px; color: var(--aip-muted); font-weight: 700; }
.aip-fixture__kickoff { margin-top: 12px; font-size: 13px; color: var(--aip-primary); font-weight: 600; }

/* ---- Engine body: holds the analysis overlay + the predictions in one slot,
   sitting BELOW the pinned fixture. Reserves height during loading so the card
   doesn't jump on reveal. ---- */
.aip-engine__body { position: relative; min-height: 210px; }
body.aip-revealed .aip-engine__body { min-height: 0; }

/* ---- Analysis animation: compact panel anchored just below the fixture
   (NOT covering it), so loading reads as "analysing THIS match". ---- */
.aip-analysis {
  position: absolute; inset: 0;
  background: var(--aip-surface);
  border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 10px; padding: 8px 18px 18px; text-align: center;
  z-index: 5;
  transition: opacity .4s ease, visibility .4s ease;
}
.aip-analysis.aip-analysis--done { opacity: 0; visibility: hidden; pointer-events: none; }
.aip-analysis__pulse {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle, var(--aip-primary), transparent 70%);
  animation: aip-pulse 1.2s ease-in-out infinite;
}
@keyframes aip-pulse { 0%,100% { transform: scale(.85); opacity:.7; } 50% { transform: scale(1.15); opacity:1; } }
.aip-analysis__title { font-weight: 700; font-size: 16px; margin: 0; }
.aip-analysis__steps { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--aip-muted); }
.aip-analysis__step { opacity: .35; transition: opacity .3s ease, color .3s ease; padding: 3px 0; }
.aip-analysis__step.aip-analysis__step--active { opacity: 1; color: var(--aip-text); }
.aip-analysis__step.aip-analysis__step--done { opacity: 1; color: var(--aip-accent); }
.aip-analysis__bar { width: 80%; height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.aip-analysis__bar-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--aip-primary), var(--aip-accent)); transition: width .2s linear; }

/* ---- Prediction card ---- */
.aip-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.aip-card__badge { font-size: 10px; letter-spacing: .14em; font-weight: 800; color: var(--aip-primary); }
.aip-card__confidence { text-align: right; line-height: 1; }
.aip-card__confidence-num { display: block; font-size: 26px; font-weight: 900; color: var(--aip-accent); }
.aip-card__confidence-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--aip-muted); }
.aip-card__recommendation {
  position: relative;
  font-size: 19px; font-weight: 900; text-align: center;
  letter-spacing: .01em;
  background:
    linear-gradient(180deg, rgba(34,211,238,.14), rgba(52,211,153,.10));
  border: 1px solid color-mix(in srgb, var(--aip-primary) 45%, transparent);
  border-radius: 14px;
  padding: 14px 12px; margin: 0 0 14px;
  box-shadow: 0 0 22px rgba(34, 211, 238, .18), inset 0 1px 0 rgba(255,255,255,.06);
  text-shadow: 0 0 18px rgba(34, 211, 238, .35);
}
/* Subtle animated glow so the key line draws the eye. */
.aip-card__recommendation::after {
  content: ""; position: absolute; inset: -1px; border-radius: 14px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--aip-accent) 35%, transparent);
  opacity: 0; animation: aip-rec-pulse 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes aip-rec-pulse { 0%,100% { opacity: 0; } 50% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .aip-card__recommendation::after { animation: none; } }

/* Inline CTA directly under the recommendation (central, above-the-fold).
   Same gradient as the sticky/card CTA; slightly tighter so it reads as a
   second prompt, not a heavier block. */
.aip-cta--inline { margin-top: 0; margin-bottom: 14px; }
.aip-card__markets { display: grid; gap: 8px; }
/* Mobile: label sits ABOVE the options, options span full width as equal columns. */
.aip-market {
  background: rgba(255,255,255,.03); border: 1px solid var(--aip-border);
  border-radius: 10px; padding: 8px 10px;
}
.aip-market__label {
  font-size: 10.5px; color: var(--aip-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.aip-market__options { display: flex; gap: 6px; }
.aip-option {
  flex: 1; text-align: center;
  font-size: 13px; font-weight: 600; padding: 7px 6px; border-radius: 8px;
  background: rgba(255,255,255,.04); color: var(--aip-muted);
}
.aip-option--pick { background: var(--aip-accent); color: #06241a; }
.aip-option__tick { margin-left: 3px; font-weight: 900; }
.aip-card__analysis { font-size: 15px; line-height: 1.6; color: var(--aip-text); margin: 16px 0 0; }
.aip-card__disclaimer { font-size: 10px; color: var(--aip-muted); text-align: center; margin: 12px 0 0; opacity: .8; }

/* ---- CTA buttons ----
   Cyan→green gradient with glow, matching the original template's .btn-primary.
   Gradient endpoints come from the theme vars (primary → accent) so per-page
   branding still applies; defaults are the original #22d3ee → #4ade80. */
.aip-cta {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  text-align: center; text-decoration: none;
  background-image: linear-gradient(to right, var(--aip-primary, #22d3ee), var(--aip-accent, #4ade80));
  color: var(--aip-cta-text, #020817);
  font-weight: 800; font-size: 16px; line-height: 1.5rem;
  padding: 14px 28px; border-radius: 12px; margin-top: 14px;
  box-shadow: 0 0 20px rgba(0, 245, 255, .30), 0 4px 15px rgba(0, 0, 0, .30);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), box-shadow .3s cubic-bezier(.4, 0, .2, 1), filter .3s ease;
}
.aip-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 0 28px rgba(0, 245, 255, .45), 0 6px 20px rgba(0, 0, 0, .35);
}

/* Desktop: the sticky-cta wrapper is a passthrough — button renders inline. */
.aip-sticky-cta { display: contents; }

/* Mobile: turn the wrapper into a COMPACT fixed footer BAR (not a giant green
   block). The bar is a slim dark strip; the button inside keeps normal size with
   horizontal page padding. ~72–84px tall, fixed to the bottom, appears on reveal. */
@media (max-width: 639px) {
  .aip-sticky-cta {
    display: block;
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    z-index: 50;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 16, 30, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--aip-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
    /* Hidden until the predictions reveal, then slides up. */
    transform: translateY(110%);
    transition: transform .35s ease;
  }
  body.aip-revealed .aip-sticky-cta { transform: translateY(0); }

  /* Button inside the bar: full-width, normal height — NOT a tall panel. */
  .aip-sticky-cta .aip-cta--card {
    width: 100%;
    margin: 0;
    min-height: 52px;
    display: flex; align-items: center; justify-content: center;
    padding: 12px 18px;
    border-radius: 14px;
  }

  /* Reserve space so the BTTS row, analysis text and disclaimer never sit behind
     the fixed bar. Sized to the bar height; only needed once it's showing. */
  body.aip-revealed { padding-bottom: 92px; }
}

/* ---- Other games list ---- */
.aip-other { margin-top: 28px; }
.aip-other__title { font-size: 14px; color: var(--aip-muted); text-transform: uppercase; letter-spacing: .1em; margin: 0 0 12px; }
.aip-other__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aip-other__item { margin: 0; }
.aip-other__link {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--aip-surface); border: 1px solid var(--aip-border);
  border-radius: 10px; padding: 11px 12px; font-size: 13px;
  color: var(--aip-text); text-decoration: none;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.aip-other__link:hover, .aip-other__link:active {
  border-color: var(--aip-primary);
  background: rgba(255,255,255,.05);
}
.aip-other__teams { display: flex; align-items: center; }
.aip-other__vs { color: var(--aip-muted); margin: 0 4px; }
.aip-other__time { color: var(--aip-primary); font-weight: 600; white-space: nowrap; padding-left: 10px; }

/* ---- Fallback ---- */
.aip-fallback { text-align: center; padding: 32px 16px; }
.aip-fallback__msg { color: var(--aip-muted); font-size: 15px; }

/* ---- CTA modal ---- */
.aip-modal { position: fixed; inset: 0; z-index: 9999; display: none; }
.aip-modal.aip-modal--open { display: block; }
.aip-modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 18, 0.75); backdrop-filter: blur(2px); }
.aip-modal__box {
  position: relative; z-index: 1;
  max-width: 360px; margin: 0 auto; top: 50%; transform: translateY(-50%);
  background: var(--aip-surface); border: 1px solid var(--aip-border);
  border-radius: 18px; padding: 28px 22px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: aip-modal-in .35s ease;
}
@keyframes aip-modal-in { from { opacity: 0; transform: translateY(-46%); } to { opacity: 1; transform: translateY(-50%); } }
.aip-modal__close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: var(--aip-muted);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.aip-modal__logo { max-width: 150px; max-height: 56px; object-fit: contain; margin: 0 auto 14px; display: block; }
.aip-modal__name { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.aip-modal__score { font-size: 13px; color: var(--aip-accent); font-weight: 700; margin-bottom: 10px; }
.aip-modal__score-star { color: #fbbf24; }
.aip-modal__bonus { font-size: 20px; font-weight: 900; margin: 0 0 6px; }
.aip-modal__tcs { font-size: 10px; color: var(--aip-muted); margin: 14px 0 0; }

/* ---- Tablet / desktop: scale spacing back up and restore the roomier card ---- */
@media (min-width: 640px) {
  .aip-main { padding: 56px 18px 64px; }
  .aip-hero { margin-bottom: 24px; }
  .aip-hero__brand { font-size: 11px; letter-spacing: .18em; padding: 6px 14px; margin-bottom: 16px; }
  .aip-hero__headline { font-size: 40px; line-height: 1.15; margin-bottom: 12px; }
  .aip-hero__sub { font-size: 15px; line-height: 1.5; max-width: 56ch; }

  .aip-engine { padding: 28px; border-radius: 20px; }
  .aip-fixture { margin-bottom: 18px; }
  .aip-fixture__team-logo { width: 64px; height: 64px; }

  .aip-card__recommendation { font-size: 22px; padding: 16px; margin-bottom: 16px; }

  /* Restore the desktop single-row market layout: label left, options right. */
  .aip-market {
    display: flex; align-items: center; justify-content: space-between;
  }
  .aip-market__label { margin-bottom: 0; }
  .aip-market__options { justify-content: flex-end; }
  .aip-option { flex: 0 0 auto; }
}

/* ---- Small phones: compact pass ---- */
@media (max-width: 360px) {
  .aip-main { padding: 14px 12px 44px; }
  .aip-hero__headline { font-size: 24px; }
  .aip-hero__sub { font-size: 12px; }
  .aip-engine { padding: 14px; }
  .aip-fixture__teams { gap: 10px; }
  .aip-fixture__team-logo { width: 44px; height: 44px; }
  .aip-fixture__team-name { font-size: 13px; }
  .aip-card__recommendation { font-size: 15px; }
  .aip-option { font-size: 12px; padding: 7px 4px; }
}

/* ===== Trust / marketing sections ===== */

/* ---- Live ticker bar ---- */
.aip-ticker {
  overflow: hidden; white-space: nowrap;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--aip-border);
}
.aip-ticker__track {
  display: inline-flex; align-items: center;
  padding: 8px 0;
  animation: aip-ticker-scroll 40s linear infinite;
}
.aip-ticker__item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 18px; font-size: 12px; font-weight: 600;
  border-right: 1px solid var(--aip-border);
}
.aip-ticker__match { color: var(--aip-muted); }
.aip-ticker__pick { color: var(--aip-text); }
.aip-ticker__conf { color: var(--aip-accent); font-weight: 800; }
@keyframes aip-ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .aip-ticker__track { animation: none; } }

/* ---- Trust chips + stat tiles ---- */
.aip-trust { margin-top: 22px; }
.aip-trust__chips {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.aip-trust__chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--aip-text);
  background: rgba(255,255,255,.04); border: 1px solid var(--aip-border);
  border-radius: 999px; padding: 6px 12px;
}
.aip-trust__tick { color: var(--aip-accent); font-weight: 900; }
.aip-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.aip-stat {
  text-align: center; background: var(--aip-surface);
  border: 1px solid var(--aip-border); border-radius: 12px; padding: 14px 10px;
}
.aip-stat__value { display: block; font-size: 22px; font-weight: 900; color: var(--aip-primary); line-height: 1; }
.aip-stat__label { font-size: 11px; color: var(--aip-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; display: block; }

/* ---- Section titles ---- */
.aip-section__title {
  text-align: center; font-size: 22px; font-weight: 900;
  margin: 36px 0 20px;
}

/* ---- Features grid ---- */
.aip-features__grid { display: grid; gap: 12px; }
.aip-feature {
  background: var(--aip-surface); border: 1px solid var(--aip-border);
  border-radius: 14px; padding: 18px;
}
.aip-feature__title { font-size: 16px; font-weight: 800; margin: 0 0 8px; }
.aip-feature__text { font-size: 13px; line-height: 1.5; color: var(--aip-muted); margin: 0 0 12px; }
.aip-feature__stat { display: flex; align-items: baseline; gap: 6px; border-top: 1px solid var(--aip-border); padding-top: 10px; }
.aip-feature__stat-value { font-size: 18px; font-weight: 900; color: var(--aip-accent); }
.aip-feature__stat-label { font-size: 11px; color: var(--aip-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---- How it works ---- */
.aip-steps__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aip-step { display: flex; gap: 14px; align-items: flex-start; }
.aip-step__num {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(34,211,238,.12); color: var(--aip-primary);
  font-weight: 900; font-size: 14px; border: 1px solid var(--aip-border);
}
.aip-step__title { font-size: 15px; font-weight: 800; margin: 4px 0 4px; }
.aip-step__text { font-size: 13px; line-height: 1.5; color: var(--aip-muted); margin: 0; }

/* ---- Desktop scaling for marketing sections ---- */
@media (min-width: 640px) {
  .aip-stats { grid-template-columns: repeat(4, 1fr); }
  .aip-section__title { font-size: 30px; margin: 56px 0 28px; }
  .aip-features__grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .aip-steps__list { grid-template-columns: repeat(4, 1fr); }
  .aip-step { flex-direction: column; text-align: center; align-items: center; }
}
