/* ==========================================================================
   TOAST.CSS - GLOBAL BİLDİRİM SİSTEMİ
   Responsive, okunaklı, taşma önleyici ve modal üstü çalışır.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

#toast-container {
    position: fixed;
    top: max(24px, env(safe-area-inset-top));
    right: 24px;
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(430px, calc(100vw - 48px));
    pointer-events: none;
    overflow: visible;
}

.toast-item {
    --toast-color: #06b6d4;
    --toast-bg: #ecfeff;
    --toast-duration: 4000ms;
    --toast-play-state: running;

    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 5px solid var(--toast-color);
    border-radius: 16px;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.16),
        0 4px 10px rgba(15, 23, 42, 0.06);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 16px 18px 16px;
    pointer-events: auto;
    overflow: hidden;
    opacity: 0;
    transform: translateX(120%);
    animation: toast-slide-in-right 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.05) forwards;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, opacity;
}

.toast-item.closing {
    animation: toast-slide-out-right 0.28s ease-in forwards;
}

.toast-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--toast-bg);
    color: var(--toast-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content-wrapper {
    min-width: 0;
    max-height: 190px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.toast-content-wrapper::-webkit-scrollbar {
    width: 5px;
}

.toast-content-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.toast-content-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.toast-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.toast-message-text {
    margin: 0;
    color: #1e293b;
    font-size: 0.94rem;
    font-weight: 650;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: normal;
}

.toast-message-text strong,
.toast-title {
    display: block;
    margin-bottom: 3px;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.35;
}

.toast-suggestion {
    display: block;
    margin-top: 7px;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
}

.toast-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: #f8fafc;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: #f1f5f9;
    color: #334155;
    transform: rotate(4deg);
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 100%;
    background-color: color-mix(in srgb, var(--toast-color) 60%, transparent);
    transform-origin: left;
    animation: toast-progress-shrink var(--toast-duration) linear forwards;
    animation-play-state: var(--toast-play-state);
}

.toast-item.toast-success {
    --toast-color: #10b981;
    --toast-bg: #ecfdf5;
}

.toast-item.toast-error {
    --toast-color: #ef4444;
    --toast-bg: #fef2f2;
}

.toast-item.toast-warning {
    --toast-color: #f59e0b;
    --toast-bg: #fffbeb;
}

.toast-item.toast-info {
    --toast-color: #06b6d4;
    --toast-bg: #ecfeff;
}

@keyframes toast-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(120%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-slide-out-right {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

@keyframes toast-slide-in-down {
    from {
        opacity: 0;
        transform: translateY(-24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-fade-out-up {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-18px);
    }
}

@keyframes toast-progress-shrink {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Tablet */
@media (max-width: 992px) {
    #toast-container {
        top: max(18px, env(safe-area-inset-top));
        right: 18px;
        width: min(420px, calc(100vw - 36px));
    }

    .toast-item {
        border-radius: 15px;
    }
}

/* Telefon */
@media (max-width: 768px) {
    #toast-container {
        top: max(14px, env(safe-area-inset-top));
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        gap: 10px;
        align-items: stretch;
    }

    .toast-item {
        width: 100%;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 12px;
        padding: 14px 14px 17px 14px;
        border-radius: 15px;
        transform: translateY(-24px);
        animation: toast-slide-in-down 0.28s ease-out forwards;
    }

    .toast-item.closing {
        animation: toast-fade-out-up 0.24s ease-in forwards;
    }

    .toast-icon {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 1.1rem;
    }

    .toast-message-text {
        font-size: 0.9rem;
        line-height: 1.48;
    }

    .toast-message-text strong,
    .toast-title {
        font-size: 0.96rem;
    }

    .toast-suggestion {
        font-size: 0.84rem;
    }

    .toast-content-wrapper {
        max-height: 150px;
    }

    .toast-close {
        width: 30px;
        height: 30px;
        font-size: 1.15rem;
    }
}

/* Küçük telefon */
@media (max-width: 420px) {
    #toast-container {
        left: 10px;
        right: 10px;
        top: max(10px, env(safe-area-inset-top));
    }

    .toast-item {
        gap: 10px;
        padding: 13px 12px 17px 12px;
    }

    .toast-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .toast-content-wrapper {
        max-height: 140px;
    }
}

/* Hareket hassasiyeti olan kullanıcılar için */
@media (prefers-reduced-motion: reduce) {
    .toast-item,
    .toast-item.closing,
    .toast-progress {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .toast-item {
        transform: none !important;
    }
}