/**
 * FCHub Multi-Currency — Switcher Widget Styles
 */

/* ----- Stage wrapper ----- */
.fchub-mc-switcher-stage {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
}

.fchub-mc-switcher-stage--left {
    justify-content: flex-start;
}

.fchub-mc-switcher-stage--center {
    justify-content: center;
}

.fchub-mc-switcher-stage--right {
    justify-content: flex-end;
}

.fchub-mc-switcher-stage--label-after {
    flex-direction: row-reverse;
}

.fchub-mc-switcher-stage--label-above,
.fchub-mc-switcher-stage--label-below {
    flex-direction: column;
    align-items: flex-start;
}

.fchub-mc-switcher-stage--label-below {
    flex-direction: column-reverse;
}

.fchub-mc-switcher-stage--label-above.fchub-mc-switcher-stage--center,
.fchub-mc-switcher-stage--label-below.fchub-mc-switcher-stage--center {
    align-items: center;
}

.fchub-mc-switcher-stage--label-above.fchub-mc-switcher-stage--right,
.fchub-mc-switcher-stage--label-below.fchub-mc-switcher-stage--right,
.fchub-mc-switcher-stage--label-after.fchub-mc-switcher-stage--right {
    align-items: flex-end;
}

/* ----- Custom properties ----- */
.fchub-mc-switcher {
    --fchub-mc-radius: 6px;
    --fchub-mc-border-color: #d0d5dd;
    --fchub-mc-bg: #fff;
    --fchub-mc-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    --fchub-mc-transition: 150ms ease;
    --fchub-mc-hover-bg: #f5f5f5;
    --fchub-mc-active-bg: #eff6ff;
    --fchub-mc-active-color: #1d4ed8;
    --fchub-mc-text: #344054;
    --fchub-mc-text-secondary: #667085;
    --fchub-mc-badge-ok: #12b76a;
    --fchub-mc-badge-stale: #f04438;

    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    vertical-align: middle;
}

/* ----- Trigger button ----- */
.fchub-mc-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--fchub-mc-border-color);
    border-radius: var(--fchub-mc-radius);
    background: var(--fchub-mc-bg);
    color: var(--fchub-mc-text);
    font: inherit;
    cursor: pointer;
    transition: border-color var(--fchub-mc-transition),
                box-shadow var(--fchub-mc-transition),
                background-color var(--fchub-mc-transition);
    white-space: nowrap;
    line-height: 1.5;
}

.fchub-mc-switcher__trigger:hover {
    border-color: #98a2b3;
}

.fchub-mc-switcher__trigger:focus-visible {
    outline: 2px solid var(--fchub-mc-active-color);
    outline-offset: 2px;
}

.fchub-mc-switcher__flag {
    font-size: 1.125em;
    line-height: 1;
}

.fchub-mc-flag {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.fchub-mc-switcher__code {
    font-weight: 600;
}

.fchub-mc-switcher__name {
    color: var(--fchub-mc-text-secondary);
    font-weight: 500;
}

.fchub-mc-switcher__symbol {
    color: var(--fchub-mc-text-secondary);
    font-weight: 600;
}

.fchub-mc-switcher__caret {
    font-size: 0.625em;
    transition: transform var(--fchub-mc-transition);
    margin-left: 0.125rem;
}

.fchub-mc-switcher--open .fchub-mc-switcher__caret {
    transform: rotate(180deg);
}

/* ----- Dropdown panel ----- */
.fchub-mc-switcher__dropdown {
    display: block;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 9999;
    min-width: 100%;
    width: max-content;
    background: var(--fchub-mc-bg);
    border: 1px solid var(--fchub-mc-border-color);
    border-radius: min(var(--fchub-mc-radius), 12px);
    box-shadow: var(--fchub-mc-shadow);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--fchub-mc-transition),
                transform var(--fchub-mc-transition);
}

