/*
 * Product feedback modal (#product-response), template-parts/product-feedback-modal.php.
 * Same visual language as the modern cart and add-to-cart popup. Bottom sheet on phones.
 */

:is(#product-response, #better-price__modal).bk-fb {
    --bk-fb-accent: var(--m_accent_color2, var(--accent_color2, #F14E23));
    --bk-fb-ink: #1f2430;
    --bk-fb-text: #42507a;
    --bk-fb-muted: #6b7280;
    --bk-fb-soft: #f3f4f7;
    --bk-fb-line: #e6e8ee;
    --bk-fb-ease: cubic-bezier(.2, .9, .25, 1.05);
    direction: rtl;
    text-align: right;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-dialog {
    display: flex !important;
    align-items: center;
    top: auto;
    width: calc(100% - 32px);
    max-width: 560px;
    max-height: none;
    margin-right: auto;
    margin-left: auto;
    overflow: visible;
    color: var(--bk-fb-ink);
}

:is(#product-response, #better-price__modal).bk-fb.fade .bk-fb-dialog {
    transform: translateY(16px) scale(.97);
    transition: transform .35s var(--bk-fb-ease);
}

:is(#product-response, #better-price__modal).bk-fb.show .bk-fb-dialog {
    transform: none;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 32px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .4);
}

/* ---------- Header ---------- */

:is(#product-response, #better-price__modal).bk-fb .bk-fb-head {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--bk-fb-line);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-thumb {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    margin: 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--bk-fb-soft);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-thumb img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: contain;
    mix-blend-mode: multiply;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-heading {
    flex: 1;
    min-width: 0;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-title {
    margin: 0;
    color: var(--bk-fb-ink);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.6;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-name {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--bk-fb-muted);
    font-size: 12px;
    line-height: 1.7;
    white-space: nowrap;
    text-overflow: ellipsis;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    align-self: flex-start;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--bk-fb-soft);
    color: var(--bk-fb-ink);
    cursor: pointer;
    transition: transform .2s, color .2s;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-close:hover {
    color: var(--bk-fb-accent);
    transform: rotate(90deg);
}

/* ---------- Form ---------- */

:is(#product-response, #better-price__modal).bk-fb .bk-fb-form {
    display: grid;
    gap: 16px;
    padding: 18px 22px 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-hint {
    margin: 0;
    color: var(--bk-fb-text);
    font-size: 13px;
    font-weight: 600;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

:is(#product-response, #better-price__modal).bk-fb label.bk-fb-option {
    position: relative;
    display: block;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 9px 10px;
    border: 1.5px solid var(--bk-fb-line);
    border-radius: 14px;
    background: #fff;
    transition: border-color .2s, background-color .2s;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option:hover .bk-fb-option-box {
    border-color: color-mix(in srgb, var(--bk-fb-accent) 35%, var(--bk-fb-line));
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bk-fb-soft);
    color: var(--bk-fb-muted);
    transition: background-color .2s, color .2s;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option-label {
    flex: 1;
    min-width: 0;
    color: var(--bk-fb-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option-tick {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 1.5px solid #cfd4de;
    border-radius: 50%;
    color: transparent;
    transition: background-color .2s, border-color .2s, color .2s;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option-tick svg {
    width: 12px;
    height: 12px;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option input:checked + .bk-fb-option-box {
    border-color: var(--bk-fb-accent);
    background: color-mix(in srgb, var(--bk-fb-accent) 6%, white);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option input:checked + .bk-fb-option-box .bk-fb-option-icon {
    background: color-mix(in srgb, var(--bk-fb-accent) 14%, white);
    color: var(--bk-fb-accent);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option input:checked + .bk-fb-option-box .bk-fb-option-tick {
    border-color: var(--bk-fb-accent);
    background: var(--bk-fb-accent);
    color: #fff;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-option input:focus-visible + .bk-fb-option-box {
    outline: 2px solid var(--bk-fb-accent);
    outline-offset: 2px;
}

/* Text fields */
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field {
    display: block;
    margin: 0;
    padding: 0;
}

:is(#product-response, #better-price__modal).bk-fb .duplicated-url-row {
    display: none;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-field label {
    display: block;
    max-width: none;
    height: auto;
    margin: 0 0 6px;
    color: var(--bk-fb-ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-field input:not([type=checkbox]),
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field textarea,
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field select {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--bk-fb-line) !important;
    border-radius: 12px !important;
    corner-shape: round !important;
    background: #fff;
    box-shadow: none;
    color: var(--bk-fb-ink);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.8;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

:is(#product-response, #better-price__modal).bk-fb #feedback_desc {
    min-height: 96px;
    resize: vertical;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-field input:not([type=checkbox]):focus,
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field textarea:focus,
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field select:focus {
    border-color: var(--bk-fb-accent) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--bk-fb-accent) 14%, transparent);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-field input::placeholder,
:is(#product-response, #better-price__modal).bk-fb .bk-fb-field textarea::placeholder {
    color: #a0a6b3;
}

/* Result message (filled by product.js) */
:is(#product-response, #better-price__modal).bk-fb .bk-fb-message:empty {
    display: none;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-message {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bk-fb-soft);
    color: var(--bk-fb-text);
    font-size: 13px;
    font-weight: 600;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-message.success {
    background: #ecfdf3;
    color: #067647;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-message.failed {
    background: #fef3f2;
    color: #b42318;
}

/* Submit */
:is(#product-response, #better-price__modal).bk-fb .bk-fb-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    border: none;
    border-radius: 14px !important;
    corner-shape: round !important;
    background: var(--bk-fb-accent);
    box-shadow: 0 10px 20px -10px color-mix(in srgb, var(--bk-fb-accent) 80%, transparent);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s, opacity .2s;
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-submit:hover {
    opacity: .94;
    transform: translateY(-1px);
}

:is(#product-response, #better-price__modal).bk-fb .bk-fb-close:focus-visible,
:is(#product-response, #better-price__modal).bk-fb .bk-fb-submit:focus-visible {
    outline: 2px solid var(--bk-fb-accent);
    outline-offset: 2px;
}

/* ---------- Better price modal ---------- */

#better-price__modal.bk-fb .bk-bp-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--bk-fb-soft);
    color: var(--bk-fb-text);
    font-size: 13px;
    font-weight: 600;
}

#better-price__modal.bk-fb .bk-bp-current strong,
#better-price__modal.bk-fb .bk-bp-current .woocommerce-Price-amount {
    color: var(--bk-fb-ink);
    font-size: 15px;
    font-weight: 800;
}

#better-price__modal.bk-fb .bk-bp-current del,
#better-price__modal.bk-fb .bk-bp-current del .woocommerce-Price-amount {
    color: var(--bk-fb-muted);
    font-size: 12px;
    font-weight: 500;
}

#better-price__modal.bk-fb .bk-bp-current ins {
    text-decoration: none;
}

#better-price__modal.bk-fb .bk-bp-price {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 14px 0 6px;
    border: 1.5px solid var(--bk-fb-line);
    border-radius: 12px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

#better-price__modal.bk-fb .bk-bp-price:focus-within {
    border-color: var(--bk-fb-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--bk-fb-accent) 14%, transparent);
}

#better-price__modal.bk-fb .bk-bp-price #better_price {
    flex: 1;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .5px;
    direction: ltr;
    text-align: right;
}

#better-price__modal.bk-fb .bk-bp-unit {
    position: static;
    flex-shrink: 0;
    margin: 0;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--bk-fb-soft);
    color: var(--bk-fb-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

#better-price__modal.bk-fb .bk-bp-label {
    display: block;
    margin-bottom: 6px;
    color: var(--bk-fb-ink);
    font-size: 13px;
    font-weight: 700;
}

#better-price__modal.bk-fb label.bk-bp-mode {
    position: relative;
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

#better-price__modal.bk-fb .bk-bp-mode input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

#better-price__modal.bk-fb .bk-bp-mode-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    border-radius: 14px;
    background: var(--bk-fb-soft);
}

#better-price__modal.bk-fb .bk-bp-mode-track::before {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    right: 4px;
    width: calc(50% - 4px);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 3px rgb(16 24 40 / .12);
    transition: transform .3s var(--bk-fb-ease);
}

#better-price__modal.bk-fb .bk-bp-mode input:not(:checked) + .bk-bp-mode-track::before {
    transform: translateX(-100%);
}

#better-price__modal.bk-fb .bk-bp-mode-on,
#better-price__modal.bk-fb .bk-bp-mode-off {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    color: var(--bk-fb-muted);
    font-size: 13px;
    font-weight: 700;
    transition: color .2s;
}

#better-price__modal.bk-fb .bk-bp-mode input:checked + .bk-bp-mode-track .bk-bp-mode-on,
#better-price__modal.bk-fb .bk-bp-mode input:not(:checked) + .bk-bp-mode-track .bk-bp-mode-off {
    color: var(--bk-fb-accent);
}

#better-price__modal.bk-fb .bk-bp-mode input:focus-visible + .bk-bp-mode-track {
    outline: 2px solid var(--bk-fb-accent);
    outline-offset: 2px;
}

#better-price__modal.bk-fb .shop-url-row {
    margin: 0 !important;
}

#better-price__modal.bk-fb .bk-bp-offline {
    display: none;
}

#better-price__modal.bk-fb .bk-bp-offline > .bk-fb-field + .bk-fb-field {
    margin-top: 16px !important;
}

#better-price__modal.bk-fb .shop-name-row,
#better-price__modal.bk-fb .shop-location-row {
    margin: 0 !important;
}

/* ---------- Phones: bottom sheet ---------- */

@media (max-width: 575px) {
    :is(#product-response, #better-price__modal).bk-fb .bk-fb-dialog {
        align-items: flex-end;
        width: 100%;
        max-width: none;
        min-height: 100%;
        margin: 0;
    }

    :is(#product-response, #better-price__modal).bk-fb.fade .bk-fb-dialog {
        transform: translateY(100%);
    }

    :is(#product-response, #better-price__modal).bk-fb.show .bk-fb-dialog {
        transform: none;
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-content {
        position: relative;
        max-height: 88vh;
        border-radius: 22px 22px 0 0;
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-content::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: #dfe2e8;
        transform: translateX(-50%);
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-head {
        padding: 24px 18px 14px;
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-form {
        padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-options {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    :is(#product-response, #better-price__modal).bk-fb .bk-fb-option-box {
        min-height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(#product-response, #better-price__modal).bk-fb .bk-fb-dialog,
    :is(#product-response, #better-price__modal).bk-fb .bk-fb-close {
        transition: none;
    }
}
