/*
 * VEAN — Add-to-cart confirmation toast
 *
 * Mobile (<768px): bottom sheet that slides up from the bottom of the
 * viewport, with a drag handle and swipe-to-dismiss support.
 * Desktop (≥768px): centered modal that fades + scales in.
 *
 * Pure CSS / vanilla JS — no jQuery, no Bootstrap modal dependency.
 * The container <div id="blockcart-modal"> is reused as the inert
 * mounting point; the JS injects the .cart-toast-backdrop inside.
 */

:root {
    --cart-toast-bg: #ffffff;
    --cart-toast-text: #1a1a1a;
    --cart-toast-muted: #6b6b6b;
    --cart-toast-border: #e5e5e5;
    --cart-toast-soft: #f5f5f5;
    --cart-toast-success: #1ca25a;
    --cart-toast-primary: #ff8e4f;
    --cart-toast-primary-dark: #ec7330;
    --cart-toast-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
}

/* ---------------------------------------------------------------------- */
/* Backdrop                                                                */
/* ---------------------------------------------------------------------- */

.cart-toast-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease-out;
}
.cart-toast-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---------------------------------------------------------------------- */
/* Sheet / modal                                                           */
/* ---------------------------------------------------------------------- */

.cart-toast {
    background: var(--cart-toast-bg);
    color: var(--cart-toast-text);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    box-shadow: var(--cart-toast-shadow);
    padding: 8px 20px 24px;
    transform: translateY(100%);
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    /* JS sets this dynamically while user is dragging the sheet down. */
    --cart-toast-drag-y: 0px;
}
.cart-toast-backdrop.is-visible .cart-toast {
    transform: translateY(var(--cart-toast-drag-y));
}

@media (min-width: 768px) {
    .cart-toast-backdrop {
        align-items: center;
    }
    .cart-toast {
        max-width: 500px;
        border-radius: 16px;
        padding: 24px 24px 20px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
        transform: translateY(12px) scale(0.98);
        opacity: 0;
        transition: transform 220ms ease-out, opacity 220ms ease-out;
    }
    .cart-toast-backdrop.is-visible .cart-toast {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ---------------------------------------------------------------------- */
/* Drag handle (mobile only — visual cue for swipe-down to dismiss)        */
/* ---------------------------------------------------------------------- */

.cart-toast-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #d4d4d4;
    margin: 0 auto 16px;
    cursor: grab;
}
@media (min-width: 768px) {
    .cart-toast-handle {
        display: none;
    }
}

/* ---------------------------------------------------------------------- */
/* Close (X) button — top right                                            */
/* ---------------------------------------------------------------------- */

.cart-toast-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--cart-toast-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 120ms ease-out, color 120ms ease-out;
}
.cart-toast-close:hover {
    background: var(--cart-toast-soft);
    color: var(--cart-toast-text);
}

/* ---------------------------------------------------------------------- */
/* Header — green check + title                                            */
/* ---------------------------------------------------------------------- */

.cart-toast-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.cart-toast-check {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cart-toast-success);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-toast-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cart-toast-text);
    line-height: 1.2;
}

/* ---------------------------------------------------------------------- */
/* Product mini-card                                                       */
/* ---------------------------------------------------------------------- */

.cart-toast-product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--cart-toast-soft);
    border-radius: 12px;
    margin-bottom: 16px;
}

.cart-toast-product-image {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 8px;
}

.cart-toast-product-info {
    flex: 1 1 auto;
    min-width: 0;
}

.cart-toast-product-name {
    margin: 0 0 4px 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--cart-toast-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-toast-product-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--cart-toast-muted);
}

.cart-toast-product-meta strong {
    color: var(--cart-toast-text);
    font-weight: 700;
}

/* Desktop: larger product image + roomier mini-card. The 64px image
   reads as cramped on desktop where there is ample space; scaling it
   to 104px makes the just-added product the clear focal point and
   restores the visual weight of the legacy modal. Mobile keeps the
   compact 64px so the bottom sheet stays light. */
@media (min-width: 768px) {
    .cart-toast-product {
        gap: 18px;
        padding: 16px;
    }
    .cart-toast-product-image {
        flex: 0 0 104px;
        width: 104px;
        height: 104px;
        border-radius: 10px;
    }
    .cart-toast-product-name {
        font-size: 1rem;
    }
    .cart-toast-product-meta {
        font-size: 0.9rem;
    }
}

/* ---------------------------------------------------------------------- */
/* Cart summary line                                                       */
/* ---------------------------------------------------------------------- */

.cart-toast-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 4px;
    margin-bottom: 16px;
    border-top: 1px solid var(--cart-toast-border);
    border-bottom: 1px solid var(--cart-toast-border);
}

.cart-toast-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.cart-toast-summary-total-row {
    padding-top: 6px;
    border-top: 1px solid var(--cart-toast-border);
}

.cart-toast-summary-label {
    font-size: 0.9rem;
    color: var(--cart-toast-muted);
}

.cart-toast-summary-value {
    font-size: 0.9rem;
    color: var(--cart-toast-text);
}

.cart-toast-summary-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cart-toast-text);
}

/* ---------------------------------------------------------------------- */
/* Action buttons                                                          */
/* ---------------------------------------------------------------------- */

.cart-toast-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 480px) {
    .cart-toast-actions {
        flex-direction: row-reverse;
        gap: 10px;
    }
}

.cart-toast-btn {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 120ms ease-out, color 120ms ease-out;
}
.cart-toast-btn:hover { text-decoration: none; }

.cart-toast-btn-primary {
    background: var(--cart-toast-primary);
    color: #ffffff;
}
/* color !important + the leading `a.` bump specificity over the global
   `a:hover { color: #EC7330 }` from custom.css that otherwise turns the
   button text orange — invisible on the orange background. */
a.cart-toast-btn-primary:hover,
.cart-toast-btn-primary:hover {
    background: var(--cart-toast-primary-dark);
    color: #ffffff !important;
}

.cart-toast-btn-secondary {
    background: var(--cart-toast-soft);
    color: var(--cart-toast-text);
}
.cart-toast-btn-secondary:hover {
    background: #ebebeb;
    color: var(--cart-toast-text);
}

/* ---------------------------------------------------------------------- */
/* Body scroll lock when toast is open                                     */
/* ---------------------------------------------------------------------- */

body.cart-toast-open {
    overflow: hidden;
}
