/* ==========================================================================
   Toothident – Bought Together popup
   ========================================================================== */

.tibt {
    --tibt-primary: #0c7cd5;
    --tibt-text: #1d2327;
    --tibt-muted: #6b7280;
    --tibt-border: #e5e7eb;
    --tibt-bg-soft: #f8fafc;
    --tibt-radius: 14px;
    --tibt-width: 400px;

    position: fixed;
    inset: 0;
    z-index: 999999;
    visibility: hidden;
    pointer-events: none;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tibt-text);
    transition: visibility 0s linear .35s;
}

.tibt.is-open {
    visibility: visible;
    transition-delay: 0s;
}

.tibt *, .tibt *::before, .tibt *::after {
    box-sizing: border-box;
}

.tibt__panel button {
    margin: unset;
    min-width: unset;
    min-height: unset;
}

/* ---------- Overlay (mobile only) ---------- */
.tibt__overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .3s;
}


.tibt__panel {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: var(--tibt-width);
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--tibt-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(calc(-100% + 40px));
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .25s;
}

.tibt.is-open .tibt__panel {
    opacity: 1;
    transform: none;
}

/* ---------- Panel: mobile = slide up from center ---------- */
@media (max-width: 600px) {
    .tibt__overlay {
        display: block;
    }

    .tibt.is-open .tibt__overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .tibt__panel {
        left: 50%;
        right: auto;
        bottom: 0;
        width: 100%;
        max-width: 520px;
        max-height: 85vh;
        border-radius: 18px 18px 0 0;
        transform: translate(-50%, 100%);
    }

    .tibt.is-open .tibt__panel {
        transform: translate(-50%, 0);
    }
}

/* ---------- Header / footer ---------- */
.tibt__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--tibt-border);
}

.tibt__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.tibt__subtitle {
    margin: 2px 0 0;
    color: var(--tibt-muted);
    font-size: 12px;
}

.tibt__subtitle:empty {
    display: none;
}

.tibt__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;

    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: var(--tibt-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 0 0 0;
}

.tibt__close:hover {
    background: #e5e7eb;
}

.tibt__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 16px;
    -webkit-overflow-scrolling: touch;
}

.tibt__footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--tibt-border);
}

.tibt__footer .tibt-btn {
    flex: 1;
}

/* ---------- Buttons ---------- */
.tibt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    max-height: 48px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.tibt-btn--primary {
    background: var(--tibt-primary);
    color: #fff;
}

.tibt-btn--primary:hover {
    opacity: .9;
    color: #fff;
}

.tibt-btn--light {
    background: #fff;
    color: var(--tibt-text);
    border-color: var(--tibt-border);
}

.tibt-btn--light:hover {
    background: #f9fafb;
}

.tibt-btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

/* ---------- List / item ---------- */
.tibt-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tibt-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--tibt-border);
    transition: background .2s, box-shadow .2s, padding .2s, margin .2s;
}

.tibt-item:last-child {
    border-bottom: 0;
}

.tibt-item.is-loading {
    opacity: .6;
    pointer-events: none;
}

/* image is always on the RIGHT, title + price next to it */
.tibt-item__main {
    display: flex;
    align-items: center;
    gap: 12px;
    direction: ltr;
}

.tibt-item__info {
    flex: 1;
    min-width: 0;
}

body.rtl .tibt-item__info {
    direction: rtl;
    text-align: right;
}

.tibt-item__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.tibt-item__price {
    margin-top: 4px;
    font-weight: 600;
    color: var(--tibt-primary);
}

.tibt-item__price del {
    color: var(--tibt-muted);
    font-weight: 400;
    margin-inline-end: 4px;
}

.tibt-item__price ins {
    text-decoration: none;
}

.tibt-item__media {
    position: relative;
    flex: 0 0 84px;
    width: 84px;
    height: 84px;
    transition: all .25s ease;
}

.tibt-item__thumb {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
}

.tibt-item__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* + button over the image */
.tibt-item__action {
    position: absolute;
    right: -6px;
    bottom: -6px;
    display: flex;
    direction: ltr;
}

.tibt-item__action > button.tibt-btn-plus {
    width: 24px;
    height: 24px;
    margin: unset;
    padding: 5px 0 0 0;
    min-width: unset;
    min-height: unset;
    border-radius: 50% !important;
    background: var(--tibt-primary);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    transition: transform .2s, background .2s;
}

.tibt-btn-plus:hover {
    transform: scale(1.08);
}


.tibt-qty {
    display: none;
    align-items: center;
    background: #fff;
    border: 1px solid var(--tibt-border);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    overflow: hidden;
}

.tibt-item.is-in-cart .tibt-qty {
    display: inline-flex;
}

.tibt-item.is-in-cart .tibt-btn-add,
.tibt-item.is-in-cart .tibt-btn-submit {
    display: none;
}

.tibt-qty__btn {
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: var(--tibt-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 0 0 0;
}

.tibt-qty__btn:hover {
    background: #f3f4f6;
}

.tibt-qty input.tibt-qty__input{
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--tibt-text);
    -moz-appearance: textfield;
    box-shadow: none;
    border: unset;
}

.tibt-qty__input::-webkit-outer-spin-button,
.tibt-qty__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---------- Variable product: expanded (larger) state ---------- */
.tibt-item.is-expanded {
    margin: 8px -8px;
    padding: 14px 8px;
    background: var(--tibt-bg-soft);
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--tibt-border);
}

.tibt-item.is-expanded .tibt-item__media {
    flex-basis: 120px;
    width: 120px;
    height: 120px;
}

.tibt-item.is-expanded .tibt-item__title {
    font-size: 15px;
    -webkit-line-clamp: 3;
}

.tibt-item.is-expanded .tibt-btn-toggle {
    transform: rotate(45deg);
    background: #374151;
}

.tibt-variations {
    display: none;
    margin-top: 14px;
}

.tibt-item.is-expanded .tibt-variations {
    display: block;
    animation: tibt-fade .25s ease;
}

.tibt-variations__row {
    margin: 10px 0;
}

.tibt-variations__row label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tibt-muted);
}

.tibt-variations__row select {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--tibt-border);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    color: var(--tibt-text);
    margin: unset;
}

.tibt-variations__note {
    min-height: 0;
    margin: 0 0 8px;
    font-size: 12px;
    color: #b45309;
}

.tibt-variations__note:empty {
    display: none;
}

.tibt-variations__actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tibt-variations__actions .tibt-btn-submit {
    width: 100%;
}

.tibt-variations__actions .tibt-qty {
    box-shadow: none;
    border-color: var(--tibt-primary);
}
.tibt-variations__clear {
    display: block;
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tibt-primary);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}
.tibt-variations__clear[hidden] { display: none; }
/* ---------- Messages ---------- */
.tibt-item__msg {
    margin: 8px 0 0;
    font-size: 12px;
    color: #b91c1c;
}

@keyframes tibt-fade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tibt, .tibt__panel, .tibt-item, .tibt-item__media {
        transition: none;
    }

    .tibt-item.is-expanded .tibt-variations {
        animation: none;
    }
}

