body.fmwc-modal-open {
    overflow: hidden;
}

#fmwc-modal-root .fmwc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#fmwc-modal-root .fmwc-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -10px rgba(15, 23, 42, .35);
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

#fmwc-modal-root .fmwc-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eef0f2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#fmwc-modal-root .fmwc-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

#fmwc-modal-root .fmwc-close {
    background: transparent;
    border: 0;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    padding: 4px 8px;
}

#fmwc-modal-root .fmwc-close:hover {
    color: #0f172a;
}

#fmwc-modal-root .fmwc-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
}

#fmwc-modal-root .fmwc-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

#fmwc-modal-root .fmwc-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

#fmwc-modal-root .fmwc-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .18);
}

#fmwc-modal-root .fmwc-office-results {
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

#fmwc-modal-root .fmwc-office-item {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background .12s ease;
    font-size: 13px;
    color: #1e293b;
}

#fmwc-modal-root .fmwc-office-item:last-child {
    border-bottom: 0;
}

#fmwc-modal-root .fmwc-office-item:hover {
    background: #eef2ff;
}

#fmwc-modal-root .fmwc-office-item.fmwc-selected {
    background: #6366f1;
    color: #fff;
}

#fmwc-modal-root .fmwc-office-city {
    color: #64748b;
    font-weight: 400;
}

#fmwc-modal-root .fmwc-office-code {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
}

#fmwc-modal-root .fmwc-office-item.fmwc-selected .fmwc-office-code {
    color: #c7d2fe;
}

#fmwc-modal-root .fmwc-office-item.fmwc-selected .fmwc-office-city {
    color: #c7d2fe;
}

#fmwc-modal-root .fmwc-office-address {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
}

#fmwc-modal-root .fmwc-office-item.fmwc-selected .fmwc-office-address {
    color: #e0e7ff;
}

#fmwc-modal-root .fmwc-hint {
    padding: 14px;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

#fmwc-modal-root .fmwc-error {
    margin: 0 20px 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 13px;
}

#fmwc-modal-root .fmwc-footer {
    padding: 12px 20px;
    border-top: 1px solid #eef0f2;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

#fmwc-modal-root .fmwc-btn {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease;
}

#fmwc-modal-root .fmwc-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

#fmwc-modal-root .fmwc-btn-secondary {
    background: #fff;
    border-color: #cbd5e1;
    color: #1e293b;
}

#fmwc-modal-root .fmwc-btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
}

#fmwc-modal-root .fmwc-btn-primary {
    background: #6366f1;
    color: #fff;
}

#fmwc-modal-root .fmwc-btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}

/* ── Selection summary card (under the shipping options) ────────────────── */

.fmwc-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    font-size: 14px;
    color: #0f172a;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.fmwc-summary-logo {
    flex: 0 0 auto;
    height: 28px !important;
    width: auto !important;
    max-width: 72px !important;
    object-fit: contain;
}

.fmwc-summary-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fmwc-summary-title {
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fmwc-summary-detail {
    font-size: 13px;
    color: #64748b;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fmwc-summary-warn {
    color: #b45309;
    font-weight: 600;
}

.fmwc-summary:has(.fmwc-summary-warn) {
    background: #fffbeb;
    border-color: #fde68a;
}

.fmwc-summary-btn {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease;
}

.fmwc-summary-btn:hover {
    background: #f1f5f9;
}

.fmwc-summary-btn-primary {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.fmwc-summary-btn-primary:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* Courier logos in the shipping-option labels: generated per courier as
   ::before backgrounds (CheckoutBlockIntegration::rateLogoCss) — an injected
   <img> inside React-owned labels got wiped on every label re-render. */

/* ── Loading states ─────────────────────────────────────────────────────── */

@keyframes fmwc-spin {
    to { transform: rotate(360deg); }
}

.fmwc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #c7d2fe;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: fmwc-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

#fmwc-modal-root .fmwc-hint.fmwc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

#fmwc-modal-root .fmwc-btn-loading {
    position: relative;
    color: transparent !important;
}

#fmwc-modal-root .fmwc-btn-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fmwc-spin .7s linear infinite;
}

/* Overlay over the shipping options while the cart recalculates */
body.fmwc-busy .wp-block-woocommerce-checkout-shipping-methods-block,
body.fmwc-busy .wp-block-woocommerce-cart .wc-block-components-shipping-rates-control {
    position: relative;
}

body.fmwc-busy .wp-block-woocommerce-checkout-shipping-methods-block::after,
body.fmwc-busy .wp-block-woocommerce-cart .wc-block-components-shipping-rates-control::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .6);
    border-radius: 8px;
    cursor: progress;
}

body.fmwc-busy .wp-block-woocommerce-checkout-shipping-methods-block::before,
body.fmwc-busy .wp-block-woocommerce-cart .wc-block-components-shipping-rates-control::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 21;
    width: 32px;
    height: 32px;
    margin: -18px 0 0 -18px;
    border: 3px solid #c7d2fe;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: fmwc-spin .7s linear infinite;
}

/* ── Modal header logo ──────────────────────────────────────────────────── */

#fmwc-modal-root .fmwc-modal-logo {
    display: inline-block;
    height: 22px !important;
    width: auto !important;
    max-width: 64px !important;
    object-fit: contain;
    margin-right: 10px;
    vertical-align: middle;
}
