/* ==========================================================================
   Modern Off-Canvas Cart Drawer Styles
   ========================================================================== */

/* Prevent body scrolling when drawer is open */
body.cart-drawer-active {
    overflow: hidden !important;
}

/* 1. Backdrop Overlay */
#cart-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(13, 13, 13, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#cart-drawer-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* 2. Main Off-Canvas Drawer Container */
#cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 95vw;
    height: 100vh;
    background: #ffffff;
    z-index: 99995;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Responsive Width Adjustments */
@media (max-width: 768px) {
    #cart-drawer {
        width: 380px;
    }
}

@media (max-width: 576px) {
    #cart-drawer {
        width: 100vw;
        max-width: 100vw;
    }
}

/* 3. Drawer Header */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.cart-drawer-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111111;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cart-drawer-title i {
    color: var(--bs-primary, #f1c152);
}

.cart-drawer-close {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cart-drawer-close:hover {
    background: #0d0d0d;
    color: #ffffff;
    border-color: #0d0d0d;
    transform: rotate(90deg);
}

/* 4. Drawer Body (Scrollable) */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    position: relative;
}

/* Custom Scrollbar for Drawer Body */
.cart-drawer-body::-webkit-scrollbar {
    width: 5px;
}
.cart-drawer-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}
.cart-drawer-body::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

/* 5. Cart Item Layout */
.cart-drawer-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px dashed #e9ecef;
    transition: all 0.3s ease;
    position: relative;
}

.cart-drawer-item:last-child {
    border-bottom: none;
}

.cart-drawer-item.item-removing {
    opacity: 0;
    transform: translateX(40px);
    max-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.cart-drawer-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #e9ecef;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

.cart-drawer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-drawer-item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111111;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.cart-drawer-item-title:hover {
    color: var(--bs-primary, #f1c152);
}

.cart-drawer-item-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

.cart-drawer-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

/* Quantity Control Buttons */
.cart-drawer-qty-wrap {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    height: 30px;
}

.cart-drawer-qty-btn {
    background: #f8f9fa;
    border: none;
    width: 28px;
    height: 100%;
    font-weight: 700;
    font-size: 13px;
    color: #333333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.cart-drawer-qty-btn:hover {
    background: #e9ecef;
}

.cart-drawer-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cart-drawer-qty-val {
    width: 32px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: #111111;
}

.cart-drawer-item-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bs-primary, #f1c152);
}

.cart-drawer-btn-remove {
    background: transparent;
    border: none;
    color: #adb5bd;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.cart-drawer-btn-remove:hover {
    color: #dc3545;
}

/* 6. Empty Cart View */
.cart-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 40px 20px;
}

.cart-drawer-empty-icon {
    width: 90px;
    height: 90px;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: #adb5bd;
    font-size: 38px;
    border: 2px dashed #dee2e6;
}

.cart-drawer-empty-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
}

.cart-drawer-empty-text {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* 7. Drawer Footer */
.cart-drawer-footer {
    padding: 20px 24px;
    background: #fdfdfd;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.03);
}

.cart-drawer-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #6c757d;
}

.cart-drawer-summary-row.total-row {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111111;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.cart-drawer-summary-row.total-row .total-amount {
    color: var(--bs-primary, #f1c152);
    font-size: 1.3rem;
}

.cart-drawer-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-drawer-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.cart-drawer-btn-primary {
    background: var(--bs-primary, #f1c152);
    color: #0d0d0d;
}

.cart-drawer-btn-primary:hover {
    background: #0d0d0d;
    color: #ffffff;
}

.cart-drawer-btn-outline {
    background: transparent;
    border: 1px solid #ced4da;
    color: #212529;
}

.cart-drawer-btn-outline:hover {
    background: #f8f9fa;
    border-color: #0d0d0d;
    color: #0d0d0d;
}

.cart-drawer-btn-link {
    background: transparent;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 6px;
}

.cart-drawer-btn-link:hover {
    color: #0d0d0d;
    text-decoration: underline;
}

/* 8. Loader & Spinner */
.cart-drawer-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

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

/* 9. Inline Drawer Toast Notification */
.cart-drawer-toast {
    position: absolute;
    top: 15px;
    left: 20px;
    right: 20px;
    z-index: 20;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.cart-drawer-toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer-toast-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.cart-drawer-toast-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}
