/* ════════════════════════════════════════════════════
   BlazorToast — Global Stylesheet
   ────────────────────────────────────────────────────
   Add to index.html (WASM) or _Host.cshtml (Server):
     <link href="css/blazor-toast.css" rel="stylesheet" />
   ────────────────────────────────────────────────────
   All classes prefixed "bt-" to avoid collisions.
   Three variants: Text · Filled · Outlined
   Five severities: Normal · Info · Success · Warning · Error
   ════════════════════════════════════════════════════ */


/* ── Severity color tokens (MudBlazor palette) ── */

.bt-container {
    --bt-normal: #594ae2;
    --bt-normal-light: #ece9fc;
    --bt-normal-dark: #3a2dba;
    --bt-info: #2196f3;
    --bt-info-light: #e3f2fd;
    --bt-info-dark: #0b6bcb;
    --bt-success: #00c853;
    --bt-success-light: #e8f5e9;
    --bt-success-dark: #00953e;
    --bt-warning: #ff9800;
    --bt-warning-light: #fff3e0;
    --bt-warning-dark: #b86e00;
    --bt-error: #f44336;
    --bt-error-light: #fde8e7;
    --bt-error-dark: #c62828;
}


/* ══════════════════════════════════════════════════
   CONTAINER POSITIONING
   ══════════════════════════════════════════════════ */

.bt-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    padding: 1.25rem;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}

.bt-pos-top-right {
    top: 0;
    right: 0;
    align-items: flex-end;
}

.bt-pos-top-left {
    top: 0;
    left: 0;
    align-items: flex-start;
}

.bt-pos-top-center {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}

.bt-pos-bottom-right {
    bottom: 0;
    right: 0;
    align-items: flex-end;
    flex-direction: column-reverse;
}

.bt-pos-bottom-left {
    bottom: 0;
    left: 0;
    align-items: flex-start;
    flex-direction: column-reverse;
}

.bt-pos-bottom-center {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    flex-direction: column-reverse;
}


/* ══════════════════════════════════════════════════
   BASE TOAST
   ══════════════════════════════════════════════════ */

.bt-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    width: 22rem;
    max-width: 92vw;
    border-radius: 4px;
    pointer-events: auto;
    overflow: hidden;
    padding: 0.875rem 1rem;
    gap: 0.75rem;
    font-family: "Roboto", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    line-height: 1.45;
    box-sizing: border-box;
}

    .bt-toast *,
    .bt-toast *::before,
    .bt-toast *::after {
        box-sizing: border-box;
    }


/* ══════════════════════════════════════════════════
   VARIANT: OUTLINED
   White bg · colored 1px border · colored icon & title
   ══════════════════════════════════════════════════ */

