/* HOUSBE phone field (js/housbe-phone.js): a country button, a divider and the number
   box inside one bordered box, with a searchable country list that drops below it.

   Colours are the contact form's: field #071322, gold border #E5B778, focus #F5D88C,
   text #FFF3DF, muted #929DAF, error #FF6B6B.

   Everything is scoped under .housbe-phone because css/styles.css restyles every
   `form input[type=...]` at specificity (0,1,2) (padding, 16px radius, white text,
   weight 200, height 54px); the (0,2,0)+ selectors below win over it. */

.housbe-phone,
.housbe-phone * {
    box-sizing: border-box;
}

.housbe-phone {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 50px;
    border: 1px solid #E5B778;
    border-radius: 12px;
    background: #071322;
    color: #FFF3DF;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(229, 183, 120, 0.08);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* The box is one control: it takes the focus ring, not the input inside it. */
.housbe-phone:focus-within {
    outline: 2px solid #F5D88C;
    outline-offset: 2px;
    border-color: #F5D88C;
    box-shadow: 0 0 18px rgba(245, 216, 140, 0.24);
}

.housbe-phone.has-error,
.housbe-phone.has-error:focus-within {
    border-color: #FF6B6B;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.2);
}

.housbe-phone .housbe-phone__country {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 48px;
    margin: 0;
    padding: 0 10px 0 14px;
    border: 0;
    border-radius: 11px 0 0 11px;
    background: transparent;
    color: #FFF3DF;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
}

.housbe-phone .housbe-phone__country:hover {
    background: rgba(229, 183, 120, 0.08);
}

.housbe-phone .housbe-phone__country:focus-visible {
    outline: 2px solid #FFF3DF;
    outline-offset: -4px;
}

.housbe-phone__chevron {
    width: 14px;
    height: 14px;
    color: #929DAF;
    transition: transform 150ms ease;
}

.housbe-phone .housbe-phone__country[aria-expanded="true"] .housbe-phone__chevron {
    transform: rotate(180deg);
}

.housbe-phone__divider {
    flex: 0 0 1px;
    width: 1px;
    margin: 10px 0;
    background: rgba(229, 183, 120, 0.4);
}

.housbe-phone .housbe-phone__input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 14px 16px 14px 12px;
    border: 0;
    border-radius: 0 11px 11px 0;
    background: transparent;
    box-shadow: none;
    color: #FFF3DF;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    outline: none;
    overflow: visible;
}

.housbe-phone .housbe-phone__input::placeholder {
    color: #929DAF;
    opacity: 1;
}

/* Flags are images from the flag-icons stylesheet (loaded by the script); the box keeps
   its width whether or not they arrive. */
.housbe-phone .housbe-phone__flag {
    display: inline-block;
    flex: 0 0 auto;
    width: 24px;
    height: 18px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.06);
    background-size: cover;
    background-position: 50%;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
    line-height: 1;
}

.housbe-phone .housbe-phone__flag::before {
    content: none;
}

/* ---- the country list ---- */

.housbe-phone .housbe-phone__panel {
    position: absolute;
    /* measured from inside the box's 1px border, hence the -1px / +9px */
    top: calc(100% + 9px);
    left: -1px;
    right: -1px;
    z-index: 20;
    overflow: hidden;
    border: 1px solid #E5B778;
    border-radius: 12px;
    background: #071322;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.housbe-phone .housbe-phone__panel[hidden] {
    display: none;
}

.housbe-phone .housbe-phone__search-wrap {
    padding: 10px;
    border-bottom: 1px solid rgba(229, 183, 120, 0.25);
}

.housbe-phone .housbe-phone__search {
    display: block;
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid rgba(229, 183, 120, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
    color: #FFF3DF;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    outline: none;
}

.housbe-phone .housbe-phone__search::placeholder {
    color: #929DAF;
    opacity: 1;
}

.housbe-phone .housbe-phone__search:focus {
    border-color: #F5D88C;
    box-shadow: 0 0 12px rgba(245, 216, 140, 0.2);
}

.housbe-phone .housbe-phone__list {
    display: flex;
    flex-direction: column;
    max-height: min(260px, 40vh);
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 183, 120, 0.55) transparent;
}

.housbe-phone .housbe-phone__option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    color: #FFF3DF;
    font-size: 15px;
    line-height: 1.3;
    cursor: pointer;
}

.housbe-phone .housbe-phone__option[hidden] {
    display: none;
}

.housbe-phone .housbe-phone__option.is-active {
    background: rgba(229, 183, 120, 0.16);
}

.housbe-phone .housbe-phone__option[aria-selected="true"] .housbe-phone__option-name {
    color: #F3D39A;
    font-weight: 600;
}

.housbe-phone .housbe-phone__option-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.housbe-phone .housbe-phone__option-code {
    flex: 0 0 auto;
    color: #929DAF;
    font-variant-numeric: tabular-nums;
}

.housbe-phone .housbe-phone__empty {
    margin: 0;
    padding: 16px 14px;
    color: #929DAF;
    font-size: 14px;
    text-align: center;
}

/* The script did not load: just the number box, as a plain optional field. */
.housbe-phone.housbe-phone--plain .housbe-phone__country,
.housbe-phone.housbe-phone--plain .housbe-phone__divider,
.housbe-phone.housbe-phone--plain .housbe-phone__panel {
    display: none;
}

.housbe-phone.housbe-phone--plain .housbe-phone__input {
    padding-left: 16px;
    border-radius: 11px;
}

/* ---- autofill ----
   Chrome paints autofilled fields with a pale background an author rule cannot beat,
   and css/styles.css adds a grey inset on top. The box is already #071322, so the
   input is repainted as the same colour, which hides both (same technique as the
   contact form's fields in team.php). :autofill is its own block because one unknown
   selector invalidates a whole list. */
.housbe-phone .housbe-phone__input:-webkit-autofill,
.housbe-phone .housbe-phone__input:-webkit-autofill:hover,
.housbe-phone .housbe-phone__input:-webkit-autofill:focus,
.housbe-phone .housbe-phone__input:-webkit-autofill:active {
    -webkit-box-shadow: inset 0 0 0 999px #071322 !important;
    box-shadow: inset 0 0 0 999px #071322 !important;
    -webkit-text-fill-color: #FFF3DF !important;
    color: #FFF3DF !important;
    caret-color: #FFF3DF !important;
    filter: none !important;
    background-color: transparent !important;
    background-image: none !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s !important;
}

.housbe-phone .housbe-phone__input:autofill,
.housbe-phone .housbe-phone__input:autofill:hover,
.housbe-phone .housbe-phone__input:autofill:focus,
.housbe-phone .housbe-phone__input:autofill:active {
    -webkit-box-shadow: inset 0 0 0 999px #071322 !important;
    box-shadow: inset 0 0 0 999px #071322 !important;
    -webkit-text-fill-color: #FFF3DF !important;
    color: #FFF3DF !important;
    caret-color: #FFF3DF !important;
    filter: none !important;
    background-color: transparent !important;
    background-image: none !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s !important;
}

@media (prefers-reduced-motion: reduce) {
    .housbe-phone,
    .housbe-phone__chevron {
        transition: none;
    }
}
