/* ==========================================================================
   Toast bildirimleri
   Sepete ekleme gibi islemlerden sonra kisa sureli geri bildirim.
   Mobilde altta ortalanir, masaustunde sag altta durur.
   ========================================================================== */

.toast-region {
    position: fixed;
    z-index: 9500;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(100% - 1.5rem, 26rem);
    /* Bos haldeyken tiklamalari engellemesin. */
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    pointer-events: auto;
    /* Giris animasyonu */
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(0.5rem);
}

.toast__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-top: 0.1rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
}

.toast__icon svg {
    display: block;
    width: 15px;
    height: 15px;
}

.toast--error .toast__icon {
    background: #b91c1c;
}

.toast__body {
    flex: 1 1 auto;
    min-width: 0;
}

.toast__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
}

.toast__text {
    margin: 0.1rem 0 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--color-muted);
    /* Uzun urun adi tasmasin: en fazla 2 satir. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.toast__action {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.toast__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    margin: -0.15rem -0.2rem 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.toast__close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Dokunma hedefi: gorunum 28px kalir, tiklanabilir alan 44px olur. */
@media (hover: none) and (pointer: coarse) {
    .toast__close {
        position: relative;
    }

    .toast__close::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 44px;
        height: 44px;
        transform: translate(-50%, -50%);
    }
}

/* Cerez bandi aciksa toast onun ustunde dursun (JS olcup ayarlar). */
.toast-region {
    bottom: calc(1rem + var(--toast-offset, 0px) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 641px) {
    .toast-region {
        left: auto;
        right: 1.5rem;
        transform: none;
        width: min(100% - 3rem, 24rem);
    }
}

@media (max-width: 400px) {
    .toast {
        padding: 0.75rem 0.8rem;
        border-radius: 12px;
    }

    .toast__title {
        font-size: 0.88rem;
    }

    .toast__text {
        font-size: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: none;
    }
}
