/* Backdrop overlay */
.campusx-cart-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(12, 46, 96, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.campusx-cart-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Slide-over Drawer Container */
.campusx-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    width: 420px;
    max-width: 92vw;
    background: #ffffff;
    z-index: 10450;
    box-shadow: -10px 0 35px rgba(12, 46, 96, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.campusx-cart-drawer.active {
    transform: translateX(0);
}

/* Header */
.campusx-cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.campusx-cart-header h5 {
    font-size: 17px;
    font-weight: 800;
    color: #0c2e60;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.campusx-cart-close {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.campusx-cart-close:hover {
    background: #e2e8f0;
    color: #0c2e60;
}

/* Body / Items list scrollable sur tablettes et desktop */
.campusx-cart-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 20px 24px;
    background: #f8fafc;
}

/* Scrollbars personnalisées */
.campusx-cart-body::-webkit-scrollbar {
    width: 6px;
}
.campusx-cart-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.campusx-cart-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.campusx-cart-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.campusx-cart-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.campusx-cart-item:hover {
    box-shadow: 0 4px 12px rgba(12, 46, 96, 0.05);
}
.campusx-cart-thumb {
    width: 56px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    flex-shrink: 0;
}
.campusx-cart-info {
    flex: 1;
    min-width: 0;
}
.campusx-cart-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0c2e60;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.campusx-cart-meta {
    font-size: 11.5px;
    color: #64748b;
    margin-bottom: 4px;
}
.campusx-cart-price {
    font-size: 14px;
    font-weight: 800;
    color: #059669;
}
.campusx-cart-remove-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 15px;
}
.campusx-cart-remove-btn:hover {
    color: #ee390f;
    background: #fef2f2;
}

/* Empty State */
.campusx-cart-empty {
    text-align: center;
    padding: 60px 20px;
}
.campusx-cart-empty-icon {
    width: 72px;
    height: 72px;
    background: #eff6ff;
    color: #0c2e60;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

/* Footer */
.campusx-cart-footer {
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 10px)) 20px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 14px rgba(12, 46, 96, 0.05);
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}
.campusx-cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.campusx-cart-total-label {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
}
.campusx-cart-total-value {
    font-size: 20px;
    font-weight: 800;
    color: #0c2e60;
}
.campusx-cart-checkout-btn {
    background: linear-gradient(135deg, #ee390f 0%, #ea580c 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 50px;
    padding: 13px 20px;
    font-weight: 800;
    font-size: 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(238, 57, 15, 0.25);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
}
.campusx-cart-checkout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(238, 57, 15, 0.35);
}
.campusx-cart-clear-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    padding: 6px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    margin-top: 8px;
    transition: color 0.2s;
}
.campusx-cart-clear-btn:hover {
    color: #ee390f;
    text-decoration: underline;
}

/* Animations for toast alerts */
.campusx-cart-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0c2e60;
    color: #ffffff;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(12, 46, 96, 0.35);
    z-index: 10500;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    font-weight: 700;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.campusx-cart-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 575.98px) {
    .campusx-cart-drawer {
        width: 100vw;
        max-width: 100vw;
    }
}

/* Optimisations tablettes et hauteurs réduites */
@media (max-height: 768px) {
    .campusx-cart-header {
        padding: 14px 18px;
    }
    .campusx-cart-body {
        padding: 14px 18px;
    }
    .campusx-cart-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    .campusx-cart-footer {
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 10px)) 18px;
    }
}

@media (pointer: coarse) {
    .campusx-cart-body {
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
}