.bt-variant-outlined {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

    .bt-variant-outlined.bt-sev-normal {
        border: 1px solid var(--bt-normal);
    }

    .bt-variant-outlined.bt-sev-info {
        border: 1px solid var(--bt-info);
    }

    .bt-variant-outlined.bt-sev-success {
        border: 1px solid var(--bt-success);
    }

    .bt-variant-outlined.bt-sev-warning {
        border: 1px solid var(--bt-warning);
    }

    .bt-variant-outlined.bt-sev-error {
        border: 1px solid var(--bt-error);
    }

    .bt-variant-outlined.bt-sev-normal .bt-icon,
    .bt-variant-outlined.bt-sev-normal .bt-title {
        color: var(--bt-normal);
    }

    .bt-variant-outlined.bt-sev-info .bt-icon,
    .bt-variant-outlined.bt-sev-info .bt-title {
        color: var(--bt-info);
    }

    .bt-variant-outlined.bt-sev-success .bt-icon,
    .bt-variant-outlined.bt-sev-success .bt-title {
        color: var(--bt-success);
    }

    .bt-variant-outlined.bt-sev-warning .bt-icon,
    .bt-variant-outlined.bt-sev-warning .bt-title {
        color: var(--bt-warning);
    }

    .bt-variant-outlined.bt-sev-error .bt-icon,
    .bt-variant-outlined.bt-sev-error .bt-title {
        color: var(--bt-error);
    }

    .bt-variant-outlined .bt-message {
        color: #424242;
    }

    .bt-variant-outlined .bt-close {
        color: #757575;
    }

        .bt-variant-outlined .bt-close:hover {
            color: #212121;
            background: rgba(0, 0, 0, 0.06);
        }


/* ══════════════════════════════════════════════════
   VARIANT: FILLED
   Solid severity bg · white text throughout
   ══════════════════════════════════════════════════ */

.bt-variant-filled {
    border: none;
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.15), 0 5px 8px 0 rgba(0, 0, 0, 0.10), 0 1px 14px 0 rgba(0, 0, 0, 0.08);
}

    .bt-variant-filled.bt-sev-normal {
        background: var(--bt-normal);
    }

    .bt-variant-filled.bt-sev-info {
        background: var(--bt-info);
    }

    .bt-variant-filled.bt-sev-success {
        background: var(--bt-success);
    }

    .bt-variant-filled.bt-sev-warning {
        background: var(--bt-warning);
    }

    .bt-variant-filled.bt-sev-error {
        background: var(--bt-error);
    }

    .bt-variant-filled .bt-icon {
        color: #ffffff;
    }

    .bt-variant-filled .bt-title {
        color: #ffffff;
    }

    .bt-variant-filled .bt-message {
        color: rgba(255, 255, 255, 0.9);
    }

    .bt-variant-filled .bt-close {
        color: rgba(255, 255, 255, 0.7);
    }

        .bt-variant-filled .bt-close:hover {
            color: #ffffff;
            background: rgba(255, 255, 255, 0.15);
        }

    .bt-variant-filled .bt-progress {
        background: rgba(255, 255, 255, 0.2);
    }

    .bt-variant-filled .bt-progress-bar {
        background: rgba(255, 255, 255, 0.6);
    }


/* ══════════════════════════════════════════════════
   VARIANT: TEXT
   Light tinted bg · colored icon & title · no border
   ══════════════════════════════════════════════════ */

.bt-variant-text {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

    .bt-variant-text.bt-sev-normal {
        background: var(--bt-normal-light);
    }

    .bt-variant-text.bt-sev-info {
        background: var(--bt-info-light);
    }

    .bt-variant-text.bt-sev-success {
        background: var(--bt-success-light);
    }

    .bt-variant-text.bt-sev-warning {
        background: var(--bt-warning-light);
    }

    .bt-variant-text.bt-sev-error {
        background: var(--bt-error-light);
    }

    .bt-variant-text.bt-sev-normal .bt-icon,
    .bt-variant-text.bt-sev-normal .bt-title {
        color: var(--bt-normal-dark);
    }

    .bt-variant-text.bt-sev-info .bt-icon,
    .bt-variant-text.bt-sev-info .bt-title {
        color: var(--bt-info-dark);
    }

    .bt-variant-text.bt-sev-success .bt-icon,
    .bt-variant-text.bt-sev-success .bt-title {
        color: var(--bt-success-dark);
    }

    .bt-variant-text.bt-sev-warning .bt-icon,
    .bt-variant-text.bt-sev-warning .bt-title {
        color: var(--bt-warning-dark);
    }

    .bt-variant-text.bt-sev-error .bt-icon,
    .bt-variant-text.bt-sev-error .bt-title {
        color: var(--bt-error-dark);
    }

    .bt-variant-text .bt-message {
        color: #424242;
    }

    .bt-variant-text .bt-close {
        color: #757575;
    }

        .bt-variant-text .bt-close:hover {
            color: #212121;
            background: rgba(0, 0, 0, 0.06);
        }


/* ══════════════════════════════════════════════════
   SHARED ELEMENTS
   ══════════════════════════════════════════════════ */

/* ── Icon ── */

.bt-icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .bt-icon svg {
        width: 100%;
        height: 100%;
        display: block;
    }

/* ── Body ── */

.bt-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bt-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
}