.fchub-mc-switcher--open .fchub-mc-switcher__dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fchub-mc-switcher__search-wrap {
    display: block;
    padding: 0.5rem 0.75rem 0;
}

.fchub-mc-switcher__search {
    width: 100%;
    border: 1px solid var(--fchub-mc-border-color);
    border-radius: calc(var(--fchub-mc-radius) - 2px);
    background: var(--fchub-mc-bg);
    color: var(--fchub-mc-text);
    font: inherit;
    padding: 0.4rem 0.55rem;
}

.fchub-mc-switcher__search:focus-visible {
    outline: 2px solid var(--fchub-mc-active-color);
    outline-offset: 2px;
}

/* Override the hidden attribute when open so CSS transitions work */
.fchub-mc-switcher--open .fchub-mc-switcher__dropdown[hidden] {
    display: block;
}

.fchub-mc-switcher--dropdown-start .fchub-mc-switcher__dropdown {
    left: 0;
    right: auto;
}

.fchub-mc-switcher--dropdown-end .fchub-mc-switcher__dropdown {
    left: auto;
    right: 0;
}

.fchub-mc-switcher--direction-up .fchub-mc-switcher__dropdown {
    top: auto;
    bottom: calc(100% + 4px);
}

/* ----- Option list ----- */
.fchub-mc-switcher__list {
    display: block;
    margin: 0;
    padding: 0.25rem 0;
    overflow: visible;
}

.fchub-mc-switcher__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color var(--fchub-mc-transition);
    white-space: nowrap;
}

.fchub-mc-switcher__option:hover,
.fchub-mc-switcher__option--focused {
    background: var(--fchub-mc-hover-bg);
}

.fchub-mc-switcher__option--active {
    background: var(--fchub-mc-active-bg);
    font-weight: 600;
}

.fchub-mc-switcher__option--active .fchub-mc-switcher__option-code {
    color: var(--fchub-mc-active-color);
}

.fchub-mc-switcher__option-code {
    min-width: 2.5em;
    font-weight: 600;
    color: var(--fchub-mc-text);
}

.fchub-mc-switcher__option-sep {
    color: var(--fchub-mc-border-color);
    font-size: 0.75em;
}

.fchub-mc-switcher__option-symbol {
    color: var(--fchub-mc-text-secondary);
    font-weight: 600;
}

.fchub-mc-switcher__option-name {
    color: var(--fchub-mc-text-secondary);
    font-weight: 400;
}

.fchub-mc-switcher__option-check {
    margin-left: auto;
    color: var(--fchub-mc-active-color);
    font-weight: 700;
}

/* ----- Rate badge footer ----- */
.fchub-mc-switcher__footer {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-top: 1px solid var(--fchub-mc-border-color);
}

.fchub-mc-rate-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    color: var(--fchub-mc-text-secondary);
    line-height: 1.4;
}

.fchub-mc-rate-badge__dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fchub-mc-badge-ok);
    flex-shrink: 0;
}

.fchub-mc-rate-badge--stale {
    color: var(--fchub-mc-badge-stale);
}

.fchub-mc-rate-badge--stale .fchub-mc-rate-badge__dot {
    background: var(--fchub-mc-badge-stale);
}

.fchub-mc-rate-context {
    display: block;
    font-size: 0.6875rem;
    color: var(--fchub-mc-text-secondary);
    line-height: 1.45;
}

/* ----- Label ----- */
.fchub-mc-switcher__label {
    display: inline-block;
    color: var(--fchub-mc-text-secondary);
    font-size: 0.875rem;
    vertical-align: middle;
    white-space: nowrap;
}

/* ----- Size variants ----- */
.fchub-mc-switcher--size-sm {
    font-size: 0.8125rem;
}

.fchub-mc-switcher--size-sm .fchub-mc-switcher__trigger {
    padding: 0.25rem 0.5rem;
    gap: 0.3125rem;
}

