/* ==========================================================================
   הכלים: ממיר הדירהם לשקל ומחשבון התשואה
   נטען רק בתבניות page-tool-aed-ils.php ו-page-tool-yield.php.
   הצבעים, הרדיוס והקווים הם המשתנים של main.css, כדי שהכלים ייראו כחלק
   מאותה מערכת ולא כווידג'ט שהודבק מבחוץ.
   ========================================================================== */

.ne-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fx-tool button:focus-visible,
.fx-tool input:focus-visible,
.fx-tool select:focus-visible,
.yield-tool input:focus-visible,
.yield-tool select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- הכותרת העליונה של הממיר: כותרת מימין, כלי משמאל ---------- */

.page-hero--tool {
  min-height: 0;
}

.page-hero--tool .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  /* הגובה העודף של הכלי נבלע בשורה האחרונה, כדי שפסקת הפתיחה תישאר
     צמודה לכותרת ולא תיפול לתחתית הכותרת העליונה. */
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(32px, 4vw, 64px);
  align-items: start;
}

.page-hero--tool .container > * {
  grid-column: 1;
}

.page-hero--tool .container > .fx-tool {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.page-hero--tool h1 {
  font-size: clamp(34px, 4vw, 58px);
}

/* ---------- כרטיס הממיר ---------- */

.fx-tool {
  padding: 22px;
  color: var(--text);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.fx-tool__form {
  display: grid;
  gap: 0;
  margin: 0;
}

.fx-tool__box {
  padding: 12px 14px 14px;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  background: #fbfcfc;
  transition: border-color 160ms ease, background 160ms ease;
}

.fx-tool__box:focus-within {
  border-color: var(--blue);
  background: var(--white);
}

.fx-tool__box--result {
  background: var(--light-blue);
  border-color: transparent;
}

.fx-tool__label {
  display: block;
  margin-bottom: 4px;
  color: #44515a;
  font-size: 12px;
  font-weight: 600;
}

.fx-tool__line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fx-tool__amount,
.fx-tool__result {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--navy);
  font-family: inherit;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: right;
}

.fx-tool__amount {
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
}

.fx-tool__amount:focus,
.fx-tool__amount:focus-visible {
  outline: none;
}

.fx-tool__result {
  display: block;
  overflow: hidden;
  padding: 2px 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fx-tool__currency {
  flex: none;
  min-height: 40px;
  padding: 0 10px;
  color: var(--navy);
  border: 1px solid #cbd2d6;
  border-radius: 4px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.fx-tool__swap {
  display: grid;
  width: 40px;
  height: 40px;
  margin: -8px auto;
  place-items: center;
  position: relative;
  z-index: 1;
  color: var(--white);
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  transition: background 160ms ease, transform 200ms ease;
}

.fx-tool__swap:hover {
  background: var(--blue-dark);
  transform: rotate(180deg);
}

.fx-tool__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.fx-tool__chip {
  min-height: 34px;
  padding: 0 11px;
  color: var(--navy);
  border: 1px solid var(--gray-2);
  border-radius: 999px;
  background: var(--white);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.fx-tool__chip:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.fx-tool__rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.fx-tool__rates div {
  min-width: 0;
}

.fx-tool__rates dt {
  color: var(--gray-3);
  font-size: 11.5px;
}

.fx-tool__rates dd {
  margin: 1px 0 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}

.fx-tool__source {
  margin: 12px 0 0;
  color: var(--gray-3);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- עמוד המחשבון ---------- */

.page-hero--compact {
  min-height: 0;
  padding-bottom: 56px;
}

.tool-band {
  padding: 48px 0 72px;
  background: var(--paper);
}

.tool-band__title {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.yield-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 32px;
  align-items: start;
}

.yield-tool__form {
  margin: 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.yield-tool__example {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 12px 14px;
  color: #33424d;
  border-radius: 4px;
  background: var(--light-blue);
  font-size: 14px;
  line-height: 1.55;
}

.yield-tool__example svg {
  flex: none;
  margin-top: 2px;
  color: var(--blue);
}

.calc-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  min-width: 0;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.calc-group legend {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 20px 0 0;
  color: var(--navy);
  border-top: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}

.calc-fixed,
.calc-switch,
.calc-pair,
.calc-toggle,
.calc-group > .calc-field__hint {
  grid-column: 1 / -1;
}

.calc-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.calc-pair--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calc-pair--three > .calc-field__hint {
  grid-column: 1 / -1;
  margin-top: -4px;
}

.calc-field {
  min-width: 0;
}

.calc-field__label {
  display: block;
  margin-bottom: 6px;
  color: #44515a;
  font-size: 13px;
  font-weight: 600;
}

.calc-field__control {
  position: relative;
}

.calc-field__control input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px 0 64px;
  color: var(--navy);
  border: 1px solid #cbd2d6;
  border-radius: 4px;
  background: #fbfcfc;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  transition: border-color 160ms ease, background 160ms ease;
}

.calc-field__control input:hover {
  border-color: #9fb3c1;
  background: var(--white);
}

.calc-field__control input:focus {
  border-color: var(--blue);
  background: var(--white);
}

/* היחידה יושבת בקצה השמאלי של השדה, מול המספר שמיושר לימין. */
.calc-field__unit {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--gray-3);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
  transform: translateY(-50%);
}

.calc-field__hint {
  margin: 6px 0 0;
  color: var(--gray-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.calc-fixed {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  color: #33424d;
  border-radius: 4px;
  background: var(--paper);
  font-size: 14px;
}

.calc-fixed output {
  color: var(--navy);
  font-weight: 700;
}

.calc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
}

.calc-switch label,
.calc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #33424d;
  font-size: 14px;
  cursor: pointer;
}

.calc-switch input,
.calc-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

/* ---------- התוצאה ---------- */

.yield-tool__sticky {
  position: sticky;
  top: 104px;
  padding: 24px;
  color: var(--white);
  border-radius: var(--radius);
  background: var(--navy);
}

.yield-tool__results-title {
  margin: 0 0 8px;
  color: #b9cddd;
  font-size: 13px;
  font-weight: 700;
}

.yield-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.yield-results > div {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.yield-results > .yield-results__main {
  display: block;
  grid-column: auto;
  padding: 4px 0 16px;
}

.yield-results dt {
  color: #b3c0c9;
  font-size: 14px;
}

.yield-results dd {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.yield-results__main dd {
  margin-top: 2px;
  font-size: clamp(30px, 3vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.yield-results__main:first-child dd {
  color: #9fd4b9;
}

.yield-tool__ils,
.yield-tool__source,
.yield-tool__disclaimer {
  margin: 14px 0 0;
  color: #b3c0c9;
  font-size: 13px;
  line-height: 1.55;
}

.yield-tool__source {
  margin-top: 6px;
  font-size: 12px;
}

.yield-tool__disclaimer {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---------- איך חישבנו ---------- */

.yield-how {
  margin-top: 24px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.yield-how h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 20px;
  font-weight: 700;
}

.yield-how__list {
  margin: 0;
  padding-inline-start: 22px;
  color: #33424d;
  font-size: 15px;
  line-height: 1.7;
}

.yield-how__list li + li {
  margin-top: 6px;
}

.yield-how__list b {
  color: var(--navy);
}

.tool-table td,
.tool-table th {
  font-variant-numeric: tabular-nums;
}

/* ---------- מסכים צרים ---------- */

@media (max-width: 960px) {
  .page-hero--tool .container {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  /* בנייד הכלי עולה מיד אחרי הכותרת, לפני פסקת הפתיחה: הוא הסיבה
     שבגללה הגיעו לעמוד, והוא צריך להיות בתוך המסך הראשון. */
  .page-hero--tool .container > * {
    grid-column: 1;
    grid-row: auto;
  }

  .page-hero--tool .breadcrumbs {
    order: 0;
  }

  .page-hero--tool h1 {
    order: 1;
  }

  .page-hero--tool .container > .fx-tool {
    grid-column: 1;
    grid-row: auto;
    order: 2;
    margin-top: 22px;
  }

  .page-hero--tool .page-hero__lead {
    order: 3;
  }

  .yield-tool {
    grid-template-columns: minmax(0, 1fr);
  }

  .yield-tool__sticky {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-hero--tool {
    padding-bottom: 40px;
  }

  .page-hero--tool .breadcrumbs ol {
    margin-bottom: 16px;
  }

  .page-hero--tool h1 {
    font-size: clamp(30px, 8vw, 40px);
  }

  .fx-tool {
    padding: 16px;
  }

  .fx-tool__amount,
  .fx-tool__result {
    font-size: 24px;
  }

  .fx-tool__currency {
    font-size: 16px;
    padding: 0 6px;
  }

  .tool-band {
    padding: 32px 0 48px;
  }

  .yield-tool__form {
    padding: 20px 16px;
  }

  .calc-group,
  .calc-pair,
  .calc-pair--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .yield-how {
    padding: 20px 16px;
  }
}

/* ---------- FIX-FRONT: יעדי מגע ויחידת המטבע בשדות ---------- */

/* היחידה (AED, %) מופרדת מהמספר בקו דק ובמרווח, במקום לשבת צמודה אליו
   באותו גוון אפור. */
.calc-field__control input {
  padding-left: 78px;
}

.calc-field__unit {
  padding-right: 10px;
  border-right: 1px solid #dfe4e7;
  color: #5d6a72;
  line-height: 22px;
}

/* במסך מגע כל פקד מקבל לפחות 44px: הסכומים המהירים, בחירת המטבע, שדה
   הסכום, כפתור ההחלפה ותיבות הסימון של המחשבון. */
@media (pointer: coarse), (max-width: 720px) {
  .fx-tool__chip {
    min-height: 44px;
    padding: 0 14px;
  }

  .fx-tool__currency,
  .fx-tool__amount {
    min-height: 44px;
  }

  .fx-tool__swap {
    width: 44px;
    height: 44px;
    margin: -10px auto;
  }

  .calc-switch label,
  .calc-toggle {
    min-height: 44px;
  }

  .calc-switch input,
  .calc-toggle input {
    width: 22px;
    height: 22px;
  }
}

/* ---------- סוף FIX-FRONT ---------- */
