/*
 * Website quality pass
 * Scoped layout and legibility corrections for existing AyaSend routes.
 * Keep the product-specific blue/gold brand and existing interaction styles.
 */

html {
  scroll-padding-top: 1rem;
}

body :focus-visible {
  outline: 2px solid #946800;
  outline-offset: 3px;
}

/* Legacy mobile and desktop sheets disagree at tablet widths. Keep controls
   inside the real viewport rather than merely hiding document overflow. */
html body #main-header {
  width: 100%;
  max-width: 100%;
}
html body #main-header .header-left {
  flex-shrink: 0;
}
html body #main-header .header-right {
  min-width: 0;
  margin-left: auto;
}
@media (max-width: 1199px) {
  html body #main-header .header-desktop-nav {
    display: none !important;
  }
  html body #main-header #mobile-menu-btn {
    display: flex !important;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }
}
@media (min-width: 1200px) {
  html body #main-header #mobile-menu-btn {
    display: none !important;
  }
  html body #main-header .header-desktop-nav {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Active home hero: keep the feature tiles legible without changing their order. */
#family-hero-section .aya-fsp,
#family-hero-section .aya-fsp__body,
#family-hero-section .aya-fsp__grid,
#family-hero-section .aya-fsp__card {
  min-width: 0;
}
#family-hero-section .aya-fsp__trust {
  font-size: 12px;
  line-height: 1.35;
}
#family-hero-section .aya-fsp__card-title {
  font-size: 13px;
  line-height: 1.35;
}
#family-hero-section .aya-fsp__card-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #e2e8f0;
}
#family-hero-section .aya-fsp__cta {
  min-height: 48px;
  flex-wrap: wrap;
  text-align: center;
  overflow-wrap: anywhere;
}
@media (max-width: 380px) {
  #family-hero-section .aya-fsp__body {
    padding: 22px 16px 26px;
  }
  #family-hero-section .aya-fsp__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }
  #family-hero-section .aya-fsp__card {
    padding: 14px;
  }
  #family-hero-section .aya-fsp__trusts {
    gap: 8px;
  }
  #family-hero-section .aya-fsp__trust {
    white-space: normal;
  }
}

/* Active transfer widget. Keep country choices and amount entry comfortable
   at touch sizes; 16px fields prevent iOS Safari's automatic zoom on focus. */
#calculator,
#calculator .transfer-card,
#calculator #controls,
#calculator .transfer-route,
#calculator .route-side {
  min-width: 0;
}
#calculator .route-select {
  min-height: 48px;
}
#calculator input:not([type="hidden"]),
#calculator select,
#calculator textarea {
  min-width: 0;
}
@media (max-width: 767px) {
  #calculator input:not([type="hidden"]),
  #calculator select,
  #calculator textarea {
    font-size: 16px !important;
  }
  #calculator .route-select {
    min-height: 48px;
  }
}

/* Actual shared footer: retain the established blue CTA, improve link rhythm. */
body > footer a {
  overflow-wrap: anywhere;
}
@media (max-width: 639px) {
  body > footer .grid > div a {
    min-height: 40px;
    display: flex;
    align-items: center;
    line-height: 1.45;
  }
}

/* Transfer calculator and product tabs remain content-first at narrow widths;
   long French/Spanish labels may wrap instead of squeezing into tiny text. */
@media (max-width: 520px) {
  #recharge-page, #data-page {
    width: 100%;
    max-width: 32rem;
    padding-inline: 14px;
  }
  #recharge-page #_rchg-tabs > *,
  #data-page #_data-tabs > * {
    min-width: 0;
    padding-inline: 5px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  #recharge-page .rchg-family-invite,
  #data-page .data-family-invite {
    min-width: 0;
    flex-wrap: wrap;
  }
  #recharge-page .rchg-family-invite > :last-child,
  #data-page .data-family-invite > :last-child {
    margin-left: auto;
  }
  #rchg-checkout-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }
}

/* Gift-card discovery is intentionally informational while purchases are held.
   Keep the hold message and actions fully readable across translated layouts. */
.gc-info,
.gc-info__wrap,
.gc-info__hero,
.gc-info__hold,
.gc-info__support {
  min-width: 0;
}
.gc-info__hero,
.gc-info__hold,
.gc-info__section,
.gc-info__support {
  overflow-wrap: anywhere;
}
.gc-info .gc-info__hero {
  padding: clamp(26px, 5vw, 68px);
}
.gc-info .gc-info__hold {
  align-items: flex-start;
}
.gc-info__links > a {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 380px) {
  .gc-info {
    padding-inline: 14px;
  }
  .gc-info .gc-info__hero {
    padding: 25px 20px;
    border-radius: 18px;
  }
  .gc-info__hold {
    gap: 11px;
  }
  .gc-info__hold-mark {
    flex-basis: 30px;
    height: 30px;
  }
}

