/* =========================================
   CART DRAWER & UPSELL PANEL
   ========================================= */

:root {
    --pr-cart-width: 450px;
    --pr-upsell-width: 380px;
}

.pr-cart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20000;
    visibility: hidden;
    overflow: hidden;
}

.pr-cart-drawer.is-active {
    visibility: visible;
}

body.pr-overflow-hidden {
    overflow: hidden;
}

.pr-cart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.pr-cart-drawer.is-active .pr-cart-overlay {
    opacity: 1;
}

/* Main Drawer Container */
.pr-drawer-container {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--pr-cart-width);
    height: 100%;
    background: #fff;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.pr-cart-drawer.is-active .pr-drawer-container {
    transform: translateX(0);
}

/* Upsell Panel */
.pr-upsell-panel {
    position: absolute;
    top: 50%;
    right: calc(var(--pr-cart-width) + 20px);
    width: var(--pr-upsell-width);
    max-height: 80vh;
    background: #fbf9f6;
    border-radius: 12px;
    transform: translate(30px, -50%);
    opacity: 0;
    visibility: hidden; /* Added visibility for better hiding */
    transition: all 0.5s ease 0.1s;
    padding: 25px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.pr-cart-drawer.is-active.has-upsells .pr-upsell-panel {
    transform: translate(0, -50%);
    opacity: 1;
    visibility: visible;
}

.pr-upsell-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.pr-upsell-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pr-upsell-card {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.pr-upsell-card-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: #fff;
}

.pr-upsell-card-info h4 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 5px;
    line-height: 1.2;
}

.pr-upsell-card-info .price {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.pr-add-upsell {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

/* Items in Drawer */
.pr-drawer-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.pr-drawer-header h2 {
    font-size: 18px;
    margin: 0;
    letter-spacing: 1px;
}

.pr-cart-close {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
}

.pr-drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.pr-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 15px;
}

.pr-cart-item-image img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.pr-cart-item-details {
    flex: 1;
}

.pr-cart-item-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 5px;
}

.pr-cart-item-title a {
    color: #000;
    text-decoration: none;
}

.pr-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.pr-cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pr-qty-selector {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    height: 30px;
}

.pr-qty-btn {
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.pr-qty-input {
    width: 30px;
    border: none;
    text-align: center;
    font-size: 13px;
    -moz-appearance: textfield;
}

.pr-qty-input::-webkit-outer-spin-button,
.pr-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pr-remove-item {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
}

.pr-remove-item:hover {
    color: #ff0000;
}

/* Footer */
.pr-drawer-footer {
    padding: 25px;
    background: #fff;
    border-top: 1px solid #eee;
}

.pr-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.pr-checkout-btn {
    width: 100%;
    display: block;
    text-align: center;
    padding: 18px;
    background: #111;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 1200px) {
    .pr-upsell-panel {
        display: none; /* Hide on small screens to avoid horizontal overlap */
    }
}

@media (max-width: 600px) {
    :root {
        --pr-cart-width: 100%;
    }
}