.bt-message {
    font-size: 0.8125rem;
    line-height: 1.45;
    word-break: break-word;
}

/* ── Close button ── */

.bt-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

    .bt-close svg {
        width: 0.875rem;
        height: 0.875rem;
        display: block;
    }

/* ── Progress bar ── */

.bt-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
}

.bt-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: bt-countdown linear forwards;
}

/* Progress bar colours — outlined & text variants */
.bt-variant-outlined.bt-sev-normal .bt-progress-bar,
.bt-variant-text.bt-sev-normal .bt-progress-bar {
    background: var(--bt-normal);
}

.bt-variant-outlined.bt-sev-info .bt-progress-bar,
.bt-variant-text.bt-sev-info .bt-progress-bar {
    background: var(--bt-info);
}

.bt-variant-outlined.bt-sev-success .bt-progress-bar,
.bt-variant-text.bt-sev-success .bt-progress-bar {
    background: var(--bt-success);
}

.bt-variant-outlined.bt-sev-warning .bt-progress-bar,
.bt-variant-text.bt-sev-warning .bt-progress-bar {
    background: var(--bt-warning);
}

.bt-variant-outlined.bt-sev-error .bt-progress-bar,
.bt-variant-text.bt-sev-error .bt-progress-bar {
    background: var(--bt-error);
}

@keyframes bt-countdown {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}


/* ══════════════════════════════════════════════════
   ENTER / EXIT ANIMATIONS
   ══════════════════════════════════════════════════ */

.bt-entering {
    animation: bt-slide-in var(--bt-show-ms, 300ms) cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bt-dismissing {
    animation: bt-slide-out var(--bt-hide-ms, 300ms) cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes bt-slide-in {
    from {
        opacity: 0;
        transform: translateY(-0.5rem) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bt-slide-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 10rem;
    }

    to {
        opacity: 0;
        transform: translateY(-0.5rem) scale(0.97);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: -0.5rem;
    }
}


/* ══════════════════════════════════════════════════
   DARK MODE — opt-in via config.DarkMode = true
   Adds .bt-dark class to the container element.
   ══════════════════════════════════════════════════ */

/* Outlined */
.bt-dark .bt-variant-outlined {
    background: #1e1e2e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

    .bt-dark .bt-variant-outlined .bt-message {
        color: #b0b0b0;
    }

    .bt-dark .bt-variant-outlined .bt-close {
        color: #888888;
    }

        .bt-dark .bt-variant-outlined .bt-close:hover {
            color: #dddddd;
            background: rgba(255, 255, 255, 0.08);
        }

/* Text */
.bt-dark .bt-variant-text.bt-sev-normal {
    background: rgba(89, 74, 226, 0.15);
}

.bt-dark .bt-variant-text.bt-sev-info {
    background: rgba(33, 150, 243, 0.15);
}

.bt-dark .bt-variant-text.bt-sev-success {
    background: rgba(0, 200, 83, 0.15);
}

.bt-dark .bt-variant-text.bt-sev-warning {
    background: rgba(255, 152, 0, 0.15);
}

.bt-dark .bt-variant-text.bt-sev-error {
    background: rgba(244, 67, 54, 0.15);
}

.bt-dark .bt-variant-text .bt-message {
    color: #b0b0b0;
}

.bt-dark .bt-variant-text .bt-close {
    color: #888888;
}

    .bt-dark .bt-variant-text .bt-close:hover {
        color: #dddddd;
        background: rgba(255, 255, 255, 0.08);
    }

/* Shared dark overrides */
.bt-dark .bt-progress {
    background: rgba(255, 255, 255, 0.08);
}
