/* Doscoin exchange widget — tokens pulled from Figma (DC_new, frames
   "Calc Default" / "Calc Request") via Figma Desktop Bridge.
   Golos Text is loaded as its own <link>/wp_enqueue_style, not a CSS @import
   here — @import blocks the browser from fetching it until AFTER this whole
   stylesheet has downloaded, instead of fetching both in parallel. */

.doscoin-widget {
  --ds-page-bg: #f5f5f7;
  --ds-card-bg: #ffffff;
  --ds-text: #212121;
  --ds-text-muted: #8b8b94;
  --ds-border: #e8e8e8;
  --ds-checkbox-border: #d4d4d4;
  --ds-orange-from: #f26326;
  --ds-orange-to: #f59424;
  --ds-error: #d3402f;
  --ds-radius-outer: 40px;
  --ds-radius-card: 16px;

  max-width: 520px;
  margin: 0 auto;
  padding: 32px;
  background: var(--ds-page-bg);
  border-radius: var(--ds-radius-outer);
  font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ds-text);
  box-sizing: border-box;
}
.doscoin-widget *, .doscoin-widget *::before, .doscoin-widget *::after { box-sizing: inherit; }

/* Host-theme isolation: WP + Elementor ship element+attribute selectors like
   `input[type=text] { border: 1px solid #666 }` (specificity 0,1,1), which
   beats our plain `.ds-amount`/`.ds-input` class rules (0,1,0) regardless of
   load order. Re-declared below at `.doscoin-widget .ds-x` (0,2,0) wherever
   that fight actually happens — never as a blanket element reset, which would
   in turn outrank (and break) our own single-class component rules the same way. */

.ds-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.36px;
  margin: 0 0 20px;
}

/* --- Give/Take cards --- */
.ds-fields { position: relative; display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.ds-card {
  background: var(--ds-card-bg);
  border-radius: var(--ds-radius-card);
  padding: 16px 20px;
}

.ds-card__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.12px;
  text-transform: uppercase;
  color: var(--ds-text-muted);
  margin-bottom: 8px;
}

.ds-card__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.ds-currency { position: relative; display: flex; align-items: center; gap: 16px; cursor: pointer; min-width: 0; }
.ds-currency--fixed { cursor: default; }

.ds-coin { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; display: block; }
.ds-coin img { width: 100%; height: 100%; display: block; }

