/* Stage6 Surf Add visits UI — only .sfa-surf-overlay, no effects on PTC or other modules */
/* SurfFlux Surf archive and top-up overlay v2. Scoped to PTC panel only. */
.sfa-surf-overlay .sfa-ptc-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 16px}
.sfa-surf-overlay .sfa-ptc-tab.sfa-current{font-weight:700;border-color:currentColor}
.sfa-surf-overlay .sfa-ptc-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.sfa-surf-overlay .sfa-ptc-pagination{display:flex;justify-content:flex-end;align-items:center;gap:12px;margin-top:16px}
.sfa-surf-overlay .sfa-ptc-message{padding:10px 14px;margin-bottom:12px;border-radius:8px;border:1px solid currentColor}
.sfa-surf-overlay .sfa-ptc-message.sfa-error{color:#bd3333}
.sfa-surf-overlay .sfa-ptc-message.sfa-success{color:inherit}
.sfa-surf-overlay button[disabled]{cursor:not-allowed;opacity:.55}
@media (max-width:720px){.sfa-surf-overlay .sfa-ptc-actions{justify-content:flex-start}}

/* Add visits section. No global selectors; keep Publisher Network styling untouched. */
.sfa-surf-overlay .sfa-topup-form{padding:16px;margin:0 0 14px;border:1px solid var(--border-color, #8798a6);border-radius:10px}
.sfa-surf-overlay .sfa-topup-form p{margin:8px 0}
.sfa-surf-overlay .sfa-topup-controls{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin-top:12px}
.sfa-surf-overlay .sfa-topup-controls label{display:flex;flex-direction:column;gap:5px}
.sfa-surf-overlay .sfa-topup-count{font:inherit;box-sizing:border-box;min-width:130px;max-width:210px;padding:8px;border-radius:6px;border:1px solid #789}
.sfa-surf-overlay .sfa-topup-error{color:#b73535;font-weight:600}
.sfa-surf-overlay .sfa-topup-summary{font-weight:700}
.sfa-surf-overlay .sfa-topup-buy{margin-right:8px}
.sfa-surf-overlay .sfa-topup-hint{font-size:.85rem;opacity:.8}

/* SurfFlux — visual-only polish for the Surf Add visits box.
   Intentionally scoped to .sfa-surf-overlay .sfa-topup-form.
   Does not alter app behavior, validation, pricing, AP/DOGE, or any other panel. */

.sfa-surf-overlay .sfa-topup-form {
  --sf-topup-ink: #1c3049;
  --sf-topup-muted: #526783;
  --sf-topup-border: #c5d5e4;
  --sf-topup-accent: #0876a5;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 14px;
  row-gap: 14px;
  align-items: end;
  margin: 2px 0 18px;
  padding: clamp(18px, 2.25vw, 28px);
  border: 1px solid var(--sf-topup-border);
  border-radius: 17px;
  background: linear-gradient(111deg, #ffffff 0%, #ffffff 43%, #f4faff 77%, #e5f5fd 100%);
  color: var(--sf-topup-ink);
  box-shadow: 0 10px 27px rgba(25, 71, 110, .09), 0 2px 6px rgba(25, 71, 110, .035);
}

.sfa-surf-overlay .sfa-topup-form::before {
  content: '';
  position: absolute;
  top: -148px;
  right: -95px;
  width: 410px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(127, 213, 250, .22) 0%, rgba(180, 227, 251, .12) 47%, transparent 73%);
  pointer-events: none;
  z-index: -1;
}

.sfa-surf-overlay .sfa-topup-form > * {
  position: relative;
  min-width: 0;
}

/* Title and small layered icon. The title remains real selectable text. */
.sfa-surf-overlay .sfa-topup-form > strong:first-child {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 13px;
  font-size: clamp(1.08rem, 1.2vw, 1.32rem);
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.35;
  color: #1a304b;
}
.sfa-surf-overlay .sfa-topup-form > strong:first-child::before {
  content: '';
  flex: 0 0 41px;
  width: 41px;
  height: 41px;
  border-radius: 11px;
  background-color: #dcf5fd;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27' viewBox='0 0 24 24' fill='none' stroke='%23077ca6' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3-9 5 9 5 9-5-9-5Z'/%3E%3Cpath d='m3 12 9 5 9-5'/%3E%3Cpath d='m3 16 9 5 9-5'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(1, 114, 163, .055);
}

/* Existing explanatory text appears as a restrained information strip. */
.sfa-surf-overlay .sfa-topup-form > p:first-of-type {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 16px;
  color: var(--sf-topup-muted);
  background: rgba(226, 241, 252, .72);
  border-left: 3px solid #2396c4;
  border-radius: 9px;
  font-size: .91rem;
  font-weight: 400;
  line-height: 1.55;
}

/* Input, currency selector and main action share one consistent baseline. */
.sfa-surf-overlay .sfa-topup-controls {
  display: flex;
  grid-column: 1;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  min-width: 0;
}
.sfa-surf-overlay .sfa-topup-controls label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  color: #273e59;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.35;
}
.sfa-surf-overlay .sfa-topup-controls label:first-child {
  width: min(100%, 245px);
}
.sfa-surf-overlay .sfa-topup-controls .sfa-topup-currency-label {
  width: min(100%, 220px);
}
.sfa-surf-overlay .sfa-topup-count,
.sfa-surf-overlay .sfa-topup-currency {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #b7c8d9;
  border-radius: 10px;
  background: #fff;
  color: #1a304b;
  font-family: inherit;
  font-size: .98rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: inset 0 1px 2px rgba(23, 68, 109, .035);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sfa-surf-overlay .sfa-topup-count:focus-visible,
.sfa-surf-overlay .sfa-topup-currency:focus-visible {
  outline: 2px solid #67c7f2;
  outline-offset: 2px;
  border-color: #1885b6;
}
.sfa-surf-overlay .sfa-topup-controls > button,
.sfa-surf-overlay .sfa-topup-buy {
  box-sizing: border-box;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid #08719b;
  border-radius: 11px;
  background: linear-gradient(180deg, #0786b7 0%, #076992 100%);
  color: #fff;
  font-size: .97rem;
  font-weight: 750;
  line-height: 1.3;
  box-shadow: 0 3px 0 rgba(0, 72, 111, .13), 0 6px 14px rgba(0, 99, 151, .1);
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sfa-surf-overlay .sfa-topup-controls > button:hover:not(:disabled),
.sfa-surf-overlay .sfa-topup-buy:hover:not(:disabled) {
  background: linear-gradient(180deg, #0875a6, #055b83);
  transform: translateY(-1px);
}
.sfa-surf-overlay .sfa-topup-controls > button:focus-visible,
.sfa-surf-overlay .sfa-topup-buy:focus-visible,
.sfa-surf-overlay .sfa-topup-close:focus-visible {
  outline: 2px solid #49b8f0;
  outline-offset: 3px;
}
.sfa-surf-overlay .sfa-topup-controls > button:disabled,
.sfa-surf-overlay .sfa-topup-buy:disabled,
.sfa-surf-overlay .sfa-topup-close:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.sfa-surf-overlay .sfa-topup-close {
  grid-column: 2;
  justify-self: end;
  align-self: end;
  box-sizing: border-box;
  min-height: 46px;
  margin: 0;
  padding: 10px 19px;
  border: 1px solid #dbe4ed;
  border-radius: 11px;
  background: #edf2f7;
  color: #40536d;
  font-size: .95rem;
  font-weight: 650;
  box-shadow: none;
}
.sfa-surf-overlay .sfa-topup-close:hover:not(:disabled) {
  background: #e4ebf2;
}

/* Quote view: total stands out, while financial warnings remain readable. */
.sfa-surf-overlay .sfa-topup-summary {
  grid-column: 1 / -1;
  margin: 0;
  padding: 15px 18px;
  border: 1px solid #b6dcec;
  border-radius: 12px;
  background: #f0faff;
  color: #0d547b;
  font-size: clamp(1.02rem, 1.05vw, 1.15rem);
  font-weight: 800;
  line-height: 1.4;
}
.sfa-surf-overlay .sfa-topup-form > p:not(:first-of-type) {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.5;
}
.sfa-surf-overlay .sfa-topup-form .sfa-topup-hint {
  color: #526783;
  font-size: .875rem;
  opacity: 1;
}
.sfa-surf-overlay .sfa-topup-form .sfa-topup-error {
  padding: 10px 13px;
  border: 1px solid #efc0bf;
  border-radius: 9px;
  background: #fff0f0;
  color: #a92e2e;
  font-weight: 700;
}
.sfa-surf-overlay .sfa-topup-buy {
  grid-column: 1;
  justify-self: start;
  margin: 0;
}

@media (max-width: 820px) {
  .sfa-surf-overlay .sfa-topup-form {
    grid-template-columns: minmax(0, 1fr);
    padding: 17px;
    row-gap: 13px;
  }
  .sfa-surf-overlay .sfa-topup-controls,
  .sfa-surf-overlay .sfa-topup-close,
  .sfa-surf-overlay .sfa-topup-buy {
    grid-column: 1;
  }
  .sfa-surf-overlay .sfa-topup-close {
    justify-self: start;
  }
}
@media (max-width: 520px) {
  .sfa-surf-overlay .sfa-topup-form > strong:first-child::before {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }
  .sfa-surf-overlay .sfa-topup-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .sfa-surf-overlay .sfa-topup-controls label:first-child,
  .sfa-surf-overlay .sfa-topup-controls .sfa-topup-currency-label,
  .sfa-surf-overlay .sfa-topup-controls > button {
    width: 100%;
  }
  .sfa-surf-overlay .sfa-topup-close,
  .sfa-surf-overlay .sfa-topup-buy {
    width: 100%;
    justify-self: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sfa-surf-overlay .sfa-topup-form * {
    transition: none;
  }
}

/* The visit-count heading remains on a single line when space allows. */
@media(min-width: 900px){
 .sfa-surf-overlay .sfa-topup-controls label:first-child{width:min(100%,350px);white-space:nowrap}
}
@media(max-width:899px){
 .sfa-surf-overlay .sfa-topup-controls label:first-child{white-space:normal}
}
