/* ============================================
   VEGAN WAVES — Cart Drawer & Cart UI
   ============================================ */

/* --- Cart Icon in Navbar --- */
.nav-cart-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
    transition: color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-cart-btn:hover {
    color: var(--accent);
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--accent);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: var(--font-body);
}

/* --- Cart Overlay --- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

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

/* --- Cart Drawer --- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--white);
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.1);
}

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

/* --- Drawer Header --- */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.cart-drawer-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.cart-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-close:hover {
    background: var(--bg-light);
    color: var(--text);
}

/* --- Drawer Body --- */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Loading */
.cart-drawer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 12px;
}

.drawer-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: drawer-spin 0.8s linear infinite;
}

@keyframes drawer-spin {
    to { transform: rotate(360deg); }
}

.cart-drawer-loading p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
}

/* Empty */
.cart-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 12px;
}

.drawer-empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.cart-drawer-empty p {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0;
}

/* --- Drawer Items --- */
.cart-drawer-items {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.drawer-item {
    display: grid;
    grid-template-columns: 72px 1fr 32px;
    gap: 14px;
    align-items: start;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.drawer-item:hover {
    background: var(--bg-light);
}

.drawer-item-image {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-light);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

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

.drawer-item-info {
    min-width: 0;
}

.drawer-item-info h4 {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 2px;
    line-height: 1.3;
}

.drawer-item-info h4 a {
    color: var(--text);
    text-decoration: none;
    transition: color var(--transition);
}

.drawer-item-info h4 a:hover {
    color: var(--accent);
}

.drawer-item-variant {
    font-size: 0.8rem;
    color: var(--text-light);
    display: block;
    margin-bottom: 10px;
}

.drawer-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer-qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.drawer-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--white);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    padding: 0;
    line-height: 1;
}

.drawer-qty-btn:hover:not(:disabled) {
    background: var(--bg-light);
}

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

.drawer-qty-value {
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--white);
}

.drawer-item-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.drawer-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-light);
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    flex-shrink: 0;
    margin-top: 2px;
}

.drawer-item-remove:hover {
    color: #E53E3E;
    background: #FFF5F5;
    opacity: 1;
}

/* --- Drawer Footer --- */
.cart-drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--white);
}

.drawer-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.drawer-subtotal span:first-child {
    font-size: 0.95rem;
    color: var(--text-light);
}

.drawer-subtotal-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.drawer-shipping-note {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0 0 16px;
}

.drawer-checkout-btn {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
    padding: 14px 24px;
}

.drawer-continue-btn {
    width: 100%;
    text-align: center;
    padding: 10px 24px;
    font-size: 0.85rem;
}

/* --- Toast Notification --- */
.cart-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--text);
    color: var(--white);
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-body);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

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

.cart-toast.success {
    background: var(--accent);
}

.cart-toast.error {
    background: #E53E3E;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    .drawer-item {
        padding: 14px 16px;
    }

    .cart-drawer-header {
        padding: 16px;
    }

    .cart-drawer-footer {
        padding: 16px;
    }

    .cart-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
    }
}