.ds-currency__info { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ds-currency__name { display: flex; align-items: center; gap: 2px; font-size: 16px; font-weight: 600; line-height: 24px; letter-spacing: -0.16px; white-space: nowrap; }
.ds-currency__name img { width: 24px; height: 24px; }
.ds-currency__code { font-size: 12px; font-weight: 500; letter-spacing: -0.12px; text-transform: uppercase; color: var(--ds-text-muted); }

.ds-select-native { position: absolute; inset: 0; opacity: 0; cursor: pointer; border: 0; width: 100%; height: 100%; }
.ds-select-native:disabled { cursor: default; pointer-events: none; }

.doscoin-widget .ds-amount {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: right;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.32px;
  color: var(--ds-text);
  padding: 0;
  font-family: inherit;
}
.ds-amount:focus { outline: none; }

.ds-swap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 90px;
  border: 1px solid var(--ds-border);
  background: var(--ds-card-bg);
  color: var(--ds-text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.ds-swap:hover { background: var(--ds-card-bg); }
.ds-swap:active { transform: translate(-50%, -50%) scale(0.9); }
.ds-swap img { width: 24px; height: 24px; opacity: 0.5; }
.ds-swap:hover img { opacity: 1; }

.ds-rate {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
  color: var(--ds-text-muted);
  margin: 0 0 20px;
}
/* flex-start on .ds-rate aligns the dot to the top of the text block (so it
   sits with the first line when the rate text wraps to two lines) — nudge it
   down by half the leading (line-height 20px minus the dot's own 10.7px) so
   it's optically centered against that first line, not flush with its top. */
.ds-rate__dot { width: 10.7px; height: 10.7px; margin-top: 4.65px; flex: 0 0 auto; }

/* --- Buttons --- */
.ds-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--ds-radius-card);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.16px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  margin-bottom: 12px;
}
.ds-btn:last-child { margin-bottom: 0; }
.ds-btn { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.ds-btn:active:not(:disabled) { transform: scale(0.97); }
.ds-btn--primary { background: linear-gradient(90deg, var(--ds-orange-from) 28%, var(--ds-orange-to) 74%); color: #fff; }
/* explicit no-op hover — matches default exactly, just blocks the host
   theme's own button:hover from leaking through (see .ds-btn--ghost below) */
.ds-btn--primary:hover:not(:disabled) { background: linear-gradient(90deg, var(--ds-orange-from) 28%, var(--ds-orange-to) 74%); }
.ds-btn--primary:disabled { background: linear-gradient(90deg, rgba(242,99,38,0.6) 28%, rgba(245,148,36,0.6) 74%); color: #fff; cursor: not-allowed; }
/* explicit no-op hover state — blocks the host theme's own `button:hover`
   (e.g. hello-elementor's accent-colored hover) from showing through */
.ds-btn--ghost { background: var(--ds-card-bg); color: var(--ds-text); border: 1px solid var(--ds-border); }
.ds-btn--ghost:hover { background: var(--ds-card-bg); color: var(--ds-text); }
.ds-btn img { width: 24px; height: 24px; }

.ds-disclaimer {
  margin: 0;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  letter-spacing: -0.12px;
  color: var(--ds-text-muted);
}
.ds-disclaimer--error { color: var(--ds-error); }

/* --- Contact screen --- */
.ds-summary { display: flex; flex-direction: column; gap: 4px; margin: 0 0 20px; }
.ds-summary__row { display: flex; align-items: baseline; gap: 8px; flex-wrap: nowrap; }
.ds-summary__amount { font-size: 32px; font-weight: 600; letter-spacing: -0.32px; white-space: nowrap; }
.ds-summary__label { font-size: 16px; font-weight: 400; line-height: 24px; letter-spacing: -0.16px; color: var(--ds-text-muted); white-space: nowrap; }
.ds-summary__vs { display: block; font-size: 12px; font-weight: 500; letter-spacing: -0.12px; text-transform: uppercase; color: var(--ds-text-muted); }

.ds-contact-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.doscoin-widget .ds-input {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--ds-radius-card);
  border: none;
  background: var(--ds-card-bg);
  font-size: 16px;
  font-weight: 400;
  font-family: inherit;
  letter-spacing: -0.16px;
  color: var(--ds-text);
}
.ds-input::placeholder { color: #b2b2b8; }
.ds-input:focus { outline: 2px solid var(--ds-orange-to); outline-offset: -2px; }

.ds-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.14px;
  color: var(--ds-text-muted);
  padding: 6px 0;
  cursor: pointer;
}
.ds-checkbox a { color: var(--ds-orange-to); text-decoration: none; }
.ds-checkbox a:hover { text-decoration: underline; }
.ds-checkbox input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border-radius: 6px;
  border: 1.5px solid var(--ds-checkbox-border);
  background: var(--ds-card-bg);
  flex: 0 0 auto;
  cursor: pointer;
}
.ds-checkbox input:hover,
.ds-checkbox input:focus {
  border-color: var(--ds-orange-to);
  outline: none;
}
.ds-checkbox input:checked {
  background: var(--ds-orange-to) url('assets/checkbox-check.svg') no-repeat center / 14px 14px;
  border-color: var(--ds-orange-to);
}

/* honeypot: invisible to real users (and to WCAG-compliant screen readers via
   aria-hidden), but a naive scraper that fills every input still fills it */
.ds-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ds-error {
  color: var(--ds-error);
  font-size: 13px;
  margin: 0 0 12px;
}

.ds-screen--done p {
  text-align: center;
  font-size: 16px;
  padding: 20px 0;
}

/* No mobile frame in Figma yet — the amount input's fixed 32px font-size and
   the card's fixed padding didn't leave enough room next to the currency
   picker below ~480px, causing the two to overlap. Shrink proportionally. */
@media (max-width: 480px) {
  .doscoin-widget { padding: 20px; }
  .ds-title { font-size: 20px; }
  .ds-card { padding: 12px 16px; }
  .ds-card__row { gap: 8px; }
  .ds-coin { width: 36px; height: 36px; }
  /* .ds-currency's own `min-width: 0` lets it shrink-to-crush under flex
     pressure from `.ds-amount` next to it, which visually eats the gap
     between icon and text — keep the currency block at its natural width and
     let the amount input (which can go narrower without breaking) give way. */
  .ds-currency { gap: 8px; flex-shrink: 0; }
  .ds-currency__name { font-size: 14px; }
  .doscoin-widget .ds-amount { font-size: 22px; }
  .ds-summary__amount { font-size: 24px; }
  .ds-summary__label { font-size: 14px; }
}
