/*
 * Velocity Talent — dialling-code picker + national number.
 *
 * Markup:    resources/views/partials/phone-country-row.blade.php
 * Behaviour: public/js/vt-phone-field.js
 *
 * EXTRACTED 17/09/2026 from velocity-talent-auth.css, which is loaded only by
 * the four auth screens. The picker is now also on the seeker and employer
 * PROFILE screens, and those load a different stylesheet — so the rules had to
 * either move here or be copied, and a copy would drift the first time the
 * join or the RTL flip was touched.
 *
 * The number input is addressed as `.vt-phone__input`, not `.vt-auth__input`:
 * the row has to sit inside three different field wrappers (.vt-auth__field on
 * the auth pages, .vt-field on the seeker profile, .vt-exp-field on the
 * employer profile) and must not assume any of them. The blade puts
 * `vt-phone__input` on the input alongside whichever base class the host page
 * uses for its own borders and background.
 *
 * Everything is in logical properties, so the row flips with page direction
 * without an RTL counterpart — see the join block near the bottom.
 */

/* ───────────────────────────────────────────────────────────────────────────
   Phone field: dialling-code picker + national number
   Markup: resources/views/partials/phone-country-field.blade.php
   The <select> is the real form control; public/js/vt-phone-field.js swaps it
   for the trigger/panel below and marks the row .is-enhanced. Everything here
   degrades to a styled native select when that script does not run.
   ─────────────────────────────────────────────────────────────────────────── */
/* The row inherits the PAGE direction (the blade no longer pins it to ltr), so
   the code box is the first box in reading order: on the LEFT in English and on
   the RIGHT in Arabic. Everything below is expressed in logical properties so
   the join flips with it and needs no RTL counterpart. */
.vt-phone {
  display: flex;
  align-items: flex-start;
  gap: 0;                /* ملتصقات — the two boxes read as one control */
}
.vt-phone__code {
  position: relative;
  flex: 0 0 auto;
  /* Wide enough for the unselected "Country code" placeholder, which is the
     longest thing the trigger ever shows — once a country is picked it drops
     to a flag plus "+971" or shorter. */
  width: 142px;
}
.vt-phone__num {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;          /* so a long number shrinks instead of pushing the code out */
  display: flex;
  align-items: center;
  /* Pull the number box onto the code box so the two 1px borders collapse into
     one seam instead of stacking into a 2px rule. */
  margin-inline-start: -1px;
}

/* Whichever box has focus owns the seam, so its highlight is not sliced in
   half by the neighbour's border painting over it. */
.vt-phone__num .vt-phone__input:focus,
.vt-phone__trigger:focus-visible,
.vt-phone.is-open .vt-phone__trigger { position: relative; z-index: 1; }

/* dir="ltr" on the row flips the box order but not these three, which is what
   put the icon on the right and the digits right-aligned on the Arabic page:
   text-align is inherited from the RTL body regardless of dir, and the shared
   [dir="rtl"] .vt-phone__input padding rule still matches through <html>. Pin
   all of it to physical left/right here — a phone number is LTR content.
   These selectors outrank [dir="rtl"] .vt-phone__input on specificity order,
   so no !important is needed; keep them after that rule in the file. */
.vt-phone__num .vt-phone__input {
  padding: 0 16px 0 44px;
  text-align: left;
  direction: ltr;
}
/* The glyph inside the number box.
 *
 * This carries its OWN positioning rather than inheriting it. It used to be
 * marked up as `.vt-auth__input-icon`, whose `position:absolute` base rule
 * lives in velocity-talent-auth.css — a file only the auth screens load. When
 * the row moved to the profile screens the class was renamed to
 * `.vt-phone__icon` and the base rule stopped matching anywhere: the icon lost
 * its absolute positioning, fell back into the flex flow, and rendered as a
 * third box wedged BETWEEN the dialling code and the number.
 *
 * Keep every property this needs here. The moment it borrows from another
 * stylesheet, it breaks on whichever page does not load that stylesheet. */
.vt-phone__num .vt-phone__icon {
  position: absolute;
  /* Physical left, not inset-inline-start: the number box is pinned dir="ltr"
     (a phone number is LTR content on every locale), so the icon belongs at
     the visual left edge on the Arabic page too. */
  inset-inline-start: auto;
  left: 14px;
  right: auto;
  display: inline-flex;
  align-items: center;
  color: #8c909f;
  /* Clicks must reach the input underneath — the icon sits on top of it. */
  pointer-events: none;
  /* Above the input's own background, below the focus ring. */
  z-index: 2;
}
.vt-phone__num .vt-phone__icon .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}

