body.woocommerce-cart,
body.woocommerce-checkout {
    --mosica-checkout-accent: var(--nectar-accent-color, var(--nectar-extra-color-1, #78906f));
    --mosica-checkout-complement: #88677f;
    --mosica-checkout-ink: #252927;
    --mosica-checkout-line: color-mix(in srgb, var(--mosica-checkout-accent) 18%, #e7e9e7);
}

@supports (color: hsl(from red calc(h + 180) s l)) {
    body.woocommerce-cart,
    body.woocommerce-checkout {
        --mosica-checkout-complement: hsl(from var(--mosica-checkout-accent) calc(h + 180) s l);
    }
}

#mosica-checkout-preferences,
#mosica-checkout-preferences * { box-sizing: border-box; }

#mosica-checkout-preferences {
    display: grid;
    grid-template-columns: minmax(240px, .85fr) minmax(0, 1.6fr);
    gap: 28px;
    position: relative;
    z-index: 3;
    width: 100%;
    margin: 8px 0 36px;
    padding: 24px 28px;
    border: 1px solid var(--mosica-checkout-line);
    border-radius: 16px;
    background: #fff;
    color: var(--mosica-checkout-ink);
    font-family: "Noto Sans KR", "Pretendard", system-ui, -apple-system, sans-serif;
}

#mosica-checkout-preferences > .wpb_row {
    min-width: 0;
    width: auto !important;
    max-width: none;
    left: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none;
    transform: none;
    overflow: visible;
}

#mosica-checkout-preferences > .wpb_row > .row-bg-wrap,
#mosica-checkout-preferences > .wpb_row > .nectar-shape-divider-wrap,
#mosica-checkout-preferences .column-bg-overlay-wrap { display: none; }

#mosica-checkout-preferences .row_col_wrap_12 {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    width: 100%;
}

#mosica-checkout-preferences .row_col_wrap_12::before,
#mosica-checkout-preferences .row_col_wrap_12::after { display: none; }

#mosica-checkout-preferences .row_col_wrap_12 > .wpb_column {
    float: none;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

#mosica-checkout-preferences .vc_column-inner,
#mosica-checkout-preferences .wpb_wrapper,
#mosica-checkout-preferences .wpb_text_column {
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

#mosica-checkout-preferences .wpb_text_column > div {
    justify-content: flex-start !important;
}

#mosica-checkout-preferences h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--mosica-checkout-ink);
    font: 600 14px/1.5 "Noto Sans KR", "Pretendard", system-ui, sans-serif;
    letter-spacing: -.025em;
    text-align: left !important;
}

#mosica-checkout-preferences h4::before {
    content: '';
    flex: 0 0 5px;
    width: 5px;
    height: 14px;
    border-radius: 3px;
    background: var(--mosica-checkout-accent);
}

#mosica-checkout-preferences .mosica-checkout-preferences__language h4::before {
    background: var(--mosica-checkout-complement);
}

#mosica-checkout-preferences .mosica-checkout-preferences__hint {
    color: #767b77;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .08em;
}

#mosica-checkout-preferences .mosica-checkout-preferences__language {
    z-index: 1;
    border-left: 1px solid var(--mosica-checkout-line);
    padding-left: 28px !important;
}

/* Salient gives both rows' inner wrappers their own stacking contexts.
   Raise the currency row as a whole so the popup stays above language buttons. */
#mosica-checkout-preferences .mosica-checkout-preferences__currency {
    z-index: 2;
}

#mosica-checkout-preferences .yay-currency-shortcode-switcher,
#mosica-checkout-preferences .yay-currency-single-page-switcher { margin: 0; }

#mosica-checkout-preferences .yay-currency-custom-select__trigger {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--mosica-checkout-line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--mosica-checkout-accent) 7%, #fff);
    color: var(--mosica-checkout-ink);
    font-size: 13px;
    line-height: 1.5;
}

#mosica-checkout-preferences .yay-currency-custom-options {
    border-color: var(--mosica-checkout-line);
    border-radius: 8px;
    box-shadow: 0 8px 24px #17211614;
    font-size: 13px;
}

#mosica-checkout-preferences .yay-currency-custom-option-row:hover,
#mosica-checkout-preferences .yay-currency-custom-option-row.selected {
    background: color-mix(in srgb, var(--mosica-checkout-accent) 10%, #fff);
}

#mosica-checkout-preferences .mosica-checkout-preferences__languages {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

