@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/input/input.css';
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/select/select.css';
@layer cinder.components {
  /* ========================================
 * PHONE INPUT
 * ======================================== */

  .cinder-phone-input-field {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-1-5);
    inline-size: 100%;
  }

  .cinder-phone-input-field__label {
    display: inline-flex;
    align-items: center;
    gap: var(--cinder-space-1);
    font-size: var(--cinder-text-xs);
    font-weight: var(--cinder-font-medium);
    line-height: 1;
    color: var(--cinder-text-default);
  }

  .cinder-phone-input-field__label[data-disabled] {
    color: var(--cinder-text-disabled);
    cursor: not-allowed;
  }

  /* One field: the country control as wide as its closed text, the number in the rest of the
     line, joined at a single shared border. The country part stays small, so a narrow container
     keeps both on one line instead of stacking them. */
  .cinder-phone-input {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
  }

  /* The visible summary ("US +1") sizes the country control. The native select shares its grid
     cell and fills it, but contributes no width of its own (an inline size of 0 and a percentage
     minimum), so its longest option ("United Arab Emirates +971") never widens the field. The
     open list is the platform's own: full country names, as wide as they need, with type-ahead
     by country name. */
  /* The country Select is half of one drawn field, so it keeps the number input's height on a
     coarse pointer instead of the smaller painted height a Select has on its own. */
  .cinder-phone-input__country {
    --_cinder-painted-height-md: var(--cinder-control-height-md);
    --_cinder-painted-height-lg: var(--cinder-control-height-lg);

    display: grid;
    min-inline-size: 0;
  }

  .cinder-phone-input__country .cinder-select-field {
    grid-area: 1 / 1;
    inline-size: 0;
    min-inline-size: 100%;
  }

  .cinder-phone-input__country .cinder-select {
    color: transparent;
  }

  .cinder-phone-input__country
    .cinder-select:where(
      :not([dir='rtl'], [dir='rtl'] *),
      [dir='rtl'] [dir='ltr'],
      [dir='rtl'] [dir='ltr'] *
    ) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .cinder-phone-input__country
    .cinder-select:where(
      :is([dir='rtl'], [dir='rtl'] *):not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
    ) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .cinder-phone-input__country .cinder-select option {
    color: var(--cinder-text-default);
  }

  /* The summary's end padding clears the shared field chevron (12px in, 18px wide) with a 6px gap. */
  .cinder-phone-input__country-summary {
    grid-area: 1 / 1;
    align-self: center;
    z-index: 1;
    padding-inline: var(--cinder-space-3)
      calc(var(--cinder-space-3) + 1.125rem + var(--cinder-space-1-5));
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-sm);
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
  }

  /* The number input's start border lies on the select's end border, so the seam is one line. */
  .cinder-phone-input > .cinder-input-field {
    /* Stretched to its cell, so the negative margin widens it rather than pulling it short. */
    inline-size: auto;
    min-inline-size: 0;
    margin-inline-start: -1px;
  }

  .cinder-phone-input
    .cinder-phone-input__national:where(
      :not([dir='rtl'], [dir='rtl'] *),
      [dir='rtl'] [dir='ltr'],
      [dir='rtl'] [dir='ltr'] *
    ) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .cinder-phone-input
    .cinder-phone-input__national:where(
      :is([dir='rtl'], [dir='rtl'] *):not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
    ) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  /* Whichever half has focus draws its ring over the shared border. */
  .cinder-phone-input__country:focus-within,
  .cinder-phone-input > .cinder-input-field:focus-within {
    z-index: 2;
  }

  .cinder-phone-input__country[data-disabled] .cinder-phone-input__country-summary {
    color: var(--cinder-text-disabled);
  }

  .cinder-phone-input__country[data-disabled] .cinder-select:disabled {
    color: transparent;
  }

  @media (forced-colors: active) {
    .cinder-phone-input__country .cinder-select {
      text-indent: -9999px;
    }

    .cinder-phone-input__country .cinder-select option {
      text-indent: 0;
    }
  }

  .cinder-phone-input-field__description {
    margin: 0;
    font-size: var(--cinder-text-xs);
    color: var(--cinder-text-muted);
  }

  .cinder-phone-input-field__error {
    margin: 0;
    font-size: var(--cinder-text-xs);
    color: var(--cinder-status-danger-text);
  }
}