/* Native fallback — same skin as .vt-phone__input, with a drawn caret. */
.vt-phone__select {
  width: 100%;
  height: 48px;
  background: rgba(11, 19, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 0 30px 0 12px;
  color: #f1f4ff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Renders the OS-drawn option list dark instead of white-on-white. */
  color-scheme: dark;
  background-image:
    linear-gradient(45deg, transparent 50%, #8c909f 50%),
    linear-gradient(135deg, #8c909f 50%, transparent 50%);
  background-position: calc(100% - 17px) 21px, calc(100% - 12px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}
.vt-phone__select:focus {
  border-color: #4d8eff;
  box-shadow: 0 0 0 3px rgba(77, 142, 255, 0.18);
}

/* Enhanced: the select stays in the DOM (it is what submits) but is taken out
   of sight and out of the tab order. */
.vt-phone.is-enhanced .vt-phone__select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.vt-phone__trigger {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(11, 19, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 0 10px 0 12px;
  color: #f1f4ff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.vt-phone__trigger:hover { background: rgba(11, 19, 38, 0.85); }
.vt-phone__trigger:focus-visible,
.vt-phone.is-open .vt-phone__trigger {
  outline: none;
  border-color: #4d8eff;
  box-shadow: 0 0 0 3px rgba(77, 142, 255, 0.18);
}
.vt-phone__trigger.is-empty { color: #6b7184; font-weight: 500; font-size: 13px; }
.vt-phone__trigger .material-symbols-outlined {
  font-size: 18px;
  color: #8c909f;
  flex: 0 0 auto;
  transition: transform 180ms ease;
}
.vt-phone.is-open .vt-phone__trigger .material-symbols-outlined { transform: rotate(180deg); }
.vt-phone__trigger-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* An ellipsis box clips to the LINE box, not the font box, so Arabic
     descenders (the tail of ة in "رمز الدولة") were being shaved off the
     bottom. Give the line room and stop cropping the glyph. */
  line-height: 1.75;
  padding-block: 1px;
}
/* Flag sits before the code in the trigger. Fixed box so the trigger does not
   jump between the placeholder state (no flag) and a picked country. */
.vt-phone__trigger-flag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}
.vt-phone__trigger-flag:empty { display: none; }

/* Flag images (public/css/flags/<iso>.svg — 4x3 artwork).
   Explicit width AND height: the SVGs carry their own aspect ratio, and without
   both the list reflows as each one decodes. The hairline border keeps flags
   that are white at the edge (eg. Lebanon) from dissolving into the panel. */
.vt-phone__flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
  display: block;
}

.vt-phone__panel {
  position: absolute;
  /* Above the fixed mobile bottom bar (40) and the sticky header (200); the
     script also moves the panel to <body> on open so this actually applies —
     see the stacking-context note in vt-phone-field.js. Physical left/right
     rather than inset-inline-start, because the script writes an inline
     `left` and a logical property would fight it on the RTL page. */
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  width: 290px;
  max-width: calc(100vw - 48px);
  background: #141c33;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vt-phone__panel[hidden] { display: none; }

.vt-phone__search {
  width: 100%;
  height: 36px;
  background: rgba(11, 19, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 0 10px;
  color: #f1f4ff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.vt-phone__search:focus { border-color: #4d8eff; }
.vt-phone__search::placeholder { color: #6b7184; }

.vt-phone__list {
  max-height: 232px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vt-phone__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 8px;
  /* Was 8px: the Arabic country names were losing their descenders to the
     bottom edge of the row. */
  padding: 11px 10px;
  color: #dae2fd;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.75;
  text-align: start;
  cursor: pointer;
}
.vt-phone__opt[hidden] { display: none; }
.vt-phone__opt:hover,
.vt-phone__opt.is-active { background: rgba(77, 142, 255, 0.16); color: #f1f4ff; }
.vt-phone__opt.is-selected { color: #fff; }
.vt-phone__opt-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Same descender-clipping fix as .vt-phone__trigger-code — overflow:hidden
     crops to the line box, so the line box has to be taller than the glyphs. */
  line-height: 1.75;
  padding-block: 1px;
}
.vt-phone__opt-code {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #8c909f;
  font-weight: 600;
}
.vt-phone__opt.is-selected .vt-phone__opt-code,
.vt-phone__opt.is-active .vt-phone__opt-code { color: #adc6ff; }

.vt-phone__empty {
  padding: 10px;
  font-size: 12px;
  color: #8c909f;
  text-align: center;
}
.vt-phone__empty[hidden] { display: none; }

/* ── The join (ملتصقات) ─────────────────────────────────────────────────────
   Round only the OUTER corners so the code box and the number box read as one
   control.

   Two things force this block to look the way it does:

   1. It must come AFTER .vt-phone__select / .vt-phone__trigger / .vt-phone__input
      above, whose `border-radius: 12px` shorthands would otherwise reset all
      four corners back — a shorthand later in the file beats longhands earlier
      in it regardless of how specific those longhands look.

   2. Physical corners scoped by page direction, NOT logical (start/end) radii.
      Logical properties resolve against the ELEMENT's own direction, and the
      number <input> carries dir="ltr" for its digits — so a logical rule
      rounded its right edge on the Arabic page, where that edge is the seam.

   LTR: [ code ][ number ]   RTL: [ number ][ code ]  — in both, the code box is
   the one in reading-start position, so the outer edge flips with the page. */
.vt-phone__select,
.vt-phone__trigger        { border-radius: 12px 0 0 12px; }
.vt-phone__num .vt-phone__input { border-radius: 0 12px 12px 0; }

/* Error state mirrors .vt-auth__field.has-error for the two custom controls. */
.vt-auth__field.has-error .vt-phone__select,
.vt-auth__field.has-error .vt-phone__trigger,
.vt-field.has-error .vt-phone__select,
.vt-field.has-error .vt-phone__trigger,
.vt-exp-field.has-error .vt-phone__select,
.vt-exp-field.has-error .vt-phone__trigger { border-color: rgba(255, 99, 99, 0.55); }

@media (max-width: 480px) {
  .vt-phone__code { width: 124px; }
  .vt-phone__panel { width: 250px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOST-PROOFING + RTL
   Added 17/09/2026, when the row moved onto the seeker and employer profile
   screens.

   Two problems this block exists to solve, both invisible until the control is
   dropped into a page it was not born in:

   1. THE HOST PAGE'S OWN INPUT STYLES WIN.
      The row borrows the host's input class for colours and borders
      (`form-control` on the seeker profile, `vt-exp-field__input` on the
      employer one, `vt-auth__input` on the auth screens). Those are single
      class selectors, and so were the rules above — so on the profile screens
      the host won: the joined corners reverted to a plain 8px radius and the
      44px padding that makes room for the icon dropped to 14px, putting the
      glyph on top of the digits.

   2. THE RTL MIRRORING LIVED IN AN AUTH-ONLY STYLESHEET.
      velocity-talent-auth-rtl.css is not loaded by the profile screens, so the
      code box kept LTR corner rounding while sitting on the right, and the
      digits were right-aligned.

   Both are fixed by specificity rather than by load order or !important:
   `.vt-phone .vt-phone__num .vt-phone__input` is three classes and beats any
   single-class host rule AND the generic `[dir="rtl"] .vt-auth__input`,
   wherever those files happen to sit in the <link> order.

   Do not "simplify" these back to two classes. That is the bug.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ---- The number box: LTR content, room for the icon, joined corner ------- */
.vt-phone .vt-phone__num .vt-phone__input,
[dir="rtl"] .vt-phone .vt-phone__num .vt-phone__input {
  direction: ltr;
  text-align: left;
  padding-left: 44px;
  padding-right: 16px;
}

/* ---- The icon: always at the visual left of the number box --------------- */
.vt-phone .vt-phone__num .vt-phone__icon,
[dir="rtl"] .vt-phone .vt-phone__num .vt-phone__icon {
  inset-inline-start: auto;
  left: 14px;
  right: auto;
}

/* ---- The join (ملتصقات) -------------------------------------------------
   LTR: [ code ][ number ]   RTL: [ number ][ code ]
   In both, the code box is the one in reading-start position, so the outer
   rounded edge flips with the page. Physical corners, not logical ones — see
   the long note on the base rules earlier in this file. */
.vt-phone .vt-phone__select,
.vt-phone .vt-phone__trigger          { border-radius: 12px 0 0 12px; }
.vt-phone .vt-phone__num .vt-phone__input { border-radius: 0 12px 12px 0; }

[dir="rtl"] .vt-phone .vt-phone__select,
[dir="rtl"] .vt-phone .vt-phone__trigger  { border-radius: 0 12px 12px 0; }
[dir="rtl"] .vt-phone .vt-phone__num .vt-phone__input { border-radius: 12px 0 0 12px; }

/* ---- The search panel ---------------------------------------------------
   Only the two BOXES are LTR. The panel is prose — Arabic country names and an
   Arabic search placeholder — so it reads RTL, with the dialling code pinned
   back to LTR because "+962" is LTR content wherever it appears. */
[dir="rtl"] .vt-phone .vt-phone__panel {
  left: 0;
  right: auto;
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .vt-phone .vt-phone__opt-code { direction: ltr; }

/* ---- Height parity ------------------------------------------------------
   The two boxes must be the same height or the join shows a step. The code box
   is fixed at 48px above; the host's input may not be, so pin it here too. */
.vt-phone .vt-phone__num .vt-phone__input { height: 48px; }
