/* ============================================================
   mafincash.com — Components (inherited 1:1 from ant.exchange)
   Built on top of vendor.css (Bootstrap 5 + jQuery) which loads
   first; these rules override Bootstrap visuals with the ant
   design system. References tokens.css variables only.
   ============================================================ */

/* News card tile — used on the homepage preview (components/homeNews.php) AND the
   /news listing (views/news.php). Lives here (not home.css/news.css) because
   head.php only auto-loads ONE per-route stylesheet — a shared class needs the
   always-loaded file, not either page-specific one. */
.home-news__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.home-news__item { display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden; transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.home-news__item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
.home-news__thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--muted); margin: -1px -1px 0; }
.home-news__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-news__title { font-size: var(--fs-base); font-weight: 700; margin: 0 0 8px; }
.home-news__excerpt {
  color: var(--muted-foreground); font-size: var(--fs-small); line-height: 1.55; margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.home-news__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); color: var(--muted-foreground); }
@media (max-width: 980px) { .home-news__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .home-news__grid { grid-template-columns: 1fr; } }

/* ─────────────────────────────────────────────
   Site-wide fixed footer — partners band (components/siteFooter.php).
   Pinned to the bottom of the viewport on EVERY page (owner's request 2026-07-27:
   "закріпи підвал з ... стрічкою партнерів знизу"). Height varies — the band can
   wrap to 2 rows on narrow viewports — so siteFooter.php's own script measures the
   rendered height into --site-footer-h; body padding and .back-to-top read that
   same variable so nothing ends up hidden behind or overlapping the fixed bar.
   ───────────────────────────────────────────── */
body { padding-bottom: var(--site-footer-h, 90px); }
.home-partners-section {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-float);
  width: 100%; background: var(--primary); padding: 26px 16px;
  box-shadow: 0 -6px 20px rgba(17, 24, 39, 0.12);
}
.home-partners { max-width: var(--container); margin: 0 auto; display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 18px; }
.home-partners__badge { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; opacity: .92; transition: opacity var(--dur-fast) var(--ease); }
.home-partners__badge:hover { opacity: 1; }
.home-partners__badge img { height: 28px; width: auto; display: block; }
/* exfinder.png's blue half has poor contrast on purple — light chip just for it */
.home-partners__badge--light { background: #fff; padding: 5px 12px; border-radius: var(--radius-lg); }
.home-partners__badge--light img { height: 22px; }
@media (max-width: 1400px) { .home-partners { gap: 12px; } .home-partners__badge img { height: 24px; } .home-partners__badge--light img { height: 19px; } }
@media (max-width: 1100px) { .home-partners { flex-wrap: wrap; } }

.container { max-width: var(--container); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
/* Width constraint for non-home views (rules, about, faq, contact, …) */
.main-wrap { max-width: var(--container); margin: 0 auto; padding: 28px 16px 8px; }
.main-wrap .card { max-width: 920px; margin: 0 auto; }
.card-header { padding: 22px 26px 0; font-size: var(--fs-h3); font-weight: 700; border: 0; background: transparent; }
.card-body { padding: 24px 26px 26px; }
.card-body img { height: auto; }

/* ─────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────── */
.btn,
.btn-success,
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 0 20px;
  min-height: 44px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
  text-decoration: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(123,98,255,.35); }

.btn--primary,
.btn-primary,
.btn-success {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-primary);
}
.btn--primary:hover,
.btn-primary:hover,
.btn-success:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); }
.btn--primary:active,
.btn-primary:active,
.btn-success:active { background: var(--primary-active); transform: translateY(0); }
.btn--primary[disabled], .btn-primary[disabled], .btn-success[disabled] { opacity: .6; cursor: not-allowed; box-shadow: none; transform: none; }

.btn--block { width: 100%; min-height: 52px; font-size: var(--fs-body); font-weight: 600; }

.btn--outline {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn--outline:hover { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--accent); }

.btn--ghost { background: transparent; color: var(--muted-foreground); }
.btn--ghost:hover { background: var(--muted); color: var(--foreground); }

.btn--sm { min-height: 36px; padding: 0 14px; font-size: var(--fs-xs); }
.btn--tg { background: var(--primary); color: #fff; }
.btn--disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; pointer-events: none; }