/* Standalone documents now follow the shared light-default/explicit-dark
   theme contract instead of unexpectedly forcing a dark page. */
:root:not(.dark):has(body.aya-auth-document),
:root:not(.dark):has(body .nav-inner) {
  --bg: #f6f8fc;
  --card: #ffffff;
  --card-bg: #ffffff;
  --card-border: #dce4f1;
  --text: #0f172a;
  --text-sub: #475569;
  --text-muted: #52617a;
  --input-bg: #ffffff;
  --input-border: #bdcadf;
  --primary: #1d4ed8;
  --primary-h: #1e40af;
  --accent: #946800;
  --error: #b91c1c;
  --error-bg: #fff1f2;
}
html:not(.dark) body.aya-auth-document {
  background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%) !important;
  color: #0f172a;
}
html:not(.dark) body.aya-auth-document .glow {
  opacity: .08;
}
html:not(.dark) body:has(> .wrapper) .card {
  box-shadow: 0 12px 40px rgba(30, 64, 175, .1);
}
html:not(.dark) body:has(> .wrapper) .logo-text {
  color: #1d4ed8;
}
html:not(.dark) body:has(> .wrapper) .logo-text span {
  color: #946800;
}
html:not(.dark) body:has(> .wrapper) .brand-tagline,
html:not(.dark) body:has(> .wrapper) .auth-note {
  color: #475569;
}
html:not(.dark) body:has(> .wrapper) .btn-primary,
html:not(.dark) body:has(.nav-inner) .btn-primary,
html:not(.dark) .aya-support-surface .support-btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #0369a1);
  color: #ffffff;
}
html:not(.dark) body:has(> .wrapper) .field input:focus {
  background: #ffffff;
}
html:not(.dark) body:has(> .wrapper) .field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px #ffffff inset !important;
  -webkit-text-fill-color: #0f172a !important;
}
body:has(> .wrapper) .field :is(input, select),
body:has(.nav-inner) :is(input:not([type="checkbox"]), select, textarea),
.support-input,
#recharge-page :is(input:not([type="hidden"]), select),
#data-page :is(input:not([type="hidden"]), select) {
  font-size: 16px;
}
/* Reset/verification forms use different wrappers from login/register. */
body.aya-auth-document :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea),
.aya-support-surface .support-input,
body:has(#main-header) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]), select, textarea):not(#calculator *) {
  font-size: 16px !important;
}
/* Auth gates can also mount a login card inside the shared document. */
body input:is([type="email"], [type="password"]) {
  font-size: 16px !important;
}
body:has(.wrapper) .website-language-controls {
  max-width: 100%;
  align-items: center;
  gap: 6px;
  margin: 12px auto 16px;
}
body:has(.wrapper) .website-language-controls .control-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 380px) {
  body:has(.wrapper) {
    padding-left: 12px;
    padding-right: 12px;
  }
  body:has(.wrapper) .card {
    padding-left: 18px;
    padding-right: 18px;
  }
  body:has(.wrapper) .field-row {
    flex-wrap: wrap;
    gap: 7px;
  }
  body:has(.wrapper) .field-row label {
    min-width: 0;
  }
  body:has(.wrapper) .field input,
  body:has(.wrapper) .field select {
    min-width: 0;
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  body:has(.wrapper) *,
  body:has(.wrapper) *::before,
  body:has(.wrapper) *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Account is a standalone responsive shell. Keep nav actions and profile data
   from forcing the viewport wider when names or translations are long. */
body:has(.nav-inner) .nav {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
body:has(.nav-inner) .nav-inner,
body:has(.nav-inner) .nav-actions {
  min-width: 0;
}
body:has(.nav-inner) .nav-actions {
  gap: 4px;
  flex-wrap: wrap;
}
body:has(.nav-inner) .nav-inner {
  height: auto;
  min-height: 64px;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 8px;
}
body:has(.nav-inner) .website-language-controls .control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}
html:not(.dark) body:has(.nav-inner) .nav {
  background: rgba(255, 255, 255, .96);
  border-color: #dce4f1;
}
html:not(.dark) body:has(.nav-inner) .nav-brand {
  color: #1d4ed8;
}
html:not(.dark) body:has(.nav-inner) .logo-text {
  color: #1d4ed8;
}
html:not(.dark) body:has(.nav-inner) .nav-btn {
  color: #9f1239;
}
html:not(.dark) body:has(.nav-inner) .nav-link:hover,
html:not(.dark) body:has(.nav-inner) .nav-link.active {
  color: #1d4ed8;
  background: #eff6ff;
}
html:not(.dark) body:has(.nav-inner) .field select option {
  background: #ffffff;
  color: #0f172a;
}
body:has(.nav-inner) .nav-link {
  padding-inline: 8px;
}
body:has(.nav-inner) .page {
  width: 100%;
  min-width: 0;
}
body:has(.nav-inner) .profile-info,
body:has(.nav-inner) .profile-email {
  min-width: 0;
  overflow-wrap: anywhere;
}
body:has(.nav-inner) .profile-header {
  align-items: flex-start;
}
body:has(.nav-inner) .verify-banner,
body:has(.nav-inner) .verify-banner-inner {
  min-width: 0;
}
body:has(.nav-inner) .verify-banner .btn {
  white-space: normal;
}
@media (max-width: 420px) {
  body:has(.nav-inner) .nav-actions {
    gap: 2px;
  }
  body:has(.nav-inner) .nav-link,
  body:has(.nav-inner) .nav-btn {
    font-size: 12px;
    padding: 7px 8px;
  }
}

/* Transaction rows preserve all details, while allowing long translated names
   and status labels to wrap instead of pushing the amount beyond the card. */
.txh-wrap,
.txh-search,
.tx-card,
.tx-card-inner,
.tx-content {
  min-width: 0;
}
.tx-card-inner {
  gap: clamp(8px, 3vw, 14px);
}
.tx-right {
  max-width: 42%;
}
.tx-badge {
  max-width: 100%;
  white-space: normal;
  text-align: right;
  overflow-wrap: anywhere;
}
.tx-amount {
  overflow-wrap: anywhere;
}
.txh-tabs {
  overscroll-behavior-inline: contain;
}
@media (max-width: 360px) {
  .tx-card-inner {
    padding: 12px;
  }
  .tx-avatar {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }
  .tx-name {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .tx-right {
    max-width: 38%;
  }
}

/* Support form controls and ticket references can contain long translated
   copy, addresses, and identifiers. Permit wrapping without hiding content. */
.support-card,
.support-contact-strip,
.support-faq-card,
.support-message,
.support-contact-btn {
  min-width: 0;
  overflow-wrap: anywhere;
}
.support-input {
  min-width: 0;
  max-width: 100%;
}
html:not(.dark) .aya-support-surface {
  --aya-bg-primary: #f6f8fc;
  --sup-bg-card: #ffffff;
  --sup-border: #dce4f1;
  --sup-input-bg: #ffffff;
  color: #0f172a;
}
html:not(.dark) .aya-support-surface :is(.support-label, .support-faq-q, .support-message) {
  color: #0f172a;
}
html:not(.dark) .aya-support-surface .support-card :is(h2, .text-white),
html:not(.dark) .aya-support-surface .support-contact-btn {
  color: #0f172a;
}
html:not(.dark) .aya-support-surface :is(.support-faq-a-inner, .text-gray-400, .text-gray-500) {
  color: #475569;
}
html:not(.dark) .aya-support-surface .support-input {
  font-size: 16px;
  color: #0f172a;
  border-color: #bdcadf;
}
html:not(.dark) .aya-support-surface .support-input::placeholder {
  color: #64748b;
}
html:not(.dark) .aya-support-surface .support-input:-webkit-autofill {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
}
body:has(.page-wrap) .doc-card {
  border: 1px solid #dce4f1;
  border-radius: 20px;
}
body:has(.page-wrap) .brand-name {
  color: #1d4ed8;
}
.gc-info .gc-info__hero h1,
.gc-info .gc-info__section h2,
.gc-info .gc-info__support h2 {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (max-width: 420px) {
  .support-card form.flex.gap-3 {
    flex-wrap: wrap;
  }
  .support-card form.flex.gap-3 .support-input {
    flex-basis: 100%;
  }
  .support-card form.flex.gap-3 button {
    min-height: 42px;
  }
  .support-faq-q {
    align-items: flex-start;
  }
}

/* Safe keyboard focus and wrapping for order status and error panels. */
.order-track,
.order-card,
[role="alert"],
[role="status"] {
  min-width: 0;
  overflow-wrap: anywhere;
}
#tx-ref,
#tx-product,
#tx-recipient,
#tx-amount,
#tx-country,
#status-badge {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#steps-row > * {
  min-width: 0;
}
#events-list > * {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 520px) {
  body:has(#tx-ref) > header {
    padding-left: 14px;
    padding-right: 14px;
  }
  body:has(#tx-ref) > header > a:last-child {
    max-width: 44%;
    text-align: right;
    overflow-wrap: anywhere;
  }
  body:has(#tx-ref) .max-w-lg.mx-auto.px-4.py-10 {
    padding-top: 24px;
  }
  body:has(#tx-ref) .card {
    padding: 18px;
  }
  body:has(#tx-ref) #content .grid.grid-cols-2 {
    column-gap: 14px;
    row-gap: 18px;
  }
}
@media (max-width: 520px) {
  .order-track,
  .order-card {
    max-width: 100%;
  }
}
