/* ---- PAGE BUTTON (simulate cart trigger) ---- */
.cart-drawer-trigger {
    /* position: fixed; */
    top: 20px;
    right: 20px;
    background: #1e1e2f;
    color: white;
    border: none;
    border-radius: 40px;
    padding: 12px 28px;
    font-size: 20px ;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-drawer-trigger:hover {
    background: #2d2d44;
    transform: scale(1.02);
}

/* ---- DRAWER OVERLAY ---- */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 2000;
}

.cart-drawer-overlay.cart-drawer-active {
    opacity: 1;
    visibility: visible;
}

/* html, body{
    height: 100dvh;
}
body{
    overflow: hidden;
} */

/* ---- CART DRAWER (right-side sliding) ---- */
.cart-drawer {
    /* auto-flow: ; */
    /* larger screen -> right drawer */
    background: #ffffff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-size: 16px !important;
    margin: 0;
    max-width: 480px;
    overflow-x: hidden;
    overflow-y: hidden !important;
    padding: 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.0);
    width: 100%;
    z-index: 2100;
}

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

/* inner padding */
.cart-drawer-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* close button */
.cart-drawer-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px  ;
    line-height: 1;
    cursor: pointer;
    color: #5e5e6e;
    padding: 4px 8px;
    transition: 0.15s;
    z-index: 5;
}

.cart-drawer-close:hover {
    color: #111;
    transform: scale(1.1);
}

/* Header */
.cart-drawer-header {
    margin-top: 4px;
    /* margin-bottom: 12px; */
    font-size: 24px ;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #121212;
    border-bottom: 1px solid #eaeef2;
    padding-bottom: 16px;
}

/* reservation message */
.cart-drawer-reservation-message {
    background: #fef6e6;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 24px;
    color: #a56500;
    font-weight: 500;
    font-size: 16px ;
    border-left: 4px solid #f9b81b;
}

/* --- product list --- */
.cart-drawer-items {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e1e2e4;
    border-radius: 10px;
    flex: 1;
    overflow-y: auto;          /* smoother */
    overscroll-behavior: contain;


        overflow-y: auto;
    max-height: 100%;
    min-height: 0;
    /* background-color: rgb(228, 250, 200); */
    /* margin-bottom: 24px; */
}

/* product row = two columns */
.cart-drawer-product-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 14px;
    align-items: start;
    border-bottom: 1px dashed #c1c2c4;
    padding-bottom: 12px;
    position: relative;
}

/* Book cover */
.cart-drawer-book-cover {
    width: 90px;
    height: 120px;
    background: #e1dcd2;
    /* border-radius: 10px; */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 50px;

}

.cart-drawer-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* fallback styling if no real image */
.cart-drawer-cover-placeholder {
    background: linear-gradient(145deg, #b7aa9a, #d6cbbc);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px ;
    font-weight: 600;
    color: #4a3f32;
}

/* right column details */
.cart-drawer-product-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    align-items: flex-start;
    /* gap: 6px; */
}

.cart-drawer-book-name {
    font-weight: 700;
    font-size: 20px ;
    color: #1c1c28;
    line-height: 1.3;
    padding-right: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    /* flex-grow: 1; */
    /* room for trash */
}

.cart-drawer-product-details-bottom-div{
    display: flex;
    flex-direction: row-reverse;
    width: 100%;
    justify-content: space-between;

}


/* quantity controls */
.cart-drawer-quantity-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-drawer-qty-btn {
    background: #f0f3f7;
    border: 1px solid #cfd9e2;
    width: 32px;
    height: 32px;
    border-radius: 30px;
    font-size: 20px ;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1e293b;
    transition: 0.1s;
    user-select: none;
}

.cart-drawer-qty-btn:hover {
    background: #e2e8f0;
    border-color: #9aa8b9;
}

.cart-drawer-qty-num {
    min-width: 22px;
    text-align: center;
    font-weight: 600;
    font-size: 16px ;
}