.fchub-mc-switcher--size-sm .fchub-mc-flag {
    width: 18px;
    height: 13px;
}

.fchub-mc-switcher--size-lg {
    font-size: 0.9375rem;
}

.fchub-mc-switcher--size-lg .fchub-mc-switcher__trigger {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
}

.fchub-mc-switcher--size-lg .fchub-mc-flag {
    width: 22px;
    height: 16px;
}

/* ----- Width modes ----- */
.fchub-mc-switcher--width-full {
    display: flex;
    width: 100%;
}

.fchub-mc-switcher--width-full .fchub-mc-switcher__trigger,
.fchub-mc-switcher--width-full .fchub-mc-switcher__dropdown {
    width: 100%;
}

.fchub-mc-switcher--width-full .fchub-mc-switcher__trigger {
    justify-content: space-between;
}

/* ----- Loading state ----- */
.fchub-mc-switcher--loading .fchub-mc-switcher__trigger {
    opacity: 0.6;
    pointer-events: none;
}

/* ----- No-JS fallback ----- */
.fchub-mc-switcher-fallback-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fchub-mc-switcher-fallback-label {
    font-size: 0.8125rem;
    color: #475467;
}

.fchub-mc-switcher-fallback {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
}

.fchub-mc-switcher-fallback-submit {
    padding: 0.25rem 0.625rem;
    border: 1px solid #98a2b3;
    border-radius: 4px;
    background: #fff;
    color: #344054;
    font: inherit;
    cursor: pointer;
}

/* ----- Inline currency blocks ----- */
.fchub-mc-inline-block {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.fchub-mc-inline-current,
.fchub-mc-inline-rate,
.fchub-mc-inline-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--fchub-mc-border-color);
    border-radius: calc(var(--fchub-mc-radius) + 2px);
    background: var(--fchub-mc-bg);
    color: var(--fchub-mc-text);
    line-height: 1.45;
}

.fchub-mc-inline-current__text {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.fchub-mc-inline-block--notice .fchub-mc-inline-notice {
    background: #f8fafc;
    color: #334155;
}

/* ----- Selector buttons block ----- */
.fchub-mc-selector-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fchub-mc-selector-buttons__button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--fchub-mc-border-color);
    border-radius: 999px;
    background: var(--fchub-mc-bg);
    color: var(--fchub-mc-text);
    font: inherit;
    cursor: pointer;
    transition: border-color var(--fchub-mc-transition), background-color var(--fchub-mc-transition), color var(--fchub-mc-transition);
}

.fchub-mc-selector-buttons__button:hover {
    border-color: #98a2b3;
}

.fchub-mc-selector-buttons__button.is-active {
    background: var(--fchub-mc-active-bg);
    color: var(--fchub-mc-active-color);
    border-color: color-mix(in srgb, var(--fchub-mc-active-color) 35%, var(--fchub-mc-border-color));
}

.fchub-mc-selector-buttons__flag {
    font-size: 1.05em;
    line-height: 1;
}

/* ----- Block style presets ----- */
.wp-block-fchub-multi-currency-switcher.is-style-pill,
.fchub-mc-switcher--preset-pill {
    --fchub-mc-radius: 999px;
    --fchub-mc-shadow: none;
}

.wp-block-fchub-multi-currency-switcher.is-style-pill .fchub-mc-switcher__option,
.wp-block-fchub-multi-currency-switcher.is-style-pill .fchub-mc-switcher__footer,
.fchub-mc-switcher--preset-pill .fchub-mc-switcher__option,
.fchub-mc-switcher--preset-pill .fchub-mc-switcher__footer {
    border-radius: 4px;
}

.wp-block-fchub-multi-currency-switcher.is-style-minimal,
.fchub-mc-switcher--preset-minimal {
    --fchub-mc-border-color: transparent;
    --fchub-mc-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    --fchub-mc-hover-bg: rgba(15, 23, 42, 0.05);
}

