/* ==========================================================
   MasterFFL Checkout — Public Styles
   ========================================================== */

/* ── Outer wrapper ─────────────────────────────────────────
   Hidden by default; JS calls showFFLDealerBlock() to show  */
.mffl-checkout-block {
    display: none;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.mffl-checkout-block h4.mffl-checkout-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #333;
}

/* ── Tab switcher ─────────────────────────────────────────  */
.mffl-tabs {
    display: flex;
    border: 1px solid #ccc;
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 2px;
}

.mffl-tab {
    flex: 1;
    padding: 9px 12px;
    background: #f0f0f0;
    border: none;
    border-right: 1px solid #ccc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #555;
    transition: background .15s, color .15s;
}

.mffl-tab:last-child {
    border-right: none;
}

.mffl-tab--active,
.mffl-tab:hover {
    background: #333;
    color: #fff;
}

/* ── Tab panels ───────────────────────────────────────────  */
.mffl-tab-panel {
    display: none;
}

.mffl-tab-panel--active {
    display: block;
}

/* ── Heading text ─────────────────────────────────────────  */
.mffl-heading-text {
    font-size: 14px;
    color: #444;
    margin: 0 0 14px;
    line-height: 1.6;
}

/* ── Zip + Choose Dealer row ──────────────────────────────  */
.mffl-dealer-search {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 12px;
}

.mffl-postal-code {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1;
}

.mffl-postal-code:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 1px #888;
}

.mffl-postal-code.mffl-input-error {
    border-color: #c00;
}

.mffl-btn {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

.mffl-btn:hover {
    opacity: .88;
}

/* ── Inline warnings ──────────────────────────────────────  */
.mffl-zip-warning,
.mffl-error-text {
    display: block;
    color: #c00;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 8px;
}

/* ── Agreement checkbox ───────────────────────────────────  */
.mffl-agreement {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 6px;
}

.mffl-agreement input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.mffl-agreement label {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    cursor: pointer;
}

/* ── Selected dealer info ─────────────────────────────────  */
#mffl-selected-dealer {
    margin-top: 14px;
    padding: 10px 12px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
}

#mffl-selected-dealer strong {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 13px;
}

.mffl-dealer-address {
    color: #555;
    font-size: 13px;
    line-height: 1.6;
}

/* ── Place order warning ──────────────────────────────────  */
.mffl-place-order-warning {
    color: #c00;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

/* ── B2B Accordion ────────────────────────────────────────  */
.mffl-accordion {
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    margin-bottom: 10px;
    overflow: hidden;
}

.mffl-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: #f7f7f7;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}

.mffl-accordion-header:hover {
    background: #efefef;
}

.mffl-accordion-header strong {
    font-weight: 600;
}

.mffl-accordion-icon {
    font-size: 18px;
    font-weight: 300;
    color: #666;
    margin-left: 8px;
    line-height: 1;
}

.mffl-accordion-body {
    padding: 14px;
    background: #fff;
}

/* ── B2B Field groups ─────────────────────────────────────  */
.mffl-field-group {
    margin-bottom: 14px;
}

.mffl-field-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #333;
    margin-bottom: 6px;
}

.mffl-ffl-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.mffl-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1;
}

.mffl-input:focus {
    outline: none;
    border-color: #888;
}

/* ── Dealer selector modal (fixed overlay) ────────────────  */
#mffl-modal {
    position: fixed;
    z-index: 999999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mffl-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .5);
}

.mffl-modal-box {
    position: absolute;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    height: 90vh;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mffl-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    border: none;
    font-size: 28px;
    line-height: 1;
    padding: 4px 12px 6px;
    cursor: pointer;
    border-radius: 0 0 0 4px;
}

.mffl-modal-close:hover {
    background: rgba(0, 0, 0, .85);
}

#mffl-modal-content {
    flex: 1;
    overflow: hidden;
}

#mffl-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ── State restriction popup ──────────────────────────────  */
#mffl-restrict-modal {
    position: fixed;
    z-index: 999999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.mffl-restrict-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 6px;
    padding: 28px 24px;
    max-width: 480px;
    width: 90%;
    position: relative;
    margin: 10vh auto;
    top: auto;
    left: auto;
    transform: none;
}

#mffl-restrict-modal .mffl-modal-backdrop {
    position: fixed;
}