/* pricing */
.cart-drawer-price-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.cart-drawer-discounted-price {
    font-size: 20px ;
    font-weight: 700;
    color: #1e1e2f;
}

.cart-drawer-original-price {
    font-size: 16px ;
    color: #8b8f9c;
    text-decoration: line-through;
}

/* trash icon (delete) */
.cart-drawer-delete-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    font-size: 20px ;
    cursor: pointer;
    color: #8f98a3;
    margin-right: -2px;
    border-radius: 30px;
    transition: all 0.15s;
    line-height: 1;
     font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.cart-drawer-delete-btn:hover {
    color: #d32f2f;
    background: #fef0f0;
}

/* discount row */
.cart-drawer-discount-section {
    display: flex;
    gap: 10px;
    margin: 8px 0 16px;
}

.cart-drawer-discount-input {
    flex: 1;
    padding: 14px 16px;
    border: 1.5px solid #d8e0e8;
    border-radius: 60px;
    font-size: 16px ;
    outline: none;
    transition: 0.15s;
    background: white;
}

.cart-drawer-discount-input:focus {
    border-color: #1e1e2f;
}

.cart-drawer-apply-btn {
    background: #1e1e2f;
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 60px;
    font-weight: 600;
    font-size: 16px ;
    cursor: pointer;
    transition: 0.15s;
    white-space: nowrap;
    border: 1px solid #1e1e2f;
}

.cart-drawer-apply-btn:hover {
    background: #3b3b58;
}

/* totals */
.cart-drawer-totals {
    margin: 12px 0 24px;
}

.cart-drawer-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 24px;
    font-size: 16px ;
}

.cart-drawer-discount-amount {
    color: #0f7b4e;
    font-weight: 600;
}

.cart-drawer-subtotal-row {
    font-weight: 700;
    font-size: 22px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
    margin-top: 6px;
}

.cart-drawer-final-price {
    color: #121212;
}

/* checkout button */
.cart-drawer-checkout-btn {
    background: #1e1e2f;
    color: white;
    border: none;
    border-radius: 60px;
    padding: 18px 20px;
    font-weight: 700;
    font-size: 20px;
    cursor: pointer;
    width: 100%;

    transition: 0.2s;
    margin-bottom: 24px;
    border: 1px solid #1e1e2f;
}


.cart-drawer-checkout-btn:hover {
    background: #1b1ba0;
}

/* payment logos */
.cart-drawer-payment-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 24px;
}

.cart-drawer .payment-icon {
    background: #f4f6fa;
    padding: 8px 14px;
    border-radius: 50px;
    font-weight: 600;
    color: #1f2a44;
    font-size: 16px ;
    letter-spacing: 0.5px;
    border: 1px solid #e0e7ef;
}





.cart-drawer-continue-btn {
    background: transparent;
    border: 1.5px solid #cad1db;
    border-radius: 60px;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 17px;
    color: #7e8082;
    cursor: pointer;
    transition: 0.15s;
    margin-bottom: 10px;
    width: 100%;

}

.cart-drawer-continue-btn:hover {
    background: #f0f4f9;
    border-color: #c0c0c0;
}



/* responsive: under 500px -> full width */
@media (max-width: 500px) {
    .cart-drawer {
        max-width: 100%;
    }

    .cart-drawer-content {
        padding: 12px;
    }

    .cart-drawer-product-row {
        grid-template-columns: 80px 1fr;
    }

    .cart-drawer-book-cover {
        width: 80px;
        height: 105px;
    }

    .cart-drawer-book-name {
        font-size: 1.2rem;
        -webkit-line-clamp: 3;

    }

}

/* small fix */
.cart-drawer-trigger:focus-visible,
.cart-drawer button:focus-visible {
    outline: 2px solid #2d2d44;
}

/* utility */
.cart-drawer-hidden {
    display: none;
}

/* @media (max-width: 600px){
    .cart-drawer{
        font-size: 80% !important;
    }
    .cart-drawer *{
        font-size: inherit;
    }
} */