/* exchange-confirm page (loads components.css, NOT home.css) */
.ex-confirm-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.confirm-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.confirm-table td, .confirm-table th { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.confirm-table tr:last-child td { border-bottom: 0; }
.confirm-table td:first-child, .confirm-table th:first-child { color: var(--muted-foreground); white-space: nowrap; }
.confirm-table img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

/* ─────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────── */
.card,
.ant-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ant-card__body { padding: 28px; }
.ant-card__title { font-size: var(--fs-h3); font-weight: 700; margin-bottom: 6px; }

/* ─────────────────────────────────────────────
   Form controls
   ───────────────────────────────────────────── */
.form-control,
.form-select,
.field__input,
.ant-input {
  width: 100%;
  min-height: var(--control-h);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--foreground);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.form-control::placeholder, .ant-input::placeholder { color: #94A3B8; }
.form-control:focus,
.form-select:focus,
.field__input:focus,
.ant-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(123,98,255,.18);
}
.form-control.is-invalid { border-color: var(--destructive); box-shadow: 0 0 0 3px rgba(220,38,38,.14); }
textarea.form-control { min-height: 96px; padding-top: 12px; resize: vertical; }

label { font-size: var(--fs-small); font-weight: 500; color: var(--foreground); }
.form-group label { margin-bottom: 6px; display: inline-block; }

/* search field with leading icon */
.ant-search { position: relative; }
.ant-search .ant-input { padding-left: 42px; }
.ant-search__icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #94A3B8; pointer-events: none;
}

/* checkboxes */
.ant-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--fs-small); color: var(--foreground); line-height: 1.45; }
.ant-check input[type=checkbox],
.ant-check input[type=radio] {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px;
  border: 1.5px solid var(--border-strong); border-radius: 6px; background: #fff;
  cursor: pointer; position: relative; transition: all var(--dur-fast) var(--ease);
}
.ant-check input[type=radio] { border-radius: 50%; }
.ant-check input:checked { background: var(--primary); border-color: var(--primary); }
.ant-check input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.ant-check input[type=radio]:checked::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  background: #fff; border-radius: 50%; transform: translate(-50%,-50%);
}

/* ─────────────────────────────────────────────
   Top bar
   ───────────────────────────────────────────── */
/* Scroll behaviour is a TWO-STATE toggle (body.is-scrolled), NOT a per-pixel --sh
   interpolation. The old continuous version changed the navbar/topbar HEIGHT on every
   scroll frame, which changed document height → the browser nudged scrollY → recompute
   → resize … = visible jitter mid-scroll. Now: the topbar simply scrolls away (no
   height animation), and the sticky header morphs into a floating capsule using only
   paint properties (max-width / radius / background / shadow) — document height never
   changes, so there is no feedback loop. */
.topbar {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--muted-foreground);
  position: relative; z-index: 0;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; flex-wrap: wrap; }
.topbar__hours { display: inline-flex; align-items: center; gap: 7px; }
.topbar__links { display: inline-flex; align-items: center; gap: 18px; }
.topbar__link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted-foreground); }
.topbar__link:hover { color: var(--primary); }
.topbar__link svg, .topbar__hours svg { width: 14px; height: 14px; }
/* Operator status pill, left side of the topbar (moved here from the calculator to
   match the live mafincash.com layout) — smaller than its calc__ usage elsewhere. */
.topbar__status { padding: 5px 14px; font-size: 12px; font-weight: 600; }

/* ─────────────────────────────────────────────
   Header / navbar
   ───────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: #fff;
  border-bottom: 1px solid rgba(231, 229, 244, 1);
  transition: background .28s var(--ease), border-color .28s var(--ease);
}
/* scrolled → the full-width white strip fades to transparent so the inner capsule floats */
body.is-scrolled .header { background: transparent; border-bottom-color: transparent; }

/* The visible bar morphs into a centered rounded floating capsule — PAINT-ONLY props
   (max-width/radius/bg/shadow), height stays constant → no layout feedback, no jitter. */
.header .header__inner {
  display: flex; align-items: center; gap: 20px;
  min-height: var(--header-h);
  max-width: var(--container, 1536px);
  margin-inline: auto;
  border-radius: 0;
  background: rgba(255, 255, 255, 0);
  box-shadow: 0 10px 34px rgba(17, 24, 39, 0);
  backdrop-filter: saturate(180%) blur(10px);
  transition: max-width .28s var(--ease), border-radius .28s var(--ease), background .28s var(--ease), box-shadow .28s var(--ease);
}
body.is-scrolled .header .header__inner {
  max-width: calc(var(--container, 1536px) - 440px);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 34px rgba(17, 24, 39, 0.13);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: var(--foreground); }