#mffl-restrict-modal .mffl-restrict-box {
    position: relative;
    margin: 10vh auto 0;
    transform: none;
    top: auto;
    left: auto;
}

.mffl-restrict-box .mffl-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    color: #555;
    font-size: 22px;
    padding: 4px 8px;
    border-radius: 3px;
}

.mffl-restrict-box .mffl-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

#mffl-restrict-content p {
    margin: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

/* ── Force shipping section visible ───────────────────────  */
.shipping_address.mffl-force-show {
    display: block !important;
}

/* ── Responsive ───────────────────────────────────────────  */
@media (max-width: 600px) {
    .mffl-dealer-search {
        flex-direction: column;
    }

    .mffl-postal-code,
    .mffl-btn {
        width: 100%;
    }

    .mffl-modal-box {
        top: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .mffl-tabs {
        flex-direction: column;
    }

    .mffl-tab {
        border-right: none;
        border-bottom: 1px solid #ccc;
    }

    .mffl-tab:last-child {
        border-bottom: none;
    }
}

/* ── ZIP Validation Box ───────────────────────────────────────────────── */
#mffl-zip-validation-box {
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

#mffl-zip-validation-box .mffl-checkout-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

#mffl-zip-validation-box .mffl-heading-text {
    margin-bottom: 14px;
    color: #555;
    font-size: 0.95em;
}

.mffl-zip-validation-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.mffl-postal-code-check {
    flex: 1 1 160px;
    max-width: 220px;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    line-height: 1.4;
}

.mffl-postal-code-check:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08);
}

#mffl-zip-check-btn {
    white-space: nowrap;
    padding: 10px 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: opacity .15s;
}

.woocommerce-page .mffl-zip-box-field label {
    margin-bottom: 3px;
    line-height: 1;
}

#mffl-zip-check-btn:hover {
    opacity: .85;
}

#mffl-zip-check-loading {
    font-size: .9em;
    color: #777;
    margin-top: 8px;
}

.mffl-change-zip-wrap {
    margin-bottom: 14px;
}

.mffl-change-zip-btn {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: .9em;
    padding: 0;
    text-decoration: underline;
}

.mffl-change-zip-btn:hover {
    color: #005177;
}

/* ════════════════════════════════════════════════════════════════
   ZIP VALIDATION BOX  — matches design in screenshot
   ════════════════════════════════════════════════════════════════ */

#mffl-zip-validation-box {
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 20px 24px 24px;
    margin-bottom: 24px;
    background: #fff;
}

.mffl-zip-box-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #1a1a1a;
    line-height: 1.3;
}

.mffl-zip-box-subtitle {
    font-size: 14px;
    color: #444;
    margin: 0 0 18px;
    line-height: 1.5;
}

.mffl-zip-box-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mffl-zip-box-label {
    font-size: 16px;
    /* font-weight: 600; */
    color: #1a1a1a;
}

.mffl-zip-box-label .required {
    color: #e00;
}

.mffl-zip-box-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.mffl-zip-check-input {
    flex: 1 1 auto;
    padding: 11px 14px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.4;
    background: #fff;
    color: #1a1a1a;
    outline: none;
    transition: border-color .15s;
    min-width: 0;
}

.mffl-zip-check-input:focus {
    border-color: #555;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .07);
}

.mffl-zip-check-input.mffl-input-error {
    border-color: #c00;
}

.mffl-zip-check-btn {
    flex: 0 0 auto;
    padding: 11px 26px;
    border: none;
    border-radius: 4px;
    font-size: 0.88em;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .15s;
    line-height: 1.4;
}

.mffl-zip-check-btn:hover {
    opacity: .85;
}

.mffl-zip-check-btn:disabled {
    opacity: .55;
    cursor: default;
}

#mffl-zip-check-error {
    margin-top: 4px;
}

.mffl-zip-error-text {
    font-size: 0.85em;
    color: #c00;
}

/* ── Change Zip link (Image 2 — top-right of Shipping Address) ── */

.mffl-change-zip-wrap {
    float: right;
    margin-top: -2px;
    /* align with the "Shipping Address" heading baseline */
}

.mffl-change-zip-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9em;
    color: #1a4fc4;
    /* matches the blue link colour in the screenshot */
    cursor: pointer;
    text-decoration: underline;
    line-height: 1;
    margin-left: 20px;
    text-underline-offset: 4px;
    outline: none;
}

