/* Toast Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Toast styling — consolidated single .toast block */
.toast {
    animation: slideInRight var(--duration-normal, 250ms) var(--ease-apple, cubic-bezier(0.25, 0.46, 0.45, 0.94));
    transition: box-shadow var(--duration-fast, 150ms) var(--ease-apple, cubic-bezier(0.25, 0.46, 0.45, 0.94));
    box-shadow: var(--card-shadow) !important;
    border-radius: var(--card-radius, 14px) !important;
    overflow: hidden;
    min-width: 280px;
    max-width: 350px;
}

.toast.fade-out {
    animation: slideOutRight var(--duration-normal, 250ms) var(--ease-apple, cubic-bezier(0.25, 0.46, 0.45, 0.94));
}

.toast-container {
    z-index: 9999 !important;
}

.toast-header {
    font-weight: 600;
    border-bottom: none !important;
}

.toast-body {
    font-size: 14px;
    line-height: 1.4;
    padding: 0.75rem var(--space-4, 16px) !important;
}

/* Fix toast content layout */
.toast .d-flex {
    width: 100%;
}

.toast .toast-body .d-flex {
    gap: var(--space-2, 8px);
}

.toast .toast-body .flex-grow-1 {
    min-width: 0; /* Allow text to shrink */
    flex: 1;
    padding-right: var(--space-2, 8px);
}

.toast .toast-body strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.toast .toast-body > .d-flex > div:not(.flex-grow-1):not(:last-child) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Close button styling — meet 44x44 touch target */
.toast .btn-close {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    padding: 0.25rem;
    margin: 0 !important;
    opacity: 0.8;
    background-size: 0.65rem;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast .btn-close:hover {
    opacity: 1;
}

/* Toast foreground.
   T-04 (post-QA UI/UX review, 2026-07-27): the markup used Bootstrap's `text-white` /
   `text-white-50`. In DARK mode the status fills are the light variants, so white body text
   measured 2.28:1 on warning and 2.52:1 on info — both well under the WCAG 2.2 AA 4.5:1 floor,
   and the warning fill is exactly the surface the "your access was reduced" toast lands on.
   The 50%-alpha timestamp failed in BOTH themes (1.54:1 – 2.59:1) because de-emphasising by
   opacity on a saturated fill destroys contrast; it is now de-emphasised by size and weight at
   full opacity instead. --dp-on-status-fill is theme-aware (white on light, dark ink on dark). */
.toast {
    color: var(--dp-on-status-fill);
}

.toast .toast-body,
.toast .toast-body strong {
    color: var(--dp-on-status-fill);
}

/* Timestamp / secondary line — de-emphasised by scale, not by alpha. */
.dp-toast-meta {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--dp-on-status-fill);
}

.dp-toast-title {
    display: block;
    font-size: 0.875rem;
}

.dp-toast-message {
    font-size: 0.8rem;
    word-break: break-word;
}

.dp-toast-icon {
    margin-top: 2px;
}

.toast .btn-close {
    /* Bootstrap's btn-close is a dark SVG; invert it only where the fill is dark (light theme). */
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .toast .btn-close {
    filter: none;
}

/* Semantic toast colors — solid, no gradient */
.toast-success,
.toast.bg-success {
    background: var(--dp-status-success) !important;
}

.toast-error,
.toast.bg-danger {
    background: var(--dp-status-danger) !important;
}

.toast-warning,
.toast.bg-warning {
    background: var(--dp-status-warning) !important;
}

.toast-info,
.toast.bg-info {
    background: var(--dp-status-info) !important;
}

/* Hover — shadow only, no translateY */
.toast:hover {
    box-shadow: var(--card-shadow-hover) !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .toast-container {
        left: var(--space-4, 16px) !important;
        right: var(--space-4, 16px) !important;
        max-width: none !important;
    }

    .toast {
        margin-bottom: var(--space-2, 8px) !important;
        min-width: auto;
        max-width: 100%;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast.fade-out {
        animation: none;
        transition: none;
    }
}