.brand img { height: 34px; width: auto; display: block; transition: height .28s var(--ease); }
body.is-scrolled .brand img { height: 30px; }
.brand:hover { color: var(--foreground); }

.nav { display: flex; align-items: center; gap: 4px; margin: 0 auto; }
.nav__link {
  display: inline-flex; align-items: center; padding: 9px 14px;
  border-radius: var(--radius-pill); font-size: var(--fs-small); font-weight: 500;
  color: var(--muted-foreground); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__link:hover { background: var(--secondary); color: var(--secondary-foreground); }
.nav__link--active { background: var(--accent); color: var(--accent-foreground); }
.nav__auth-m { display: none; }
.nav__exchange { margin-right: 10px; flex: 0 0 auto; }

/* lift the action buttons into their own stacking layer so nothing (e.g. the top
   strip at scroll-top) can ever intercept clicks meant for the lang/account dropdowns */
.header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; position: relative; z-index: 2; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  background: var(--background); border: 1px solid var(--border); color: var(--muted-foreground);
  cursor: pointer; transition: all var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: var(--accent); background: var(--secondary); }
.icon-btn svg { width: 20px; height: 20px; }

.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px;
  border-radius: var(--radius-pill); background: var(--background); border: 1px solid var(--border);
  font-size: var(--fs-small); font-weight: 600; color: var(--foreground); cursor: pointer;
}
.lang-toggle:hover { border-color: var(--accent); background: var(--secondary); }

.burger { display: none; }

/* ─────────────────────────────────────────────
   Dropdowns (Bootstrap base, restyled)
   ───────────────────────────────────────────── */
/* kill Bootstrap's built-in caret — our toggles already render a single ▾ */
.dropdown-toggle::after { display: none !important; }
.dropdown-menu {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 180px; background: var(--popover);
}
.dropdown-item {
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: var(--fs-small);
  color: var(--foreground); font-weight: 500;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--secondary); color: var(--secondary-foreground); }
.dropdown-item--active { background: var(--accent); color: var(--accent-foreground); }

/* ─────────────────────────────────────────────
   Status / alert banners
   ───────────────────────────────────────────── */
.statusline {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px; border-radius: var(--radius-pill); font-size: var(--fs-small); font-weight: 500;
}
.statusline__dot { width: 9px; height: 9px; border-radius: 50%; }
.statusline--online  { background: var(--status-online-bg); color: var(--status-online-fg); }
.statusline--online .statusline__dot  { background: var(--status-online-dot); box-shadow: 0 0 0 4px rgba(34,197,94,.18); }
.statusline--offline { background: var(--status-offline-bg); color: var(--status-offline-fg); }
.statusline--offline .statusline__dot { background: var(--status-offline-dot); box-shadow: 0 0 0 4px rgba(239,68,68,.18); }