.wp-block-fchub-multi-currency-switcher.is-style-minimal .fchub-mc-switcher__trigger,
.fchub-mc-switcher--preset-minimal .fchub-mc-switcher__trigger {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.wp-block-fchub-multi-currency-switcher.is-style-subtle,
.fchub-mc-switcher--preset-subtle {
    --fchub-mc-bg: #f8fafc;
    --fchub-mc-border-color: #e2e8f0;
    --fchub-mc-hover-bg: #eef2f7;
    --fchub-mc-active-bg: #e8f0ff;
    --fchub-mc-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.wp-block-fchub-multi-currency-switcher.is-style-subtle .fchub-mc-switcher__trigger,
.fchub-mc-switcher--preset-subtle .fchub-mc-switcher__trigger {
    backdrop-filter: saturate(160%) blur(6px);
}

.wp-block-fchub-multi-currency-switcher.is-style-glass,
.fchub-mc-switcher--preset-glass {
    --fchub-mc-bg: rgba(255, 255, 255, 0.72);
    --fchub-mc-border-color: rgba(255, 255, 255, 0.55);
    --fchub-mc-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    --fchub-mc-hover-bg: rgba(255, 255, 255, 0.88);
}

.wp-block-fchub-multi-currency-switcher.is-style-glass .fchub-mc-switcher__trigger,
.wp-block-fchub-multi-currency-switcher.is-style-glass .fchub-mc-switcher__dropdown,
.fchub-mc-switcher--preset-glass .fchub-mc-switcher__trigger,
.fchub-mc-switcher--preset-glass .fchub-mc-switcher__dropdown {
    backdrop-filter: blur(14px) saturate(160%);
}

.wp-block-fchub-multi-currency-switcher.is-style-contrast,
.fchub-mc-switcher--preset-contrast {
    --fchub-mc-bg: #0f172a;
    --fchub-mc-border-color: #1e293b;
    --fchub-mc-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
    --fchub-mc-hover-bg: #111c33;
    --fchub-mc-active-bg: #172554;
    --fchub-mc-active-color: #93c5fd;
    --fchub-mc-text: #f8fafc;
    --fchub-mc-text-secondary: #cbd5e1;
    --fchub-mc-badge-ok: #22c55e;
    --fchub-mc-badge-stale: #f87171;
}

/* ----- Disclosure notice ----- */
.fchub-mc-disclosure {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f0f4f8;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #57606a;
    line-height: 1.4;
}

.fchub-mc-disclosure--drawer {
    margin: 0.5rem 20px;
}

/**
 * FOUC prevention — hide price elements briefly while JS projection runs.
 * The projection script adds .fchub-mc-projecting to <html> immediately,
 * then removes it after the first projection pass completes.
 */
.fchub-mc-projecting .fct-item-price,
.fchub-mc-projecting .fct-compare-price,
.fchub-mc-projecting .fct-min-price,
.fchub-mc-projecting .fct-max-price,
.fchub-mc-projecting .fct-cart-item-price,
.fchub-mc-projecting .fct-cart-item-total,
.fchub-mc-projecting .fct_summary_value,
.fchub-mc-projecting .fct_line_item_price,
.fchub-mc-projecting .fct_line_item_total,
.fchub-mc-projecting .fct_promo_price,
.fchub-mc-projecting .fluent-cart-pricing-table-variant-price,
.fchub-mc-projecting .fluent-cart-pricing-table-variant-compare-price,
.fchub-mc-projecting [data-fchub-mc-base] {
    visibility: hidden;
}

/* Safety fallback — remove FOUC class after 2s in case JS fails */
@keyframes fchub-mc-fouc-fallback {
    to { visibility: visible; }
}
.fchub-mc-projecting .fct-item-price,
.fchub-mc-projecting .fct-compare-price {
    animation: fchub-mc-fouc-fallback 0s 2s forwards;
}
