/*
 * Cart UI: variation dialog + "added to cart" bottom sheet (js/jiawaz-cart.js, inc/functions/cart-ui.php).
 * Bottom sheet on mobile, centered panel rising from the bottom on desktop. RTL-safe (logical properties).
 */

.jiawaz-sheet {
    position: fixed;
    inset: 0;
    z-index: 100000;
    visibility: hidden;
    pointer-events: none;
}
.jiawaz-sheet.is-open {
    visibility: visible;
    pointer-events: auto;
}
.jiawaz-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    opacity: 0;
    transition: opacity 250ms ease;
}
.jiawaz-sheet.is-open .jiawaz-sheet__backdrop {
    opacity: 1;
}
.jiawaz-sheet__panel {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    margin-inline: auto;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
    outline: none;
}
.jiawaz-sheet.is-open .jiawaz-sheet__panel {
    transform: translateY(0);
}
@media (min-width: 768px) {
    .jiawaz-sheet__panel {
        bottom: 24px;
        border-radius: 24px;
    }
    .jiawaz-sheet__handle {
        display: none !important;
    }
}
.jiawaz-sheet__handle {
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 5px;
    background: #e3e3e3;
    margin: 10px auto 0;
    flex-shrink: 0;
}
.jiawaz-sheet__close {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f3f3f3;
    color: var(--colorText, #222);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: 200ms;
}
.jiawaz-sheet__close:hover {
    background: var(--colorPrimary);
    color: #fff;
}
.jiawaz-sheet__body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
}
html.jiawaz-sheet-open,
html.jiawaz-sheet-open body {
    overflow: hidden;
}
.jiawaz-sheet__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}
.jiawaz-sheet__loading .circle-loader {
    width: 36px;
    height: 36px;
}

/* ---------------------------------------------------------------- buttons */

.jiawaz-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--colorPrimary);
    color: var(--colorPrimary);
    background: #fff;
    font-weight: bold;
    transition: 200ms;
}
.jiawaz-btn:hover {
    background: rgba(var(--colorPrimaryRGB), 0.08);
    color: var(--colorPrimary);
}
.jiawaz-btn--primary {
    background: var(--colorPrimary);
    color: #fff;
}
.jiawaz-btn--primary:hover {
    background: var(--colorPrimary);
    color: #fff;
    box-shadow: 0 6px 20px rgba(var(--colorPrimaryRGB), 0.35);
}

/* ---------------------------------------------------------------- variation dialog */

