/* Anti-flash guard */
html.j50-vat-pending #wpmem_register_form #vat_number,
html.j50-vat-pending #wpmem_register_form .j50-vat-combo {
    opacity: 0;
}

html.j50-vat-ready #wpmem_register_form .j50-vat-combo {
    opacity: 1;
}

/* Job50 VAT Registration */

#wpmem_register_form .div_text.j50-vat-enhanced {
    position: relative;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo {
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    overflow: visible;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .03);
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-wrap {
    position: relative;
    flex: 0 0 100px;
    min-width: 100px;
    max-width: 100px;
    height: 100%;
    padding: 14px 0;
    border-right: 1px solid #ececec;
    cursor: pointer;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-input-wrap {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}

#wpmem_register_form .div_text.j50-vat-enhanced #vat_number {
    width: 100%;
    height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 6px 6px 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    line-height: normal !important;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country {
    width: 100%;
    height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 6px 0 0 6px !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 30px 0 14px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    line-height: normal !important;
    cursor: pointer;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #8f8f8f;
    border-bottom: 2px solid #8f8f8f;
    transform: translateY(-58%) rotate(45deg);
    pointer-events: none;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-wrap.has-tomselect::after {
    display: none;
}

/* Tom Select integration */
#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect {
    width: 100%;
    min-width: 0;
    height: 100%;
    cursor: pointer;
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control {
    user-select: none;
    display: flex;
    align-items: center;
    min-height: 0;
    height: 100%;
    padding: 0 30px 0 0;
    border: 0 !important;
    border-radius: 6px 0 0 6px !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.single .ts-control::after {
    display: none !important;
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #8f8f8f;
    border-bottom: 2px solid #8f8f8f;
    transform: translateY(-58%) rotate(45deg);
    pointer-events: none;
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.focus::after,
#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.dropdown-active::after {
    transform: translateY(-20%) rotate(-135deg);
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control > *,
#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .item,
#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .j50-vat-country-option {
    pointer-events: none;
}

#wpmem_register_form .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control .item {
    display: flex;
    align-items: center;
    height: 100%;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-flag,
.ts-dropdown .j50-vat-country-flag {
    width: 18px;
    min-width: 18px;
    text-align: center;
    font-size: 15px;
    line-height: 1;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-code,
.ts-dropdown .j50-vat-country-code {
    font-family: var(--wp--preset--font-family--google-sans-flex, inherit);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2a2a2a;
}

.ts-dropdown.j50-vat-country-dropdown {
    width: 80px !important;
    min-width: 80px !important;
    overflow: hidden;
}

.ts-dropdown.j50-vat-country-dropdown .option {
    padding: 7px 12px;
}

.ts-dropdown.j50-vat-country-dropdown .option.active,
.ts-dropdown.j50-vat-country-dropdown .option:hover {
    background: var(--job50-dropdown-active-bg, var(--wp--preset--color--accent-1, #ed1c24));
    color: var(--job50-dropdown-active-color, #ffffff) !important;
}

.ts-dropdown.j50-vat-country-dropdown .option.active .j50-vat-country-code,
.ts-dropdown.j50-vat-country-dropdown .option:hover .j50-vat-country-code {
    color: inherit;
}

#wpmem_register_form .j50-vat-status {
    min-height: 1.35em;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.35;
    color: #666666;
}

#wpmem_register_form .j50-vat-status small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.95;
    white-space: pre-line;
}

#wpmem_register_form .j50-vat-status.is-valid {
    color: #1d7a3e;
}

#wpmem_register_form .j50-vat-status.is-error {
    color: #b42318;
}

#wpmem_register_form .j50-vat-status.is-warning {
    color: #b85a00;
}

#wpmem_register_form .j50-vat-status.is-checking {
    color: #666666;
}

@media (max-width: 767.98px) {
    #wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-country-wrap {
        flex-basis: 100px;
        min-width: 100px;
        max-width: 100px;
    }
}

