/**
 * Mini cart drawer — bottom-left popup after add to cart.
 */

.bt-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
}

.bt-cart-drawer.is-open {
    pointer-events: auto;
}

.bt-cart-drawer__backdrop {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.12);
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

.bt-cart-drawer.is-open .bt-cart-drawer__backdrop {
    opacity: 1;
}

.bt-cart-drawer__panel {
    position: fixed;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: min(380px, calc(100vw - 40px));
    max-height: min(520px, calc(100vh - 40px));
    background: #fff;
    border: 1px solid #eee;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    transform: translateY(calc(100% + 32px));
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.bt-cart-drawer.is-open .bt-cart-drawer__panel {
    transform: translateY(0);
}

.bt-cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
}

.bt-cart-drawer__head h2 {
    margin: 0;
    color: var(--bt-ink);
    font-family: var(--bt-heading-font);
    font-size: 17px;
    font-weight: 800;
}

.bt-cart-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--bt-muted);
    background: #f5f5f5;
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.bt-cart-drawer__close:hover {
    color: var(--bt-red);
    background: #fff0f0;
}

.bt-cart-drawer__items {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 18px;
    overflow-y: auto;
}

.bt-cart-drawer__empty {
    margin: 0;
    padding: 24px 0;
    color: var(--bt-muted);
    font-size: 14px;
    text-align: center;
}

.bt-cart-drawer__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bt-cart-drawer__item {
    display: flex;
    gap: 12px;
    align-items: center;
}

.bt-cart-drawer__item-image {
    flex-shrink: 0;
    overflow: hidden;
    width: 56px;
    height: 56px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
}

.bt-cart-drawer__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bt-cart-drawer__item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bt-cart-drawer__item-body strong {
    color: var(--bt-ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.bt-cart-drawer__item-meta {
    color: var(--bt-muted);
    font-size: 13px;
    font-weight: 600;
}

.bt-cart-drawer__foot {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px 18px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.bt-cart-drawer__total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bt-cart-drawer__total-label {
    color: var(--bt-muted);
    font-size: 14px;
    font-weight: 600;
}

.bt-cart-drawer__total-value {
    color: var(--bt-green-dark);
    font-family: var(--bt-product-font);
    font-size: 16px;
    font-weight: 800;
}

.bt-cart-drawer__checkout {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 10px 16px !important;
    color: #fff !important;
    background: linear-gradient(135deg, var(--bt-red), var(--bt-orange)) !important;
    border: 0 !important;
    border-radius: 14px !important;
    box-shadow: 0 14px 28px rgba(227, 35, 42, 0.22) !important;
    font-family: var(--bt-button-font);
    font-size: 0.9rem !important;
    font-weight: 900 !important;
    text-align: center;
    transform: none !important;
}

.bt-cart-drawer__checkout:hover {
    color: #fff !important;
    background: linear-gradient(135deg, var(--bt-red-dark), var(--bt-orange)) !important;
    transform: translateY(-1px) !important;
}

@media (max-width: 640px) {
    .bt-cart-drawer__panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }
}

/* Full-page loading while add to cart processes */
.bt-add-to-cart-loading {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 253, 248, 0.82);
    backdrop-filter: blur(4px);
}

.bt-add-to-cart-loading.is-visible {
    display: flex;
}

.bt-add-to-cart-loading__box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    padding: 28px 32px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.bt-add-to-cart-loading__box p {
    margin: 0;
    color: var(--bt-ink);
    font-family: var(--bt-font);
    font-size: 15px;
    font-weight: 700;
}

.bt-add-to-cart-loading__spinner {
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top-color: var(--bt-red);
    border-radius: 50%;
    animation: bt-cart-spin 0.7s linear infinite;
}

@keyframes bt-cart-spin {
    to {
        transform: rotate(360deg);
    }
}

body.bt-add-to-cart-loading-active {
    overflow: hidden;
}

.sp-hero__purchase .single_add_to_cart_button.loading {
    opacity: 0.65;
    pointer-events: none;
}
