/* ─── Floating Cart ─── */
/* Button === */
.wr-floating-cart-btn {
    position: fixed;
    bottom: 85px;
    right: 24px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wr-primary, #27374d);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    font-size: 22px;
}
.wr-floating-cart-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.wr-floating-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #d63638;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    display: none; /* hidden when 0 */
}
.wr-floating-cart-count.has-items {
    display: flex;
}
.wr-floating-cart-count.pulse {
    animation: wrCountPulse 0.35s ease-out;
}
@keyframes wrCountPulse {
    0% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Overlay === */
.wr-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.wr-cart-open .wr-cart-overlay {
    opacity: 1;
    visibility: visible;
}

/* Drawer === */
.wr-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
}
.wr-cart-open .wr-cart-drawer {
    transform: translateX(0);
}

/* Drawer header === */
.wr-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.wr-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.wr-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    color: #666;
}
.wr-cart-close:hover {
    color: #000;
}

/* Drawer body === */
.wr-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.wr-cart-body .widget_shopping_cart_content {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.wr-cart-body .woocommerce-mini-cart {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 0;
}
.wr-cart-body .woocommerce-mini-cart__empty-message {
    padding: 20px;
    text-align: center;
    color: #888;
}
.wr-cart-body .woocommerce-mini-cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.wr-cart-body .woocommerce-mini-cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}
.wr-cart-body .woocommerce-mini-cart-item > div {
    flex: 1;
    min-width: 0;
}
.wr-cart-body .woocommerce-mini-cart-item .remove {
    font-size: 18px;
    color: #999;
    text-decoration: none;
}
.wr-cart-body .woocommerce-mini-cart-item .remove:hover {
    color: #d63638;
}
.wr-cart-body .woocommerce-mini-cart-item .quantity {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}
.wr-cart-body .woocommerce-mini-cart__total {
    padding: 16px 20px;
    border-top: 2px solid #eee;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.wr-cart-body .woocommerce-mini-cart__buttons {
    padding: 0 20px 16px;
}
.wr-cart-body .woocommerce-mini-cart__buttons .button {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    text-decoration: none;
}
.wr-cart-body .woocommerce-mini-cart__buttons .button.checkout {
    background: var(--wr-primary, #27374d);
    color: #fff;
    border: none;
}
.wr-cart-body .woocommerce-mini-cart__buttons .button.wc-forward:not(.checkout) {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

/* Loading spinner inside drawer */
.wr-cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}
.wr-cart-loading::after {
    content: "";
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: var(--wr-primary, #27374d);
    border-radius: 50%;
    animation: wrSpin 0.6s linear infinite;
}
@keyframes wrSpin {
    to { transform: rotate(360deg); }
}

/* Toast notification */
.wr-cart-toast {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 9997;
    background: #27374d;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.wr-cart-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile tweaks */
@media (max-width: 480px) {
    .wr-cart-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .wr-floating-cart-btn {
        bottom: 75px;
        right: 16px;
    }
    .wr-cart-toast {
        bottom: 153px;
    }
}
