/**
 * Custom Top-Bounce Pill Toast Notification
 * Stays at top with bounce-down entry & slide-up exit
 */

.app-toast-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1090;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 16px;
}

.app-toast-pill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: min(92vw, 540px);
    margin-top: 20px;
    padding: 10px 18px 10px 14px;
    border-radius: 9999px;
    font-size: 0.895rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -0.01em;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.35), 0 4px 10px -2px rgba(0, 0, 0, 0.2);
    cursor: default;
    user-select: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Bounce in from top */
.app-toast-pill.toast-enter {
    animation: toastBounceDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Slide back up into ceiling */
.app-toast-pill.toast-leave {
    animation: toastSlideUp 0.38s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Toast Icon Wrapper */
.app-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 0.95rem;
}

/* Toast Text Body */
.app-toast-message {
    flex: 1 1 auto;
    word-break: break-word;
    color: inherit;
}

/* Toast Close Button */
.app-toast-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.5;
    font-size: 0.85rem;
    padding: 0 0 0 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-toast-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* =========================================================
   THEMING & ACCENTS (Clean Monochrome Base with Subtle Accents)
   ========================================================= */

/* Dark Mode Theme Default */
[data-bs-theme="dark"] .app-toast-pill {
    background-color: rgba(22, 25, 30, 0.94);
    color: #f1f3f5;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Light Mode Theme */
[data-bs-theme="light"] .app-toast-pill {
    background-color: rgba(255, 255, 255, 0.96);
    color: #1a1e24;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.15), 0 3px 8px -2px rgba(0, 0, 0, 0.08);
}

/* Variant: SUCCESS */
.app-toast-pill.toast-success .app-toast-icon {
    background-color: rgba(25, 135, 84, 0.15);
    color: #198754;
}
[data-bs-theme="dark"] .app-toast-pill.toast-success .app-toast-icon {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

/* Variant: DANGER */
.app-toast-pill.toast-danger .app-toast-icon {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}
[data-bs-theme="dark"] .app-toast-pill.toast-danger .app-toast-icon {
    background-color: rgba(243, 83, 105, 0.2);
    color: #ff5e78;
}

/* Variant: WARNING */
.app-toast-pill.toast-warning .app-toast-icon {
    background-color: rgba(255, 193, 7, 0.18);
    color: #d39e00;
}
[data-bs-theme="dark"] .app-toast-pill.toast-warning .app-toast-icon {
    background-color: rgba(245, 166, 35, 0.2);
    color: #f5a623;
}

/* Variant: INFO / MONOCHROME DEFAULT */
.app-toast-pill.toast-info .app-toast-icon {
    background-color: rgba(108, 117, 125, 0.15);
    color: #495057;
}
[data-bs-theme="dark"] .app-toast-pill.toast-info .app-toast-icon {
    background-color: rgba(255, 255, 255, 0.12);
    color: #e9ecef;
}

/* =========================================================
   KEYFRAME ANIMATIONS
   - Drop down from top ceiling with bounce
   - Slide up back into ceiling to dismiss
   ========================================================= */

@keyframes toastBounceDown {
    0% {
        opacity: 0;
        transform: translateY(-90px) scale(0.92);
    }
    60% {
        opacity: 1;
        transform: translateY(10px) scale(1.02);
    }
    80% {
        transform: translateY(-3px) scale(0.99);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    40% {
        transform: translateY(4px) scale(1.01);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.9);
    }
}

/* Mobile responsive fine-tuning */
@media (max-width: 576px) {
    .app-toast-pill {
        margin-top: 14px;
        padding: 8px 14px 8px 12px;
        font-size: 0.84rem;
        max-width: calc(100vw - 28px);
    }
    .app-toast-icon {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }
}