.alert { border-radius: var(--radius-lg); border: 1px solid transparent; padding: 14px 16px; font-size: var(--fs-small); }
.alert-warning { background: var(--warning-soft); border-color: #FCD9A1; color: #92400E; }
.alert-success { background: var(--success-soft); border-color: #A7F3D0; color: var(--success-foreground); }
.alert-danger { background: var(--destructive-soft); border-color: #FCA5A5; color: #991B1B; }
/* engine form alerts: <div class="alert bg-danger|bg-success text-white"> → solid fill, white text */
.alert.bg-danger  { background: var(--destructive) !important; color: #fff !important; border-color: transparent; }
.alert.bg-success { background: var(--success) !important; color: #fff !important; border-color: transparent; }
.alert.text-white { color: #fff !important; }
.form-response { margin-bottom: 12px; }
.text-danger { color: var(--destructive); font-size: var(--fs-xs); margin-top: 4px; }

/* info plate (violet) used by exchange notices */
.plate {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--info-soft); color: var(--secondary-foreground); font-size: var(--fs-small); line-height: 1.5;
}
.plate svg { flex: 0 0 auto; width: 20px; height: 20px; color: var(--primary); margin-top: 1px; }
.plate--warn { background: var(--warning-soft); color: #92400E; }
.plate--warn svg { color: var(--warning); }

/* ─────────────────────────────────────────────
   Cookie banner
   ───────────────────────────────────────────── */
.cookie {
  position: fixed; left: 18px; bottom: 18px; z-index: var(--z-overlay);
  max-width: 380px; background: var(--secondary); border: 1px solid var(--accent);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 18px 20px;
}
.cookie__title { font-weight: 700; margin-bottom: 4px; }
.cookie__text { font-size: var(--fs-small); color: var(--muted-foreground); margin-bottom: 12px; }

/* ─────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────── */
.footer { background: var(--footer-bg); border-top: 1px solid var(--border); margin-top: 56px; }
.footer__inner { padding: 40px 16px 28px; }
.footer__top { display: flex; flex-wrap: wrap; gap: 28px 40px; justify-content: space-between; }
.footer__brand { max-width: 320px; }
.footer__brand .brand { margin-bottom: 10px; }
.footer__tagline { font-size: var(--fs-small); color: var(--muted-foreground); }
.footer__col h5 { font-size: var(--fs-small); font-weight: 700; margin-bottom: 12px; color: var(--foreground); }
.footer__links { display: flex; flex-direction: column; gap: 8px; }
.footer__links a { font-size: var(--fs-small); color: var(--muted-foreground); }
.footer__links a:hover { color: var(--primary); }
.footer__partners { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.footer__partners img { height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted-foreground); }
.footer__lang a { display: inline-flex; padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; color: var(--muted-foreground); margin-left: 6px; }
.footer__lang a.active, .footer__lang a:hover { background: var(--accent); color: var(--accent-foreground); border-color: var(--accent); }

/* ─────────────────────────────────────────────
   Back-to-top
   ───────────────────────────────────────────── */
.back-to-top {
  position: fixed; left: 18px; bottom: calc(var(--site-footer-h, 90px) + 18px); z-index: var(--z-float);
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--background); color: var(--primary); box-shadow: var(--shadow-md); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.back-to-top[hidden] { display: none; }
.back-to-top svg { width: 22px; height: 22px; }

/* ─────────────────────────────────────────────
   Mobile nav
   ───────────────────────────────────────────── */
@media (max-width: 991px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 2px; background: var(--background);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); padding: 10px 16px; }
  .header.is-open .nav { display: flex; }
  .nav__link { padding: 12px 14px; }
  .burger { display: inline-flex; }
  /* mobile: collapse auth + language into the burger menu; keep header to logo + theme + burger */
  .header__actions .dropdown,
  .btn-login { display: none; }
  .nav__auth-m { display: block; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
  .nav__auth-m:first-of-type { border-top: 0; }
  .nav__exchange { margin: 0 0 6px; width: 100%; }
}

/* Phone — compact header chrome + top bar */
@media (max-width: 640px) {
  .topbar { font-size: 11px; }
  .topbar__inner { flex-direction: column; gap: 3px; min-height: 0; padding-top: 6px; padding-bottom: 6px; text-align: center; }
  .topbar__links { gap: 14px; }
  .brand { min-width: 0; flex-shrink: 1; }
  /* bigger logo on mobile to match the original ant header (issue #8) */
  .brand img { height: 44px; max-width: 200px; }
  body.is-scrolled .brand img { height: 38px; }
  .header__inner { gap: 8px; min-height: 60px; flex-wrap: nowrap; }
  .header__actions { gap: 6px; flex-shrink: 0; }
  .icon-btn { height: 38px; width: 38px; }
  .btn--sm { min-height: 38px; padding: 0 12px; }
  /* language lives in the footer + burger menu on phones — frees header width */
  .lang-toggle { display: none; }
  /* compact icon-only login so the burger stays visible */
  .btn-login { width: 38px; min-height: 38px; padding: 0; border-radius: 50%; gap: 0; }
  .btn-login .btn-label { display: none; }
  /* status pill must wrap instead of forcing horizontal overflow */
  .statusline { display: flex; align-items: flex-start; white-space: normal; border-radius: var(--radius-lg); font-size: 13px; }
}
@media (max-width: 420px) {
  /* keep only icons for the contact links to avoid wrapping */
  .topbar__link { gap: 0; font-size: 0; }
  .topbar__link svg { width: 16px; height: 16px; }
}

/* Auth pages (login / register) — bottom link row, dashed separator (like teddy) */
.auth-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px;
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-strong);
}
.auth-links a { color: var(--muted-foreground); font-size: var(--fs-small); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-links a:hover { color: var(--primary); }