.woocommerce-checkout .checkout .col-2 h3#ship-to-different-address {
    width: 100%;
}

.mffl-change-zip-link:hover {
    color: #0d3aaa;
}

@media (max-width: 600px) {
    .mffl-zip-box-row {
        flex-direction: column;
    }

    .mffl-zip-check-btn {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .mffl-change-zip-wrap {
        float: none;
        margin-top: 5px;
        display: block;
    }
}

/* ── BOPIS / In-Store Pickup ──────────────────────────────────────── */

.mffl-bopis-section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #374151;
    margin: 20px 0 10px;
    text-transform: uppercase;
}

.mffl-bopis-locations {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 24px;
}

.mffl-bopis-location-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid rgb(216, 216, 216);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fff;
}

.mffl-bopis-location-card:hover {
    border-color: #9ca3af;
}

.mffl-bopis-location-selected {
    border-color: #1d4ed8 !important;
    background: #eff6ff;
}

.mffl-bopis-location-disabled {
    cursor: not-allowed;
    opacity: .6;
    background: #f9fafb;
}

.mffl-bopis-location-disabled:hover {
    border-color: rgb(216, 216, 216);
}

.mffl-bopis-location-disabled .mffl-bopis-radio {
    border-color: #e5e7eb;
    background: #f3f4f6;
}

.mffl-bopis-loc-restriction {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: #b91c1c;
}

/* Radio circle */
.mffl-bopis-radio {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: border-color .15s;
}

.mffl-bopis-radio-checked {
    border-color: #1d4ed8;
}

.mffl-bopis-radio-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: background .15s;
    margin-top: 1px;
}

.mffl-bopis-radio-checked .mffl-bopis-radio-inner {
    background: #1d4ed8;
}

.mffl-bopis-loc-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mffl-bopis-location-selected .mffl-bopis-loc-icon {
    background: #dbeafe;
}

.mffl-bopis-loc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mffl-bopis-loc-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.mffl-bopis-loc-addr {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .mffl-bopis-location-card {
        flex-wrap: wrap;
        padding: 12px;
    }
}

/* ── BOPIS Fee Breakdown (below Shipment row) ──────────────────────── */
#mffl-fee-breakdown-row th {
    padding: 0;
}

#mffl-fee-breakdown-row td {
    padding: 4px 0 8px 0;
}

.mffl-fee-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 10px;
    background: #f9f9f9;
    border-left: 3px solid #d1d5db;
    border-radius: 0 4px 4px 0;
}

.mffl-fee-breakdown-line {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.mffl-bopis-loc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.mffl-bopis-loc-name {
    font-size: 16px;
    font-weight: 600;
}

/* ── BOPIS Pickup Details (Pickup Method / Instructions / Hours) ───── */
.mffl-bopis-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mffl-bopis-detail-row {
    padding: 16px 16px;
    border: 1px solid rgb(216, 216, 216);
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mffl-bopis-detail-label {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: none;
    letter-spacing: .03em;
    margin-bottom: 4px;
}

.mffl-bopis-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.mffl-bopis-detail-hours {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mffl-bopis-hours-line {
    font-size: 14px;
    color: #111827;
}

.mffl-bopis-hours-open {
    font-weight: 700;
    color: #111827;
}

.mffl-bopis-hours-closed {
    font-weight: 400;
    color: #6b7280;
}
/* Prevent WooCommerce shipping fields from blinking when FFL mode is active */
body.mffl-hide-shipping .woocommerce-shipping-fields__field-wrapper,
body.mffl-hide-shipping .shipping_address > *:not(#mffl-shipping-heading):not(#mffl-zip-validation-box):not(.mffl-checkout-block):not(#mffl-modal):not(#mffl-restrict-modal),
body.mffl-hide-shipping [id^="shipping_"][id$="_field"],
body.mffl-hide-shipping #ship-to-different-address,
#mffl-zip-validation-box:not([style*="display:none"]):not([style*="display: none"]) ~ .woocommerce-shipping-fields__field-wrapper,
#mffl-zip-validation-box:not([style*="display:none"]):not([style*="display: none"]) ~ [id^="shipping_"][id$="_field"],
#mffl-zip-validation-box:not([style*="display:none"]):not([style*="display: none"]) ~ *:not(.mffl-checkout-block):not(#mffl-shipping-heading):not(#mffl-modal):not(#mffl-restrict-modal) {
    display: none !important;
}