/*
 * Sali messages: page toasts, listing option hint, cart stock notice.
 * Plain CSS on purpose: the theme's SCSS sources are not in this repository.
 * Tokens follow main.css: purple #7d2b94, red #DB0C1D, text #333333, Montserrat,
 * square corners, shadow 0 4px 20px rgba(0, 0, 0, .25).
 */

/* ---------- Page toasts (every page except cart and checkout) ---------- */

.page.messages.sali-toasts {
    position: fixed;
    /* Top centre: the minicart opens top right after an add, the chat button sits bottom right. */
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: 380px;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.page.messages.sali-toasts .messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page.messages.sali-toasts .message {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 16px 44px 16px 16px;
    background: #ffffff;
    border: 0;
    border-left: 4px solid #7d2b94;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
    color: #333333;
    font-family: "montserrat-medium", "montserrat-arm-medium", sans-serif;
    font-size: 14px;
    line-height: 20px;
    pointer-events: auto;
    animation: sali-toast-in .25s ease-out;
}

.page.messages.sali-toasts .message.is-leaving {
    animation: sali-toast-out .25s ease-in forwards;
}

/* Luma draws the icon on the first child; the toast draws its own on the message. */
.page.messages.sali-toasts .message > *:first-child:before {
    display: none;
}

.page.messages.sali-toasts .message:before {
    content: "i";
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #7d2b94;
    color: #ffffff;
    font-family: "montserrat-bold", "montserrat-arm-bold", sans-serif;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
}

.page.messages.sali-toasts .message-success:before {
    content: "\2713";
}

.page.messages.sali-toasts .message-error {
    border-left-color: #DB0C1D;
}

.page.messages.sali-toasts .message-error:before {
    content: "!";
    background: #DB0C1D;
}

.page.messages.sali-toasts .message-warning,
.page.messages.sali-toasts .message-notice {
    border-left-color: #7d2b94;
}

.page.messages.sali-toasts .message-warning:before,
.page.messages.sali-toasts .message-notice:before {
    content: "!";
}

.page.messages.sali-toasts .message > div {
    flex: 1 1 auto;
    padding: 2px 0 0;
}

.page.messages.sali-toasts .message a {
    color: #7d2b94;
    font-family: "montserrat-bold", "montserrat-arm-bold", sans-serif;
    text-decoration: underline;
}

.sali-toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.sali-toast-close:before,
.sali-toast-close:after {
    content: "";
    position: absolute;
    top: 11px;
    left: 5px;
    width: 14px;
    height: 2px;
    background: #999999;
    transform: rotate(45deg);
}

.sali-toast-close:after {
    transform: rotate(-45deg);
}

.sali-toast-close:hover:before,
.sali-toast-close:hover:after {
    background: #333333;
}

.sali-toast-close:focus-visible {
    outline: 2px solid #7d2b94;
    outline-offset: 2px;
}

@keyframes sali-toast-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: none; }
}

@keyframes sali-toast-out {
    to { opacity: 0; transform: translateY(-12px); }
}

@media (max-width: 767px) {
    .page.messages.sali-toasts {
        top: 16px;
        right: 16px;
        left: 16px;
        transform: none;
        width: auto;
        max-width: none;
    }
}

/* ---------- Listing: a swatch left unchosen ---------- */

.product-item .swatch-attribute.sali-option-missing .swatch-option {
    border-color: #DB0C1D;
    outline: 1px solid #DB0C1D;
    outline-offset: -1px;
}

.product-item .swatch-attribute.sali-option-missing {
    animation: sali-shake .35s ease-in-out;
}

.product-item .sali-option-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 8px;
    color: #DB0C1D;
    font-family: "montserrat-medium", "montserrat-arm-medium", sans-serif;
    font-size: 12px;
    line-height: 16px;
}

.product-item .sali-option-hint:before {
    content: "!";
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #DB0C1D;
    color: #ffffff;
    font-family: "montserrat-bold", "montserrat-arm-bold", sans-serif;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
}

@keyframes sali-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* ---------- Cart: an item that can no longer be bought ---------- */

.sali-stock-notice {
    margin: 16px 0 0;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #DB0C1D;
    color: #333333;
    font-family: "montserrat-regular", "montserrat-arm-regular", sans-serif;
    font-size: 14px;
    line-height: 20px;
}

.sali-stock-notice__title {
    display: block;
    margin: 0 0 6px;
    color: #DB0C1D;
    font-family: "montserrat-bold", "montserrat-arm-bold", sans-serif;
    font-size: 14px;
}

.sali-stock-notice__action {
    display: block;
    width: 100%;
    margin: 12px 0 0;
    padding: 12px 16px;
    background: #7d2b94;
    border: 1px solid #7d2b94;
    border-radius: 0;
    color: #ffffff;
    font-family: "montserrat-bold", "montserrat-arm-bold", sans-serif;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
}

.sali-stock-notice__action:hover,
.sali-stock-notice__action:focus {
    background: #ffffff;
    color: #7d2b94;
}

.cart.item.sali-item-out .item-info > td {
    background: #fdf2f3;
}

.cart.item.sali-item-out .item-info .product-item-photo {
    opacity: .55;
}

.cart.item.sali-item-out.sali-item-flash .item-info > td {
    animation: sali-row-flash 1.2s ease-out;
}

@keyframes sali-row-flash {
    0%, 40% { background: #f7d3d7; }
    100% { background: #fdf2f3; }
}

@media (prefers-reduced-motion: reduce) {
    .page.messages.sali-toasts .message,
    .page.messages.sali-toasts .message.is-leaving,
    .product-item .swatch-attribute.sali-option-missing,
    .cart.item.sali-item-out.sali-item-flash .item-info > td {
        animation: none;
    }
}