/* Existing organization VAT lock */
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked {
    background: #f8f8f8;
    border-color: #e6e6e6;
    box-shadow: none;
    opacity: 0.92;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .j50-vat-country-wrap,
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .ts-wrapper.j50-vat-tomselect,
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked #vat_number {
    cursor: not-allowed;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .j50-vat-country-wrap,
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .ts-wrapper.j50-vat-tomselect {
    pointer-events: none;
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-combo.is-locked #vat_number {
    color: #666666;
}

#wpmem_register_form .j50-vat-status.is-locked {
    color: #666666;
}


/* TranslatePress / browser-safe VAT country flags. */
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-flag,
.ts-dropdown .j50-vat-flag{
  display:inline-block;
  width:18px;
  min-width:18px;
  height:12px;
  border:1px solid rgba(0,0,0,.14);
  border-radius:2px;
  overflow:hidden;
  text-indent:120%;
  white-space:nowrap;
  background:var(--j50-vat-flag-bg,#f3f3f3);
  box-shadow:0 1px 1px rgba(0,0,0,.04);
}

#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-flag > img,
#wpmem_register_form .div_text.j50-vat-enhanced .j50-vat-flag > .emoji,
.ts-dropdown .j50-vat-flag > img,
.ts-dropdown .j50-vat-flag > .emoji{
  display:none !important;
}
.j50-vat-flag--at{--j50-vat-flag-bg:linear-gradient(to bottom,#ed2939 0 33.333%,#fff 33.333% 66.666%,#ed2939 66.666%);}
.j50-vat-flag--be{--j50-vat-flag-bg:linear-gradient(to right,#000 0 33.333%,#ffd90c 33.333% 66.666%,#ef3340 66.666%);}
.j50-vat-flag--bg{--j50-vat-flag-bg:linear-gradient(to bottom,#fff 0 33.333%,#00966e 33.333% 66.666%,#d62612 66.666%);}
.j50-vat-flag--hr{--j50-vat-flag-bg:linear-gradient(to bottom,#f00000 0 33.333%,#fff 33.333% 66.666%,#171796 66.666%);}
.j50-vat-flag--cy{--j50-vat-flag-bg:radial-gradient(circle at 55% 50%,#d57800 0 18%,transparent 19%),#fff;}
.j50-vat-flag--cz{--j50-vat-flag-bg:linear-gradient(135deg,#11457e 0 42%,transparent 43%),linear-gradient(to bottom,#fff 0 50%,#d7141a 50%);}
.j50-vat-flag--de{--j50-vat-flag-bg:linear-gradient(to bottom,#000 0 33.333%,#dd0000 33.333% 66.666%,#ffce00 66.666%);}
.j50-vat-flag--dk{--j50-vat-flag-bg:linear-gradient(to right,transparent 0 28%,#fff 28% 40%,transparent 40%),linear-gradient(to bottom,transparent 0 42%,#fff 42% 58%,transparent 58%),#c8102e;}
.j50-vat-flag--ee{--j50-vat-flag-bg:linear-gradient(to bottom,#0072ce 0 33.333%,#000 33.333% 66.666%,#fff 66.666%);}
.j50-vat-flag--el{--j50-vat-flag-bg:repeating-linear-gradient(to bottom,#0d5eaf 0 11.111%,#fff 11.111% 22.222%);}
.j50-vat-flag--es{--j50-vat-flag-bg:linear-gradient(to bottom,#aa151b 0 25%,#f1bf00 25% 75%,#aa151b 75%);}
.j50-vat-flag--fi{--j50-vat-flag-bg:linear-gradient(to right,transparent 0 30%,#002f6c 30% 45%,transparent 45%),linear-gradient(to bottom,transparent 0 38%,#002f6c 38% 58%,transparent 58%),#fff;}
.j50-vat-flag--fr{--j50-vat-flag-bg:linear-gradient(to right,#0055a4 0 33.333%,#fff 33.333% 66.666%,#ef4135 66.666%);}
.j50-vat-flag--hu{--j50-vat-flag-bg:linear-gradient(to bottom,#ce2939 0 33.333%,#fff 33.333% 66.666%,#477050 66.666%);}
.j50-vat-flag--ie{--j50-vat-flag-bg:linear-gradient(to right,#169b62 0 33.333%,#fff 33.333% 66.666%,#ff883e 66.666%);}
.j50-vat-flag--it{--j50-vat-flag-bg:linear-gradient(to right,#009246 0 33.333%,#fff 33.333% 66.666%,#ce2b37 66.666%);}
.j50-vat-flag--lt{--j50-vat-flag-bg:linear-gradient(to bottom,#fdb913 0 33.333%,#006a44 33.333% 66.666%,#c1272d 66.666%);}
.j50-vat-flag--lu{--j50-vat-flag-bg:linear-gradient(to bottom,#ef3340 0 33.333%,#fff 33.333% 66.666%,#00a3e0 66.666%);}
.j50-vat-flag--lv{--j50-vat-flag-bg:linear-gradient(to bottom,#9e3039 0 40%,#fff 40% 60%,#9e3039 60%);}
.j50-vat-flag--mt{--j50-vat-flag-bg:linear-gradient(to right,#fff 0 50%,#cf142b 50%);}
.j50-vat-flag--nl{--j50-vat-flag-bg:linear-gradient(to bottom,#ae1c28 0 33.333%,#fff 33.333% 66.666%,#21468b 66.666%);}
.j50-vat-flag--pl{--j50-vat-flag-bg:linear-gradient(to bottom,#fff 0 50%,#dc143c 50%);}
.j50-vat-flag--pt{--j50-vat-flag-bg:linear-gradient(to right,#006600 0 40%,#ff0000 40%);}
.j50-vat-flag--ro{--j50-vat-flag-bg:linear-gradient(to right,#002b7f 0 33.333%,#fcd116 33.333% 66.666%,#ce1126 66.666%);}
.j50-vat-flag--se{--j50-vat-flag-bg:linear-gradient(to right,transparent 0 30%,#fecc00 30% 44%,transparent 44%),linear-gradient(to bottom,transparent 0 38%,#fecc00 38% 58%,transparent 58%),#006aa7;}
.j50-vat-flag--si{--j50-vat-flag-bg:linear-gradient(to bottom,#fff 0 33.333%,#005da4 33.333% 66.666%,#ed1c24 66.666%);}
.j50-vat-flag--sk{--j50-vat-flag-bg:linear-gradient(to bottom,#fff 0 33.333%,#0b4ea2 33.333% 66.666%,#ee1c25 66.666%);}



/* Reuse the same VAT UI outside WP-Members registration, e.g. Job50 organization linking modal. */
form[data-job50-vat-form] .div_text.j50-vat-enhanced { position: relative; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo {
    display: flex; align-items: stretch; justify-content: center; width: 100%;
    border: 1px solid #e3e3e3; border-radius: 6px; overflow: visible;
    box-shadow: 0 4px 8px rgba(0,0,0,.03); background: #fff;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-wrap {
    position: relative; flex: 0 0 100px; min-width: 100px; max-width: 100px;
    height: 100%; padding: 14px 0; border-right: 1px solid #ececec; cursor: pointer;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-input-wrap { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; height: 100%; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced #vat_number {
    width: 100%; height: 100% !important; margin: 0 !important; border: 0 !important;
    border-radius: 0 6px 6px 0 !important; background: transparent !important;
    box-shadow: none !important; line-height: normal !important;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country {
    width: 100%; height: 100% !important; margin: 0 !important; border: 0 !important;
    border-radius: 6px 0 0 6px !important; background: transparent !important;
    box-shadow: none !important; padding: 0 30px 0 14px !important;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    line-height: normal !important; cursor: pointer;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-wrap::after,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect::after {
    content: ""; position: absolute; top: 50%; right: 12px; width: 8px; height: 8px;
    border-right: 2px solid #8f8f8f; border-bottom: 2px solid #8f8f8f;
    transform: translateY(-58%) rotate(45deg); pointer-events: none;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-wrap.has-tomselect::after { display: none; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect { width: 100%; min-width: 0; height: 100%; cursor: pointer; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control {
    user-select: none; display: flex; align-items: center; min-height: 0; height: 100%;
    padding: 0 30px 0 0; border: 0 !important; border-radius: 6px 0 0 6px !important;
    background: transparent !important; box-shadow: none !important; cursor: pointer;
}
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.single .ts-control::after { display: none !important; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.focus::after,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect.dropdown-active::after { transform: translateY(-20%) rotate(-135deg); }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control > *,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .item,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .j50-vat-country-option { pointer-events: none; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .ts-wrapper.j50-vat-tomselect .ts-control .item { display: flex; align-items: center; height: 100%; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-option { display: flex; align-items: center; gap: 10px; width: 100%; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-flag,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-flag { width: 18px; min-width: 18px; text-align: center; font-size: 15px; line-height: 1; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-code { font-family: var(--wp--preset--font-family--google-sans-flex, inherit); font-size: 15px; font-weight: 700; letter-spacing: .02em; color: #2a2a2a; }
form[data-job50-vat-form] .j50-vat-status { min-height: 1.35em; margin-top: 10px; font-size: 14px; line-height: 1.35; color: #666; }
form[data-job50-vat-form] .j50-vat-status small { display: block; margin-top: 4px; font-size: 12px; opacity: .95; white-space: pre-line; }
form[data-job50-vat-form] .j50-vat-status.is-valid { color: #1d7a3e; }
form[data-job50-vat-form] .j50-vat-status.is-error { color: #b42318; }
form[data-job50-vat-form] .j50-vat-status.is-warning { color: #b85a00; }
form[data-job50-vat-form] .j50-vat-status.is-checking,
form[data-job50-vat-form] .j50-vat-status.is-locked { color: #666; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked { background: #f8f8f8; border-color: #e6e6e6; box-shadow: none; opacity: .92; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .j50-vat-country-wrap,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .ts-wrapper.j50-vat-tomselect,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked #vat_number { cursor: not-allowed; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .j50-vat-country-wrap,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked .ts-wrapper.j50-vat-tomselect { pointer-events: none; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-combo.is-locked #vat_number { color: #666; }
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-flag { display:inline-block; height:12px; border:1px solid rgba(0,0,0,.14); border-radius:2px; overflow:hidden; text-indent:120%; white-space:nowrap; background:var(--j50-vat-flag-bg,#f3f3f3); box-shadow:0 1px 1px rgba(0,0,0,.04); }

/* Reusable VAT field inside Job50 shared modals: dropdown and flags. */
body > .ts-dropdown.j50-vat-country-dropdown,
.ts-dropdown.j50-vat-country-dropdown {
    z-index: 100200 !important;
}

form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-option,
.ts-dropdown.j50-vat-country-dropdown .j50-vat-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-flag,
.ts-dropdown.j50-vat-country-dropdown .j50-vat-country-flag,
form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-flag,
.ts-dropdown.j50-vat-country-dropdown .j50-vat-flag {
    display: inline-block;
    width: 18px;
    min-width: 18px;
    height: 12px;
    border: 1px solid rgba(0,0,0,.14);
    border-radius: 2px;
    overflow: hidden;
    text-indent: 120%;
    white-space: nowrap;
    background: var(--j50-vat-flag-bg,#f3f3f3);
}

form[data-job50-vat-form] .div_text.j50-vat-enhanced .j50-vat-country-code,
.ts-dropdown.j50-vat-country-dropdown .j50-vat-country-code {
    font-family: var(--wp--preset--font-family--google-sans-flex, inherit);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #2a2a2a;
}


/* Job50 shared modal overlay is z-index 999999. VAT country dropdown must sit above it. */
body > .ts-dropdown.j50-vat-country-dropdown,
.ts-dropdown.j50-vat-country-dropdown,
.j50-vat-country-dropdown {
    z-index: 1000002 !important;
}