#mosica-checkout-preferences a.nturl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    margin: 0 !important;
    padding: 8px 10px !important;
    border: 1px solid #e5e7e4;
    border-radius: 8px;
    background: #fff;
    color: #404740 !important;
    font: 500 12px/1.4 "Noto Sans KR", "Pretendard", system-ui, sans-serif;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s;
}

#mosica-checkout-preferences a.nturl:hover,
#mosica-checkout-preferences a.nturl:focus-visible,
#mosica-checkout-preferences a.nturl.active {
    background: color-mix(in srgb, var(--mosica-checkout-complement) 10%, #fff);
    border-color: color-mix(in srgb, var(--mosica-checkout-complement) 60%, #fff);
    color: color-mix(in srgb, var(--mosica-checkout-complement) 30%, #222) !important;
}

#mosica-checkout-preferences a.nturl:focus-visible {
    outline: 2px solid var(--mosica-checkout-complement);
    outline-offset: 2px;
}

#mosica-checkout-preferences a.nturl .flag { flex-shrink: 0; margin: 0 !important; }
#mosica-checkout-preferences .mosica-checkout-preferences__language-compact { display: none; }

@media (max-width: 1000px) {
    #mosica-checkout-preferences { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
    #mosica-checkout-preferences .mosica-checkout-preferences__language {
        border-left: 0;
        border-top: 1px solid var(--mosica-checkout-line);
        padding: 18px 0 0 !important;
    }
}

@media (max-width: 600px) {
    #mosica-checkout-preferences {
        gap: 12px;
        border-radius: 12px;
        padding: 14px;
        margin-bottom: 24px;
    }

    #mosica-checkout-preferences h4 { font-size: 12px; gap: 7px; }
    #mosica-checkout-preferences .mosica-checkout-preferences__hint { display: none; }
    #mosica-checkout-preferences .row_col_wrap_12 { gap: 8px; }
    #mosica-checkout-preferences .mosica-checkout-preferences__currency .row_col_wrap_12 {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 12px;
    }
    #mosica-checkout-preferences .row_col_wrap_12 > .wpb_column,
    #mosica-checkout-preferences .vc_column-inner,
    #mosica-checkout-preferences .wpb_wrapper,
    #mosica-checkout-preferences .wpb_text_column,
    #mosica-checkout-preferences .wpb_text_column > div {
        min-width: 0;
        max-width: 100%;
    }
    #mosica-checkout-preferences .mosica-checkout-preferences__currency h4 {
        white-space: nowrap;
    }
    /* The shortcode itself is a flex item; constraining only its inner wrapper
       leaves translated text free to expand past the panel's padded edge. */
    #mosica-checkout-preferences .yay-currency-shortcode-switcher,
    #mosica-checkout-preferences .yay-currency-single-page-switcher,
    #mosica-checkout-preferences .yay-currency-custom-select-wrapper,
    #mosica-checkout-preferences .yay-currency-custom-select,
    #mosica-checkout-preferences .yay-currency-custom-select__trigger,
    #mosica-checkout-preferences .yay-currency-custom-options {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    #mosica-checkout-preferences .yay-currency-custom-select__trigger {
        min-height: 40px;
        padding: 8px 9px;
        font-size: 12px;
    }
    #mosica-checkout-preferences .yay-currency-custom-selected-option {
        flex: 1 1 0%;
        min-width: 0;
    }
    #mosica-checkout-preferences .yay-currency-selected-option,
    #mosica-checkout-preferences .yay-currency-custom-option {
        display: block;
        flex: 1 1 0%;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #mosica-checkout-preferences .yay-currency-flag,
    #mosica-checkout-preferences .yay-currency-custom-arrow,
    #mosica-checkout-preferences .yay-currency-selected-checked-icon {
        flex-shrink: 0;
    }
    #mosica-checkout-preferences .mosica-checkout-preferences__language { padding-top: 12px !important; }
    #mosica-checkout-preferences .mosica-checkout-preferences__languages { gap: 4px; }
    #mosica-checkout-preferences a.nturl {
        flex: 1 0 auto;
        min-height: 36px;
        padding: 7px 6px !important;
        font-size: 11px;
    }
    #mosica-checkout-preferences a.nturl .flag { display: none !important; }
}

@media (max-width: 360px) {
    #mosica-checkout-preferences .mosica-checkout-preferences__language-label { display: none; }
    #mosica-checkout-preferences .mosica-checkout-preferences__language-compact { display: inline; }
}
