/* =========================================================
   SLUGHOLE / MATRIX CHECKOUT RESKIN (custom.css)
   - Safe: CSS only (no template rendering errors)
   - Scoped: only applies on /checkout pages
   - Vibe: dark swamp + neon slime + soft glow + “glass” panels
   ========================================================= */

/* Only run on checkout */
body:has(a[href*="/checkout"]),
body:has(form[action*="checkout"]),
body:has([class*="checkout"]),
body:has([id*="checkout"]),
body:has(*:contains("Order Information")) {
  /* fallbacks (some browsers ignore :has; below we also include html/body globals safely) */
}

/* Primary scope: SellAuth checkout URL */
body[class],
body {
  /* nothing global here */
}

body {
  /* keep page stable even if selectors miss */
}

/* Most reliable: URL-based scoping via attribute on html/body is not available in CSS,
   so we scope by common checkout structures + keep selectors specific */
body .checkout,
body [class*="checkout"],
body [class*="Checkout"],
body [id*="checkout"],
body [id*="Checkout"],
body form[action*="checkout"],
body form[action*="/checkout"],
body main:has([class*="Step"]),
body main:has([class*="step"]) {
  --bg0: #05070a;
  --bg1: #070c10;

  --panelA: rgba(14, 18, 22, 0.78);
  --panelB: rgba(10, 14, 17, 0.62);

  --text: rgba(240, 248, 255, 0.88);
  --muted: rgba(240, 248, 255, 0.58);

  --line: rgba(90, 255, 120, 0.14);
  --line2: rgba(90, 255, 120, 0.26);

  --slime: #68ff59;
  --slime2: #18f47a;
  --slime3: #0feea1;

  --radius: 18px;
  --radius2: 24px;

  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --shadow2: 0 10px 30px rgba(0,0,0,.45);

  --glow: 0 0 0 1px rgba(90, 255, 120, 0.12),
          0 0 26px rgba(24, 244, 122, 0.16),
          0 0 64px rgba(24, 244, 122, 0.06);
}

