﻿/* =========================================
   PREMIUM TOAST SYSTEM
   ========================================= */

.premium-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2147483647;
    width: 390px;
    max-width: calc(100vw - 32px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* =========================================
   POSITIONS
   ========================================= */

.position-top-right {
    top: 24px;
    right: 24px;
    left: auto;
    bottom: auto;
}

.position-top-left {
    top: 24px;
    left: 24px;
    right: auto;
    bottom: auto;
}

.position-top-center {
    top: 24px;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
}

.position-bottom-right {
    bottom: 24px;
    right: 24px;
    top: auto;
    left: auto;
    flex-direction: column-reverse;
}

.position-bottom-left {
    bottom: 24px;
    left: 24px;
    top: auto;
    right: auto;
    flex-direction: column-reverse;
}

.position-bottom-center {
    bottom: 24px;
    left: 50%;
    top: auto;
    right: auto;
    transform: translateX(-50%);
    flex-direction: column-reverse;
}

/* =========================================
   TOAST CARD
   ========================================= */

.premium-toast {
    --toast-color: #3b82f6;
    --toast-dark: #2563eb;
    --toast-light: #eff6ff;
    --toast-border: #bfdbfe;
    --toast-duration: 4000ms;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e5eaf1;
    border-radius: 15px;
    box-shadow: 0 3px 8px rgba(15, 23, 42, .035), 0 12px 28px rgba(15, 23, 42, .075), 0 24px 45px rgba(15, 23, 42, .035);
    overflow: hidden;
    pointer-events: auto;
    animation: premium-toast-enter .4s cubic-bezier(.16, 1, .3, 1) both;
    transition: box-shadow .25s ease, border-color .25s ease;
}

    .premium-toast:hover {
        border-color: #cbd5e1;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .06), 0 18px 42px rgba(15, 23, 42, .12);
    }

    .premium-toast.is-closing {
        pointer-events: none;
        animation: premium-toast-exit .22s ease-in forwards;
    }

/* =========================================
   TOAST TYPES
   ========================================= */

.toast-success {
    --toast-color: #10b981;
    --toast-dark: #059669;
    --toast-light: #ecfdf5;
    --toast-border: #bbf7d0;
}

.toast-error {
    --toast-color: #ef4444;
    --toast-dark: #dc2626;
    --toast-light: #fef2f2;
    --toast-border: #fecaca;
}

.toast-warning {
    --toast-color: #f59e0b;
    --toast-dark: #d97706;
    --toast-light: #fffbeb;
    --toast-border: #fde68a;
}

.toast-info {
    --toast-color: #3b82f6;
    --toast-dark: #2563eb;
    --toast-light: #eff6ff;
    --toast-border: #bfdbfe;
}

/* =========================================
   LEFT ACCENT
   ========================================= */

.premium-toast-accent {
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--toast-color);
}

/* =========================================
   CONTENT
   ========================================= */

.premium-toast-content {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 17px 15px 17px 19px;
}

/* =========================================
   ICON
   ========================================= */

.premium-toast-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--toast-dark);
    background: var(--toast-light);
    border: 1px solid var(--toast-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

    .premium-toast-icon svg {
        width: 22px;
        height: 22px;
        display: block;
    }

/* =========================================
   TEXT
   ========================================= */

.premium-toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.premium-toast-title {
    margin: 0 0 4px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -.2px;
    overflow-wrap: anywhere;
}

.premium-toast-message {
    color: #64748b;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.65;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* =========================================
   CLOSE BUTTON
   ========================================= */

.premium-toast-close {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -3px -3px 0 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

    .premium-toast-close svg {
        width: 16px;
        height: 16px;
    }

    .premium-toast-close:hover {
        color: #475569;
        background: #f1f5f9;
        transform: rotate(90deg);
    }

    .premium-toast-close:active {
        transform: rotate(90deg) scale(.92);
    }

    .premium-toast-close:focus-visible {
        outline: 2px solid var(--toast-color);
        outline-offset: 2px;
    }

/* =========================================
   PROGRESS BAR
   ========================================= */

.premium-toast-progress-track {
    position: relative;
    width: 100%;
    height: 3px;
    background: var(--toast-light);
    overflow: hidden;
}

.premium-toast-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--toast-color);
    transform-origin: left center;
    animation: premium-toast-progress var(--toast-duration) linear both;
}

.premium-toast.is-paused
.premium-toast-progress-bar {
    animation-play-state: paused;
}

.premium-toast.is-closing
.premium-toast-progress-bar {
    animation-play-state: paused;
}

/* =========================================
   ANIMATIONS
   ========================================= */

@keyframes premium-toast-enter {
    from {
        opacity: 0;
        transform: translate3d(32px, -6px, 0) scale(.96);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes premium-toast-exit {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(36px) scale(.96);
    }
}

@keyframes premium-toast-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* =========================================
   BOTTOM POSITIONS
   ========================================= */

.position-bottom-right .premium-toast,
.position-bottom-left .premium-toast,
.position-bottom-center .premium-toast {
    animation-name: premium-toast-enter-bottom;
}

    .position-bottom-right .premium-toast.is-closing,
    .position-bottom-left .premium-toast.is-closing,
    .position-bottom-center .premium-toast.is-closing {
        animation-name: premium-toast-exit;
    }

@keyframes premium-toast-enter-bottom {
    from {
        opacity: 0;
        transform: translateY(24px) scale(.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 640px) {

    .premium-toast-container {
        width: auto;
        max-width: none;
        left: 12px;
        right: 12px;
        gap: 10px;
    }

    .position-top-right,
    .position-top-left,
    .position-top-center {
        top: 12px;
        bottom: auto;
        transform: none;
    }

    .position-bottom-right,
    .position-bottom-left,
    .position-bottom-center {
        top: auto;
        bottom: 12px;
        transform: none;
    }

    .premium-toast {
        border-radius: 13px;
    }

    .premium-toast-content {
        padding: 14px 12px 14px 16px;
        gap: 11px;
    }

    .premium-toast-icon {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

        .premium-toast-icon svg {
            width: 20px;
            height: 20px;
        }

    .premium-toast-title {
        font-size: 13px;
    }

    .premium-toast-message {
        font-size: 12px;
    }
}

/* =========================================
   ACCESSIBILITY
   ========================================= */

@media (prefers-reduced-motion: reduce) {

    .premium-toast,
    .premium-toast.is-closing {
        animation: none;
        transition: none;
    }

    .premium-toast-progress-bar {
        animation: none;
    }

    .premium-toast-close {
        transition: none;
    }

        .premium-toast-close:hover {
            transform: none;
        }
}