.jiawaz-vd__head {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-inline-end: 44px; /* room for the close button */
    margin-bottom: 16px;
}
/* The dialog keeps WooCommerce's ".product .images" structure (the variation image swap needs it), so on
   WooCommerce pages its single-product gallery rules apply too (".woocommerce div.product div.images":
   float, width 48% / 100% on small screens, full-width image). !important: some of them include #content. */
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__image {
    float: none !important;
    width: 96px !important;
    max-width: 96px;
    margin: 0 !important;
    padding: 0;
    flex-shrink: 0;
    opacity: 1 !important;
}
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__image .woocommerce-product-gallery__image{
    width: 96px;
    margin: 0;
}
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__image img {
    display: block;
    width: 96px !important;
    max-width: 96px !important;
    height: 96px !important;
    object-fit: contain;
    border-radius: 14px;
    background: #f7f7f7;
}
.jiawaz-vd__title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 6px;
    line-height: 1.6;
}
.jiawaz-vd__price {
    color: var(--colorPrimary);
    font-weight: bold;
}
.jiawaz-vd__form .variations {
    width: 100%;
    border: 0;
    margin-bottom: 8px;
}
.jiawaz-vd__form .variations tr,
.jiawaz-vd__form .variations th,
.jiawaz-vd__form .variations td {
    display: block;
    border: 0;
    padding: 0;
    background: none;
    text-align: start;
}
.jiawaz-vd__form .variations th.label {
    font-weight: bold;
    margin: 12px 0 8px;
}
.jiawaz-vd__form .reset_variations {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
}
.jiawaz-sheet .jiawaz-chips-select {
    /* visually hidden: chips replace it, WooCommerce still reads it */
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden;
    clip-path: inset(50%);
    opacity: 0;
    pointer-events: none;
}
.jiawaz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.jiawaz-chip {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid #e3e3e3;
    background: #fff;
    color: var(--colorText, #222);
    cursor: pointer;
    transition: 150ms;
}
.jiawaz-chip:hover:not(:disabled) {
    border-color: var(--colorPrimary);
}
.jiawaz-chip.is-selected {
    border-color: var(--colorPrimary);
    background: rgba(var(--colorPrimaryRGB), 0.1);
    color: var(--colorPrimary);
    font-weight: bold;
}
.jiawaz-chip:disabled {
    opacity: 0.4;
    text-decoration: line-through;
    cursor: not-allowed;
}
.jiawaz-vd__form .single_variation_wrap {
    margin-top: 14px;
}
.jiawaz-vd__form .woocommerce-variation-price {
    font-weight: bold;
    color: var(--colorPrimary);
    margin-bottom: 6px;
}
.jiawaz-vd__form .woocommerce-variation-add-to-cart {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 12px;
}
.jiawaz-vd__form .single_add_to_cart_button {
    flex: 1 1 auto;
    min-height: 48px;
    border-radius: 14px !important;
}
/* WooCommerce's single-product rules (".woocommerce div.product form.cart ...") float these on WooCommerce
   pages; in the dialog they are flex items, and the button label stays on one line */
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__form .quantity,
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__form .single_add_to_cart_button {
    float: none !important;
    margin: 0 !important;
}
.jiawaz-sheet .jiawaz-vd .jiawaz-vd__form .single_add_to_cart_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 12px;
    white-space: nowrap;
}
.jiawaz-sheet .jiawaz-vd__form .single_add_to_cart_button.disabled {
    opacity: 0.45 !important;
    cursor: not-allowed;
}
/* AJAX add-to-cart in progress (dialog, single product page, Elementor add-to-cart widget) */
form.cart .single_add_to_cart_button.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: progress;
}
.jiawaz-vd__more {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--colorText, #222);
}

/* ---------------------------------------------------------------- added to cart */

.jiawaz-added__item {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-inline-end: 44px;
}
.jiawaz-added__thumb {
    position: relative;
    width: 84px;
    flex-shrink: 0;
}
.jiawaz-added__thumb img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 14px;
    background: #f7f7f7;
}
.jiawaz-added__check {
    position: absolute;
    bottom: -6px;
    inset-inline-end: -6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.jiawaz-added__check svg {
    width: 32px;
    height: 32px;
    stroke: #21a35b;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.jiawaz-added__check-circle {
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: jiawaz-check-draw 450ms ease-out forwards;
}
.jiawaz-added__check-tick {
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: jiawaz-check-draw 300ms 350ms ease-out forwards;
}
@keyframes jiawaz-check-draw {
    to {
        stroke-dashoffset: 0;
    }
}
.jiawaz-added__status {
    color: #21a35b;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}
.jiawaz-added__title {
    font-weight: bold;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.jiawaz-added__details {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    font-size: 13px;
    color: #777;
}
.jiawaz-added__actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.jiawaz-added__suggestions {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}
.jiawaz-added__suggestions-title {
    font-weight: bold;
    margin-bottom: 12px;
}
.jiawaz-suggest {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.jiawaz-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid #f0f0f0;
}
.jiawaz-suggest__thumb {
    flex-shrink: 0;
}
.jiawaz-suggest__thumb img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 10px;
    background: #f7f7f7;
}
.jiawaz-suggest__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.jiawaz-suggest__title {
    font-size: 14px;
    color: var(--colorText, #222);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jiawaz-suggest__price {
    font-size: 13px;
    color: var(--colorPrimary);
    font-weight: bold;
}
.jiawaz-suggest__price del {
    color: #aaa;
    font-weight: normal;
}
.jiawaz-suggest__add {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--colorPrimaryRGB), 0.1);
    color: var(--colorPrimary);
    cursor: pointer;
    transition: 200ms;
}
.jiawaz-suggest__add:hover {
    background: var(--colorPrimary);
    color: #fff;
}
.jiawaz-suggest__add .circle-loader {
    width: 20px;
    height: 20px;
}
