/* Toast „produs adăugat în coș" cu CTA — vezi class-add-to-cart-toast.php. */

/* Ascunde mesajul simplu al temei DOAR la succes; îl înlocuim cu toastul
   nostru, care are butoane. Mesajul de eroare al temei (.show.error) rămâne. */
#ts-ajax-add-to-cart-message.show:not(.error) {
    display: none !important;
}

.avatex-atc-toast {
    position: fixed;
    /* Valoare de rezervă: JS-ul scrie `top` inline — pe desktop la marginea de
       sus (peste antet), pe mobil sub antet. Vezi positionToast(). */
    top: 20px;

    /* Deplasarea pe X trăiește într-o variabilă pentru că `transform` e folosit
       și de animația de intrare: fără ea, fiecare stare (repaus, vizibil,
       reduced-motion) ar trebui să repete valoarea, iar o singură omisiune ar
       arunca toastul din poziție. */
    --atc-x: -50%;
    left: 50%;
    right: auto;
    transform: translateX(var(--atc-x)) translateY(-16px);
    z-index: 100000;
    width: min(430px, calc(100vw - 24px));
    box-sizing: border-box;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.18);
    padding: 16px 18px 15px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* hidden (atribut) = ascuns complet cât timp toastul nu e activ. */
.avatex-atc-toast[hidden] {
    display: none;
}

.avatex-atc-toast.is-visible {
    opacity: 1;
    transform: translateX(var(--atc-x)) translateY(0);
    pointer-events: auto;
}

/* Pe desktop toastul se mută în colțul din dreapta sus, sub iconița coșului.
   Centrat pe ecran lat arăta ca o fereastră de dialog apărută în mijlocul
   paginii, adică ceva ce trebuie rezolvat, nu o confirmare.

   `right` urmărește gutter-ul antetului temei (măsurat: 100px la 1600px
   lățime, 150px peste 1800px), ca toastul să cadă sub iconița coșului, nu
   lipit de marginea ferestrei. clamp() ține capetele: minim 20px pe ecrane
   mici de desktop, maxim 150px, cât e gutter-ul la lățime mare. */
@media (min-width: 601px) {
    .avatex-atc-toast {
        --atc-x: 0;
        left: auto;
        right: clamp(20px, calc((100vw - 1200px) / 2), 150px);
    }
}

.avatex-atc-toast__close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9a9a9f;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.avatex-atc-toast__close:hover {
    color: #1a1a1a;
    background: #f2f2f4;
}

.avatex-atc-toast__body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 22px; /* loc pentru butonul de închidere */
}

.avatex-atc-toast__icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e8f7ee;
    color: #1f9d55;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatex-atc-toast__icon[hidden] {
    display: none;
}

/* Miniatura produsului (ca pe eMAG), când o găsim în pagină. */
.avatex-atc-toast__thumb {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f7;
    border: 1px solid #ececf0;
}

.avatex-atc-toast__thumb[hidden] {
    display: none;
}

.avatex-atc-toast__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.avatex-atc-toast__title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.avatex-atc-toast__name {
    font-size: 13px;
    color: #6b6b70;
    line-height: 1.35;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Progresul spre transport gratuit, oglindit din sertarul lateral.
   JS-ul îl ascunde când sertarul nu e activ sau nu are date. */
.avatex-atc-toast__ship {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.avatex-atc-toast__ship[hidden] {
    display: none;
}

.avatex-atc-toast__ship-text {
    font-size: 12.5px;
    line-height: 1.35;
    color: #6b6b70;
}

.avatex-atc-toast__ship.is-free .avatex-atc-toast__ship-text {
    color: #1f9d55;
    font-weight: 600;
}

.avatex-atc-toast__ship-track {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: #ececf0;
    overflow: hidden;
}

.avatex-atc-toast__ship-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: #1a1a1a;
    transition: width 0.3s ease;
}

.avatex-atc-toast__ship.is-free .avatex-atc-toast__ship-fill {
    background: #1f9d55;
}

.avatex-atc-toast__actions {
    display: flex;
    gap: 10px;
}

.avatex-atc-toast__btn {
    flex: 1;
    text-align: center;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease;
}

.avatex-atc-toast__btn--cart {
    background: #f2f2f4;
    color: #1a1a1a;
}

.avatex-atc-toast__btn--cart:hover {
    background: #e6e6ea;
    color: #1a1a1a;
}

.avatex-atc-toast__btn--checkout {
    background: #202020;
    color: #fff;
}

.avatex-atc-toast__btn--checkout:hover {
    background: #000;
    color: #fff;
}

@media (max-width: 600px) {
    .avatex-atc-toast {
        top: 12px;
        border-radius: 12px;
        padding: 14px 15px 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .avatex-atc-toast {
        transition: opacity 0.15s ease;
        transform: translateX(var(--atc-x)) translateY(0);
    }
    .avatex-atc-toast.is-visible {
        transform: translateX(var(--atc-x)) translateY(0);
    }
}
