/* Body Scroll Lock - Mobile & Desktop Robust */
body.cart-open {
    overflow: hidden !important;
    height: 100vh !important;
    width: 100% !important;
    position: fixed !important;
}

/* Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

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

/* Drawer Container */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px; /* Hidden initially */
    width: 420px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-drawer.open {
    right: 0;
}

#cartMainView, #checkoutView {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header (Fixed) */
.cart-header {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-cart {
    background: #f8fafc;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
}

.close-cart:hover {
    background: #ff2d8d;
    color: #fff;
}

/* Body (Scrollable) */
.cart-body {
    flex-grow: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal overflow */
    min-height: 0;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #ff2d8d #f1f5f9;
}

/* Ensure all children respect padding */
.cart-body > * {
    max-width: 100%;
}

/* Cart Item Layout */
.cart-item {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.cart-item img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: #f8fafc;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    padding-right: 20px;
}

.cart-item-info p {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ff2d8d;
    margin-bottom: 12px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8fafc;
    width: fit-content;
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.quantity-controls button {
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
}

.quantity-controls span {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    min-width: 20px;
    text-align: center;
}

.remove-item {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.remove-item:hover {
    color: #ef4444;
}

/* Footer (Fixed) */
.cart-footer {
    padding: 24px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.02);
    flex-shrink: 0;
    z-index: 10;
}

.checkout-sticky-footer {
    background: #fdfdfd;
    border-top: 1px solid #eee;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.btn-checkout {
    width: 100%;
    background: linear-gradient(135deg, #ff2d8d 0%, #ff5ca8 100%);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-checkout:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 45, 141, 0.3);
}

.btn-checkout:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Checkout Form Styles */
.btn-back-to-cart {
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #ff2d8d;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 45, 141, 0.1);
}

/* OTP Input Boxes */
.otp-inputs-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.otp-input {
    width: 40px;
    height: 50px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
}

.otp-input:focus {
    outline: none;
    border-color: #ff2d8d;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 45, 141, 0.1);
}

/* Success Popup */
.order-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-success-card {
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.4s ease;
}

.order-success-card.active {
    transform: translateY(0);
    opacity: 1;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #dcfce7;
    color: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 24px;
}

.btn-done {
    margin-top: 30px;
    background: #0f172a;
    color: #fff;
    border: none;
    padding: 12px 40px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 576px) {
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
}