/* ==========================================================================
   Right-Side Slide-in Cart Drawer - Madras Grandma
   ========================================================================== */

/* Hide legacy template dropdown cart so right-side drawer takes over smoothly */
.cart-menu,
.cart-menu-one,
.cart-menu-two {
    display: none !important;
}

/* Overlay Backdrop */
.cart-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.35s;
}

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

/* Side Cart Drawer */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 999999;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-sizing: border-box;
}

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

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

.cart-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-family: var(--title-font, 'Quicksand', sans-serif);
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
}

.cart-drawer-title i {
    color: #e0ab61;
    font-size: 20px;
}

.cart-drawer-count {
    background: #e0ab61;
    color: #301601;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    margin-left: 6px;
}

.cart-drawer-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.25s ease;
}

.cart-drawer-close:hover {
    background: rgba(224, 171, 97, 0.25);
    color: #e0ab61;
    transform: rotate(90deg);
}

/* Drawer Body */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom Slim Scrollbar */
.cart-drawer-body::-webkit-scrollbar {
    width: 6px;
}

.cart-drawer-body::-webkit-scrollbar-track {
    background: #f8f6f3;
}

.cart-drawer-body::-webkit-scrollbar-thumb {
    background: #d4c5b3;
    border-radius: 10px;
}

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

.cart-empty-state i.empty-icon {
    font-size: 54px;
    color: #d6b98a;
    margin-bottom: 16px;
}

.cart-empty-state h4 {
    font-size: 18px;
    font-weight: 700;
    color: #3b1805;
    margin-bottom: 8px;
}

.cart-empty-state p {
    font-size: 14px;
    color: #777;
    margin-bottom: 22px;
}

.cart-empty-state .shop-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #301601;
    color: #e0ab61;
    border: 1px solid #e0ab61;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cart-empty-state .shop-btn:hover {
    background: #e0ab61;
    color: #301601;
    box-shadow: 0 4px 14px rgba(224, 171, 97, 0.4);
}

/* Cart Item Card */
.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #fdfbf8;
    border: 1px solid #ece4d8;
    border-radius: 12px;
    position: relative;
    transition: all 0.25s ease;
}

.cart-item:hover {
    border-color: #d6b98a;
    box-shadow: 0 4px 12px rgba(59, 24, 5, 0.06);
}

.cart-item-image {
    width: 68px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: #f4eadf;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cart-item-details {
    flex: 1;
    min-width: 0;
    padding-right: 28px;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #301601;
    margin: 0 0 4px 0;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #ce7b14;
    margin: 0 0 8px 0;
}

/* Quantity Control Buttons */
.cart-item-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d4c5b3;
    border-radius: 20px;
    background: #ffffff;
    overflow: hidden;
}

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

.cart-qty-btn:hover {
    background: #e0ab61;
    color: #ffffff;
}

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

/* Remove Item Button */
.cart-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #bfa895;
    font-size: 14px;
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cart-item-remove:hover {
    color: #e53935;
    background: #ffebee;
}

/* Drawer Footer */
.cart-drawer-footer {
    padding: 20px 24px;
    background: #fdfbf8;
    border-top: 1px solid #ece4d8;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-subtotal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-subtotal-label {
    font-size: 15px;
    font-weight: 600;
    color: #555555;
}

.cart-subtotal-value {
    font-size: 20px;
    font-weight: 800;
    color: #301601;
    font-family: var(--title-font, 'Quicksand', sans-serif);
}

.cart-shipping-badge {
    font-size: 12px;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* WhatsApp Order Button */
.btn-whatsapp-order {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    background: #25d366;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 700;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
    transition: all 0.3s ease;
}

.btn-whatsapp-order:hover {
    background: #1ebc57;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 211, 102, 0.45);
    color: #ffffff !important;
}

.btn-whatsapp-order i {
    font-size: 20px;
}

.cart-drawer-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

.cart-drawer-links a {
    font-size: 13px;
    font-weight: 600;
    color: #6b4426;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.cart-drawer-links a:hover {
    color: #ce7b14;
}

.cart-drawer-links .clear-cart-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.cart-drawer-links .clear-cart-btn:hover {
    color: #e53935;
}

/* Header Cart Badge Pulse Effect */
.shopping-cart span.badge-pulse {
    animation: badgePop 0.35s ease;
}

@keyframes badgePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Added to cart toast notification */
.cart-toast {
    position: fixed;
    bottom: 25px;
    left: 25px;
    background: #301601;
    color: #ffffff;
    border-left: 4px solid #25d366;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.cart-toast i {
    color: #25d366;
    font-size: 18px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw;
    }
    .cart-drawer-header {
        padding: 16px 20px;
    }
    .cart-drawer-body {
        padding: 16px;
    }
    .cart-drawer-footer {
        padding: 16px 20px;
    }
}
