/* ==========================================================================
   BAM Mini Cart Drawer — Dark Glassmorphism
   ========================================================================== */

/* --- Overlay backdrop --- */
.bam-cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.bam-cart-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* --- Drawer panel --- */
.bam-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
    background: #0a0a0a;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.bam-cart-drawer.is-open {
    transform: translateX(0);
}

/* --- Header --- */
.bam-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.bam-cart-title {
    font-family: var(--font-display, 'Inter', sans-serif);
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.bam-cart-title .count {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 91, 255, 0.2);
    color: #a5b4fc;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}
.bam-cart-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.125rem;
    line-height: 1;
}
.bam-cart-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* --- Body (scrollable items) --- */
.bam-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.bam-cart-body::-webkit-scrollbar {
    width: 4px;
}
.bam-cart-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* --- Empty state --- */
.bam-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #6b7280;
    gap: 1rem;
    padding: 2rem;
}
.bam-cart-empty svg {
    width: 3rem;
    height: 3rem;
    opacity: 0.4;
}
.bam-cart-empty p {
    font-size: 0.875rem;
}
.bam-cart-empty a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
}
.bam-cart-empty a:hover {
    color: #a5b4fc;
}

/* --- Cart Item --- */
.bam-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.75rem;
    transition: background 0.2s ease;
    position: relative;
}
.bam-cart-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.bam-cart-item-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, rgba(99,91,255,0.15), rgba(0,229,255,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.bam-cart-item-info {
    flex: 1;
    min-width: 0;
}
.bam-cart-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0 0 0.25rem;
    line-height: 1.4;
}
.bam-cart-item-price {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-weight: 500;
}
.bam-cart-item-remove {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    opacity: 0;
}
.bam-cart-item:hover .bam-cart-item-remove {
    opacity: 1;
}
.bam-cart-item-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* --- Footer --- */
.bam-cart-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
}
.bam-cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.bam-cart-total-label {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}
.bam-cart-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-display, 'Inter', sans-serif);
}
.bam-cart-checkout-btn {
    display: block;
    width: 100%;
    padding: 0.875rem;
    background: #625BFF;
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: var(--font-display, 'Inter', sans-serif);
    box-shadow: 0 0 20px rgba(98, 91, 255, 0.2);
}
.bam-cart-checkout-btn:hover {
    background: #5046e5;
    box-shadow: 0 0 30px rgba(98, 91, 255, 0.3);
    transform: translateY(-1px);
}
.bam-cart-continue {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}
.bam-cart-continue:hover {
    color: #a5b4fc;
}

/* --- Header Cart Icon (in nav) --- */
.bam-nav-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
}
.bam-nav-cart:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.bam-nav-cart svg {
    width: 1.25rem;
    height: 1.25rem;
}
.bam-nav-cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    background: #625BFF;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
    border: 2px solid #0a0a0a;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bam-nav-cart-badge:empty,
.bam-nav-cart-badge[data-count="0"] {
    display: none;
}
.bam-nav-cart-badge.bump {
    transform: scale(1.3);
}

/* --- "Thêm vào giỏ" Button on Course Pages --- */
.bam-add-to-cart-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: #a5b4fc;
    border: 1px solid rgba(99, 91, 255, 0.3);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-family: var(--font-display, 'Inter', sans-serif);
    margin-top: 0.5rem;
}
.bam-add-to-cart-btn:hover {
    background: rgba(99, 91, 255, 0.1);
    border-color: rgba(99, 91, 255, 0.5);
    color: #c7d2fe;
}
.bam-add-to-cart-btn.is-loading {
    pointer-events: none;
    opacity: 0.6;
}
.bam-add-to-cart-btn.is-added {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.05);
}

/* --- Mobile --- */
@media (max-width: 640px) {
    .bam-cart-drawer {
        max-width: 100%;
    }
}