/* =============== Background + overall text =============== */
body:has(form[action*="checkout"]),
body:has([class*="Checkout"]),
body:has([class*="checkout"]),
body:has([id*="checkout"]) {
  background:
    radial-gradient(1100px 600px at 25% 10%, rgba(24, 244, 122, 0.12), transparent 60%),
    radial-gradient(900px 500px at 75% 20%, rgba(15, 238, 161, 0.10), transparent 55%),
    radial-gradient(800px 500px at 45% 85%, rgba(104, 255, 89, 0.08), transparent 60%),
    linear-gradient(180deg, #070c10, #05070a 55%, #040507) !important;
  color: rgba(240, 248, 255, 0.88) !important;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* =============== Glass panels / cards =============== */
body:has([class*="checkout"]) [class*="card"],
body:has([class*="checkout"]) [class*="Card"],
body:has([class*="checkout"]) [class*="panel"],
body:has([class*="checkout"]) [class*="Panel"],
body:has([class*="checkout"]) [class*="box"],
body:has([class*="checkout"]) [class*="Box"],
body:has([class*="checkout"]) section,
body:has([class*="checkout"]) article,
body:has([class*="checkout"]) form {
  border-radius: var(--radius2) !important;
}

body:has([class*="checkout"]) [class*="card"],
body:has([class*="checkout"]) [class*="Card"],
body:has([class*="checkout"]) [class*="panel"],
body:has([class*="checkout"]) [class*="Panel"],
body:has([class*="checkout"]) [class*="box"],
body:has([class*="checkout"]) [class*="Box"] {
  background: linear-gradient(180deg, rgba(14, 18, 22, 0.78), rgba(10, 14, 17, 0.62)) !important;
  border: 1px solid rgba(90, 255, 120, 0.12) !important;
  box-shadow: var(--shadow2) !important;
  backdrop-filter: blur(10px);
}

/* =============== Headings / text =============== */
body:has([class*="checkout"]) h1,
body:has([class*="checkout"]) h2,
body:has([class*="checkout"]) h3,
body:has([class*="checkout"]) [class*="title"],
body:has([class*="checkout"]) [class*="Title"] {
  color: rgba(240, 248, 255, 0.94) !important;
  letter-spacing: 0.2px;
}

body:has([class*="checkout"]) label,
body:has([class*="checkout"]) [class*="label"],
body:has([class*="checkout"]) [class*="Label"] {
  color: rgba(240, 248, 255, 0.62) !important;
  font-weight: 700 !important;
}

body:has([class*="checkout"]) small,
body:has([class*="checkout"]) [class*="hint"],
body:has([class*="checkout"]) [class*="Hint"],
body:has([class*="checkout"]) [class*="subtext"],
body:has([class*="checkout"]) [class*="Subtext"] {
  color: rgba(240, 248, 255, 0.55) !important;
}

/* =============== Inputs =============== */
body:has([class*="checkout"]) input,
body:has([class*="checkout"]) select,
body:has([class*="checkout"]) textarea {
  background: rgba(6, 10, 12, 0.74) !important;
  color: rgba(240, 248, 255, 0.92) !important;
  border: 1px solid rgba(90, 255, 120, 0.20) !important;
  border-radius: 14px !important;
  outline: none !important;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 8px 22px rgba(0,0,0,0.35) !important;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

body:has([class*="checkout"]) input::placeholder,
body:has([class*="checkout"]) textarea::placeholder {
  color: rgba(240, 248, 255, 0.34) !important;
}

body:has([class*="checkout"]) input:focus,
body:has([class*="checkout"]) select:focus,
body:has([class*="checkout"]) textarea:focus {
  border-color: rgba(104, 255, 89, 0.55) !important;
  box-shadow: var(--glow) !important;
  transform: translateY(-1px);
}

/* =============== Buttons (slime gradient + glow) =============== */
body:has([class*="checkout"]) button,
body:has([class*="checkout"]) [role="button"],
body:has([class*="checkout"]) input[type="submit"],
body:has([class*="checkout"]) a[class*="button"],
body:has([class*="checkout"]) a[class*="Button"] {
  border-radius: 16px !important;
  border: 1px solid rgba(90, 255, 120, 0.28) !important;
  background: linear-gradient(180deg, rgba(104,255,89,0.18), rgba(24,244,122,0.10)) !important;
  color: rgba(240, 248, 255, 0.92) !important;
  box-shadow: 0 10px 26px rgba(0,0,0,0.48), 0 0 0 1px rgba(90,255,120,0.12) !important;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  position: relative;
  overflow: hidden;
}

body:has([class*="checkout"]) button::before,
body:has([class*="checkout"]) [role="button"]::before,
body:has([class*="checkout"]) input[type="submit"]::before {
  content: "";
  position: absolute;
  inset: -120% -40%;
  background:
    radial-gradient(circle at 30% 30%, rgba(104,255,89,0.30), transparent 55%),
    radial-gradient(circle at 70% 40%, rgba(15,238,161,0.22), transparent 55%),
    linear-gradient(90deg, transparent, rgba(240,255,240,0.10), transparent);
  transform: rotate(10deg);
  opacity: 0.6;
  pointer-events: none;
}

body:has([class*="checkout"]) button:hover,
body:has([class*="checkout"]) [role="button"]:hover,
body:has([class*="checkout"]) input[type="submit"]:hover,
body:has([class*="checkout"]) a[class*="button"]:hover,
body:has([class*="checkout"]) a[class*="Button"]:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 44px rgba(0,0,0,0.58),
    0 0 0 1px rgba(90,255,120,0.16),
    0 0 32px rgba(24,244,122,0.18) !important;
  filter: saturate(1.08);
}

body:has([class*="checkout"]) button:active,
body:has([class*="checkout"]) [role="button"]:active,
body:has([class*="checkout"]) input[type="submit"]:active {
  transform: translateY(0px) scale(0.99);
  box-shadow: 0 10px 28px rgba(0,0,0,0.50), 0 0 0 1px rgba(90,255,120,0.12) !important;
}

/* Make primary “Proceed” button more “slime” */
body:has([class*="checkout"]) button[class*="primary"],
body:has([class*="checkout"]) button[class*="Primary"],
body:has([class*="checkout"]) input[type="submit"][class*="primary"],
body:has([class*="checkout"]) input[type="submit"][class*="Primary"] {
  background: linear-gradient(180deg, rgba(104,255,89,0.28), rgba(24,244,122,0.14)) !important;
  border-color: rgba(104,255,89,0.40) !important;
}

/* Coupon apply button slightly smaller glow */
body:has([class*="checkout"]) button[class*="apply"],
body:has([class*="checkout"]) button[class*="Apply"] {
  box-shadow: 0 10px 22px rgba(0,0,0,0.50), 0 0 18px rgba(24,244,122,0.14) !important;
}

/* =============== Payment method rows =============== */
body:has([class*="checkout"]) [class*="method"],
body:has([class*="checkout"]) [class*="Method"],
body:has([class*="checkout"]) [class*="payment"],
body:has([class*="checkout"]) [class*="Payment"] {
  border-color: rgba(90,255,120,0.14) !important;
}

body:has([class*="checkout"]) [class*="method"],
body:has([class*="checkout"]) [class*="Method"] {
  background: rgba(8, 12, 14, 0.45) !important;
  border: 1px solid rgba(90,255,120,0.12) !important;
  border-radius: 16px !important;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

body:has([class*="checkout"]) [class*="method"]:hover,
body:has([class*="checkout"]) [class*="Method"]:hover {
  transform: translateY(-2px);
  border-color: rgba(104,255,89,0.26) !important;
  box-shadow: 0 18px 40px rgba(0,0,0,0.55), 0 0 28px rgba(24,244,122,0.10) !important;
}

/* =============== Links =============== */
body:has([class*="checkout"]) a {
  color: rgba(104,255,89,0.95) !important;
  text-decoration: none;
}
body:has([class*="checkout"]) a:hover {
  color: rgba(15,238,161,0.98) !important;
  text-decoration: underline;
}

/* =============== Checkboxes / radios =============== */
body:has([class*="checkout"]) input[type="checkbox"],
body:has([class*="checkout"]) input[type="radio"] {
  accent-color: rgba(104,255,89,0.95);
}

/* =============== Divider lines =============== */
body:has([class*="checkout"]) hr,
body:has([class*="checkout"]) [class*="divider"],
body:has([class*="checkout"]) [class*="Divider"] {
  border-color: rgba(90,255,120,0.14) !important;
  opacity: 0.9;
}

/* =============== Subtle “firefly” glow behind content =============== */
body:has([class*="checkout"]) main {
  position: relative;
}

body:has([class*="checkout"]) main::before {
  content: "";
  position: absolute;
  inset: -60px -40px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(6px 6px at 12% 22%, rgba(255,255,180,0.55), transparent 60%),
    radial-gradient(5px 5px at 28% 66%, rgba(255,255,180,0.45), transparent 65%),
    radial-gradient(7px 7px at 46% 30%, rgba(255,255,180,0.40), transparent 65%),
    radial-gradient(5px 5px at 62% 58%, rgba(255,255,180,0.40), transparent 65%),
    radial-gradient(6px 6px at 78% 24%, rgba(255,255,180,0.35), transparent 65%),
    radial-gradient(7px 7px at 86% 72%, rgba(255,255,180,0.32), transparent 65%),
    radial-gradient(120px 120px at 20% 10%, rgba(24,244,122,0.08), transparent 65%),
    radial-gradient(160px 160px at 80% 20%, rgba(15,238,161,0.06), transparent 70%);
  opacity: 0.65;
  filter: blur(0.1px);
}

/* Keep main content above glow */
body:has([class*="checkout"]) main * {
  position: relative;
  z-index: 1;
}

/* =============== Mobile polish =============== */
@media (max-width: 900px) {
  body:has([class*="checkout"]) [class*="card"],
  body:has([class*="checkout"]) [class*="Card"],
  body:has([class*="checkout"]) [class*="panel"],
  body:has([class*="checkout"]) [class*="Panel"] {
    border-radius: 18px !important;
  }
}