/* Liquid-glass toasts (iOS style) with swipe-up-to-dismiss.
 *
 * Self-contained, theme-aware (light / html[data-theme="dark"]) and brand-neutral in its own namespace (.lqt-*).
 * Driven by wwwroot/js/liquid-toast.js, which overrides the global toast() / toastRightBottom() helpers.
 * Do NOT feed this file to Tools/DarkTheme: it already carries its own dark rules.
 */

.lqt-container {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    z-index: 2147483000; /* above modals (1050), the page spinner (101000) and snackbar (9999) */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    pointer-events: none; /* clicks pass through the gaps; each toast re-enables it */
}

.lqt-toast {
    pointer-events: auto;
    box-sizing: border-box;
    width: min(440px, 100%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    direction: rtl;
    padding: 12px 14px;
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    color: #1c1c1e;
    background-color: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16), 0 2px 8px rgba(17, 24, 39, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    cursor: grab;
    touch-action: none; /* we own the vertical gesture; the page must not scroll under it */
    -webkit-user-select: none;
    user-select: none;
    transform: translateY(-18px);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
    will-change: transform, opacity;
}

.lqt-toast.lqt-in {
    transform: translateY(0);
    opacity: 1;
}

/* swipe-up / timeout exit */
.lqt-toast.lqt-out {
    transform: translateY(-140%);
    opacity: 0;
}

.lqt-toast.lqt-dragging {
    cursor: grabbing;
    transition: none; /* 1:1 finger tracking while dragging */
}

/* icon badge (rightmost in RTL) */
.lqt-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.lqt-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* text */
.lqt-body {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
}

.lqt-title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.5;
    color: #1c1c1e;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.lqt-desc {
    margin-top: 2px;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.55;
    color: #6b6b70;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* close button (leftmost in RTL) */
.lqt-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(120, 120, 128, 0.14);
    color: #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.15s ease, transform 0.12s ease;
}

.lqt-close:hover {
    background: rgba(120, 120, 128, 0.24);
}

.lqt-close:active {
    transform: scale(0.88);
}

.lqt-close svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* ---- variants: icon colour + glow + a faint tint sweeping from the icon side ---- */
.lqt-success .lqt-icon {
    background: #34c759;
    box-shadow: 0 6px 16px rgba(52, 199, 89, 0.45);
}

.lqt-success {
    background-image: linear-gradient(to left, rgba(52, 199, 89, 0.14), rgba(52, 199, 89, 0) 55%);
}

.lqt-danger .lqt-icon {
    background: #ff3b30;
    box-shadow: 0 6px 16px rgba(255, 59, 48, 0.45);
}

.lqt-danger {
    background-image: linear-gradient(to left, rgba(255, 59, 48, 0.14), rgba(255, 59, 48, 0) 55%);
}

.lqt-warning .lqt-icon {
    background: #ff9500;
    box-shadow: 0 6px 16px rgba(255, 149, 0, 0.45);
}

.lqt-warning {
    background-image: linear-gradient(to left, rgba(255, 149, 0, 0.15), rgba(255, 149, 0, 0) 55%);
}

.lqt-primary .lqt-icon {
    background: #0a84ff;
    box-shadow: 0 6px 16px rgba(10, 132, 255, 0.45);
}

.lqt-primary {
    background-image: linear-gradient(to left, rgba(10, 132, 255, 0.14), rgba(10, 132, 255, 0) 55%);
}

/* ---- dark theme ---- */
html[data-theme="dark"] .lqt-toast {
    color: #f2f2f7;
    background-color: rgba(28, 30, 36, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .lqt-title {
    color: #f2f2f7;
}

html[data-theme="dark"] .lqt-desc {
    color: #a9a9b2;
}

html[data-theme="dark"] .lqt-close {
    background: rgba(235, 235, 245, 0.16);
    color: #e5e5ea;
}

html[data-theme="dark"] .lqt-close:hover {
    background: rgba(235, 235, 245, 0.26);
}

html[data-theme="dark"] .lqt-success {
    background-image: linear-gradient(to left, rgba(52, 199, 89, 0.22), rgba(52, 199, 89, 0) 55%);
}

html[data-theme="dark"] .lqt-danger {
    background-image: linear-gradient(to left, rgba(255, 69, 58, 0.22), rgba(255, 69, 58, 0) 55%);
}

html[data-theme="dark"] .lqt-warning {
    background-image: linear-gradient(to left, rgba(255, 159, 10, 0.22), rgba(255, 159, 10, 0) 55%);
}

html[data-theme="dark"] .lqt-primary {
    background-image: linear-gradient(to left, rgba(10, 132, 255, 0.22), rgba(10, 132, 255, 0) 55%);
}

/* opaque fallback where backdrop-filter is unsupported, so text stays readable */
@supports not ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
    .lqt-toast {
        background-color: rgba(250, 250, 252, 0.98);
    }

    html[data-theme="dark"] .lqt-toast {
        background-color: rgba(32, 34, 40, 0.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .lqt-toast {
        transition: opacity 0.2s ease;
        transform: none;
    }

    .lqt-toast.lqt-out {
        transform: none;
    }
}
