/* ── Frequently Bought Together Widget ── */

.htv-fbt-widget {
    margin: 32px 0;
    font-size: 14px;
    color: #333;
}

.htv-fbt-title {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ── Images row ── */

.htv-fbt-images-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.htv-fbt-img-wrap {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    transition: opacity .2s;
    cursor: pointer;
}

.htv-fbt-img-wrap.htv-fbt-unchecked {
    opacity: .35;
}

.htv-fbt-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.htv-fbt-plus {
    font-size: 22px;
    font-weight: 300;
    color: #555;
    flex-shrink: 0;
}

.htv-fbt-eye {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,.45);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}

.htv-fbt-eye:hover {
    background: rgba(0,0,0,.7);
}

/* ── Product list ── */

.htv-fbt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.htv-fbt-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.htv-fbt-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.htv-fbt-check-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    flex: 1;
}

.htv-fbt-checkbox {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #2dba4e;
    cursor: pointer;
}

.htv-fbt-item-name {
    line-height: 1.4;
}

.htv-fbt-item-price {
    white-space: nowrap;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

/* ── Variant selector button ── */

.htv-fbt-variant-row {
    padding-left: 26px;
}

.htv-fbt-variant-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s;
    min-width: 180px;
    max-width: 100%;
    justify-content: space-between;
}

.htv-fbt-variant-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.htv-fbt-variant-btn:hover {
    border-color: #888;
}

.htv-fbt-chevron {
    flex-shrink: 0;
    color: #888;
}

/* ── Separator & total ── */

.htv-fbt-sep {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 16px 0;
}

.htv-fbt-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.htv-fbt-total-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    color: #888;
    text-transform: uppercase;
}

.htv-fbt-total-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.htv-fbt-total-sale .woocommerce-Price-amount {
    font-size: 1.4em;
    font-weight: 700;
    color: #333;
}

.htv-fbt-total-regular {
    color: #aaa;
    font-size: 13px;
}

.htv-fbt-add-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    background: #2dba4e;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.htv-fbt-add-btn:hover {
    background: #27a344;
}

.htv-fbt-add-btn:active {
    transform: scale(.98);
}

.htv-fbt-add-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ── Modal overlay ── */

.htv-fbt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 600px) {
    .htv-fbt-overlay {
        align-items: center;
    }
}

body.htv-fbt-modal-open {
    overflow: hidden;
}

.htv-fbt-modal {
    background: #fff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0,0,0,.15);
}

@media (min-width: 600px) {
    .htv-fbt-modal {
        border-radius: 16px;
        max-height: 85vh;
    }
}

.htv-fbt-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.htv-fbt-modal-product-name {
    font-weight: 600;
    font-size: 14px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 82%;
}

.htv-fbt-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0 4px;
    transition: color .15s;
    flex-shrink: 0;
}

.htv-fbt-modal-close:hover {
    color: #222;
}

.htv-fbt-modal-body {
    overflow-y: auto;
    padding: 14px 18px;
    flex: 1;
}

.htv-fbt-modal-foot {
    padding: 12px 18px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.htv-fbt-modal-done {
    display: block;
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 600;
    background: #2dba4e;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}

.htv-fbt-modal-done:hover {
    background: #27a344;
}

/* ── Modal preview image ── */

.htv-fbt-modal-preview {
    text-align: center;
    margin-bottom: 14px;
}

.htv-fbt-modal-preview img {
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
}

/* ── Modal option section ── */

.htv-fbt-modal-section {
    margin-bottom: 12px;
}

.htv-fbt-modal-sec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.htv-fbt-modal-sec-title {
    font-size: 14px;
    flex: 1;
}

.htv-fbt-modal-sec-title strong {
    color: #222;
}

.htv-fbt-size-guide {
    font-size: 13px;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    flex-shrink: 0;
}

.htv-fbt-show-all {
    font-size: 13px;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Image grid (option with images) ── */

.htv-fbt-img-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.htv-fbt-img-opt {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    transition: border-color .15s, opacity .15s;
    position: relative;
}

.htv-fbt-img-opt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.htv-fbt-img-opt.htv-selected {
    border-color: #2dba4e;
    box-shadow: 0 0 0 2px #2dba4e;
}

.htv-fbt-img-opt.htv-disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* ── Button grid (text options) ── */

.htv-fbt-btn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.htv-fbt-opt-btn {
    padding: 10px 18px;
    border: 1.5px solid #c8c8c8;
    border-radius: 50px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    min-width: 50px;
    text-align: center;
    white-space: nowrap;
}

.htv-fbt-opt-btn:hover:not(.htv-disabled) {
    border-color: #666;
}

.htv-fbt-opt-btn.htv-selected {
    background: #1a3a2a;
    border-color: #1a3a2a;
    color: #fff;
}

.htv-fbt-opt-btn.htv-disabled {
    opacity: .4;
    cursor: not-allowed;
    color: #bbb;
    border-color: #e0e0e0;
}

/* ── Required field error highlight ── */

.htv-field-error {
    border-color: #e02b27 !important;
    box-shadow: 0 0 0 2px rgba(224,43,39,.25) !important;
    animation: htv-shake .3s ease;
}

@keyframes htv-shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ── Quick-view popup ── */

.htv-fbt-qv-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.htv-fbt-qv-modal {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.25);
}

.htv-fbt-qv-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    z-index: 1;
    padding: 0 4px;
    transition: color .15s;
}

.htv-fbt-qv-close:hover { color: #222; }

.htv-fbt-qv-body {
    display: flex;
    gap: 24px;
    padding: 24px;
}

.htv-fbt-qv-img-col {
    flex-shrink: 0;
    width: 46%;
}

.htv-fbt-qv-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.htv-fbt-qv-info-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.htv-fbt-qv-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #222;
    line-height: 1.4;
}

.htv-fbt-qv-price {
    font-size: 1.25em;
    font-weight: 700;
    color: #2dba4e;
}

.htv-fbt-qv-price del {
    color: #aaa;
    font-weight: 400;
    font-size: .85em;
}

.htv-fbt-qv-options {
    flex: 1;
    overflow-y: auto;
}

.htv-fbt-qv-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.htv-fbt-qv-qty-row {
    display: flex;
    align-items: center;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.htv-fbt-qv-qty-btn {
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 44px;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: background .15s;
}

.htv-fbt-qv-qty-btn:hover { background: #e8e8e8; }

.htv-fbt-qv-qty {
    width: 44px;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    text-align: center;
    font-size: 15px;
    height: 44px;
    -moz-appearance: textfield;
}

.htv-fbt-qv-qty::-webkit-inner-spin-button,
.htv-fbt-qv-qty::-webkit-outer-spin-button { -webkit-appearance: none; }

.htv-fbt-qv-add-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    background: #2dba4e;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    text-align: center;
}

.htv-fbt-qv-add-btn:hover { background: #27a344; }
.htv-fbt-qv-add-btn:disabled { opacity: .6; cursor: not-allowed; }

@media (max-width: 600px) {
    .htv-fbt-qv-body {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
    .htv-fbt-qv-img-col { width: 100%; }
    .htv-fbt-qv-img { max-height: 260px; aspect-ratio: auto; }
}

/* ── Size chart z-index override (must sit above FBT overlay at 99998) ── */

.size-chart-modal {
    z-index: 99999 !important;
}

/* ── Responsive ── */

@media (max-width: 480px) {
    .htv-fbt-img-wrap {
        width: 100px;
        height: 100px;
    }

    .htv-fbt-img-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .htv-fbt-variant-btn {
        min-width: 0;
        width: 100%;
    }
}
