/* Unified "Added to cart" confirmation popup.
   Top-right toast on desktop, bottom sheet on mobile.
   Selectors keep legacy hooks (.product-image-notification,
   .product-name-notification, .product-price-notification,
   .continue-shopping, .checkout-button-notification) so
   existing JS that targets #custom-notification keeps working. */

#custom-notification.custom-notification {
    position: fixed;
    z-index: 100000;
    display: none;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    padding: 24px 20px 20px;

    /* Desktop default: top-right toast */
    top: 88px;
    right: 20px;
    left: auto;
    bottom: auto;
    width: 420px;
    max-width: calc(100vw - 32px);

    /* Override legacy fixed-height / centered rules that may load
       on the same page (main_listing.css). */
    height: auto;
    border: none;
    font-family: inherit;
    color: #1a1a1a;
}

[dir="rtl"] #custom-notification.custom-notification {
    right: auto;
    left: 20px;
}

#custom-notification.custom-notification.show {
    display: block;
    animation: cn-slide-in-right 0.28s ease-out;
}

[dir="rtl"] #custom-notification.custom-notification.show {
    animation: cn-slide-in-left 0.28s ease-out;
}

@keyframes cn-slide-in-right {
    from { transform: translateX(calc(100% + 40px)); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes cn-slide-in-left {
    from { transform: translateX(calc(-100% - 40px)); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.custom-notification__drag {
    /* Bottom-sheet grab handle — only meaningful on mobile, hidden
       on desktop where the popup is a top-right toast. */
    display: none;
    width: 46px;
    height: 5px;
    background: #CFD6E3;
    border-radius: 3px;
    margin: 0 auto 16px;
}

.custom-notification__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: none;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #282A2E;
}

.custom-notification__close:hover {
    background: #f5f5f5;
}

[dir="rtl"] .custom-notification__close {
    right: auto;
    left: 14px;
}

#custom-notification.custom-notification .notification-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.custom-notification__body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    margin-top: 6px;
}

#custom-notification.custom-notification .product-image-notification {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
}

.custom-notification__details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center;
}

.custom-notification__header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-notification__check {
    display: inline-flex;
    flex-shrink: 0;
    line-height: 0;
}

#custom-notification.custom-notification .notification-title {
    color: #FF3F98;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.2;
}

#custom-notification.custom-notification .product-name-notification {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: auto;
}

#custom-notification.custom-notification .product-price-notification {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

#custom-notification.custom-notification .product-price-notification:empty {
    display: none;
}

.custom-notification__actions,
#custom-notification.custom-notification .notification-actions {
    display: flex;
    gap: 12px;
    justify-content: stretch;
    align-items: center;
    margin: 0;
}

#custom-notification.custom-notification .continue-shopping,
#custom-notification.custom-notification .checkout-button-notification,
.custom-notification__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    width: auto;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
    white-space: nowrap;
}

#custom-notification.custom-notification .continue-shopping,
.custom-notification__btn--secondary {
    background: #fff;
    color: #FF3F98;
    border-color: #BFC3C9;
}

#custom-notification.custom-notification .continue-shopping:hover,
.custom-notification__btn--secondary:hover {
    background: #fafafa;
    color: #FF3F98;
}

#custom-notification.custom-notification .checkout-button-notification,
.custom-notification__btn--primary {
    background: #FF3F98;
    color: #fff;
    border-color: #FF3F98;
}

#custom-notification.custom-notification .checkout-button-notification:hover,
.custom-notification__btn--primary:hover {
    background: #e62f87;
    border-color: #e62f87;
    color: #fff;
}

/* Mobile: bottom sheet */
@media (max-width: 600px) {
    #custom-notification.custom-notification {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 14px 16px 24px;
    }

    [dir="rtl"] #custom-notification.custom-notification {
        left: 0;
        right: 0;
    }

    #custom-notification.custom-notification.show,
    [dir="rtl"] #custom-notification.custom-notification.show {
        animation: cn-slide-up 0.28s ease-out;
    }

    @keyframes cn-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Re-show the grab-handle on the bottom-sheet variant. */
    #custom-notification.custom-notification .custom-notification__drag {
        display: block;
    }

    #custom-notification.custom-notification .product-image-notification {
        width: 140px;
        height: 140px;
    }

    #custom-notification.custom-notification .product-name-notification {
        font-size: 17px;
        -webkit-line-clamp: 4;
    }

    #custom-notification.custom-notification .continue-shopping,
    #custom-notification.custom-notification .checkout-button-notification,
    .custom-notification__btn {
        height: 48px;
        font-size: 14px;
    }
}
