/* Toast container for stacking multiple toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 336px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999; /* Ensure toasts appear above most content */
}

/* Responsive repositioning for small screens */
@media (max-width: 640px) {
    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
    }
}

/* Individual toast — the same solid-surface card treatment as every other
   floating overlay in the app (feedback modal, global search palette):
   var(--bg-surface) + var(--border-subtle) + a two-tier shadow, not a
   one-off dark-glass surface. That means it now correctly follows the
   light/dark toggle instead of being frozen to dark-theme colors — this
   used to be a deliberate exception (see git history) from before the
   app had a real light theme to stay legible against; now that every
   other surface in the app themes properly, keeping the toast in its own
   fixed-dark past made it feel like a leftover from an earlier version. */
.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.28), 0 4px 16px rgba(0,0,0,0.16);
    overflow: hidden;
    pointer-events: auto;

    opacity: 0;
    transform: translateX(16px) scale(0.98);
    transition: opacity 260ms cubic-bezier(0.16,1,0.3,1), transform 260ms cubic-bezier(0.16,1,0.3,1);
}
.dark .toast { box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3); }

/* Visible state triggered by JS */
.toast.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Exit animation */
.toast.exit {
    opacity: 0;
    transform: translateX(16px) scale(0.98);
    transition: opacity 180ms ease-in, transform 180ms ease-in;
}

/* Per-type accent — same semantic tokens used everywhere else (budget
   tiers, note colors, stat cards), not a set of colors invented just for
   toasts. --toast-accent-dim backs the icon chip below. */
.toast-success { --toast-accent: var(--emerald); --toast-accent-dim: var(--emerald-dim); }
.toast-error   { --toast-accent: var(--red);     --toast-accent-dim: var(--red-dim); }
.toast-info    { --toast-accent: var(--gold);    --toast-accent-dim: var(--gold-dim); }
.toast-warning { --toast-accent: var(--amber);   --toast-accent-dim: var(--amber-dim); }

/* Icon chip — the exact treatment used elsewhere for a small circular
   colored icon badge (see .finance-mini-icon), swapped in for the old
   bare Unicode glyph (✓ ✕ ✦ ⚠) so a toast's icon reads the same way
   every other icon in the app does: a real lucide SVG, not a text
   character standing in for one. */
.toast-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--toast-accent-dim);
    color: var(--toast-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast-icon svg, .toast-icon i { width: 15px; height: 15px; stroke-width: 2; }

.toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.toast-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.toast-message {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 2px 0 0;
    line-height: 1.4;
}

/* Close button — same small icon-button treatment as note cards'
   pin/delete controls (no background, muted by default, sharpens on
   hover) rather than a bespoke &times; glyph. */
.toast .close-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    line-height: 0;
    cursor: pointer;
    padding: 2px;
    margin: -2px -2px -2px 0;
    border-radius: 6px;
    transition: color 0.15s ease;
}
.toast .close-btn svg, .toast .close-btn i { width: 15px; height: 15px; stroke-width: 1.75; }

.toast .close-btn:hover { color: var(--text-primary); }

.toast .close-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Auto-dismiss progress bar — drains right-to-left in the accent color */
.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--toast-accent);
    opacity: 0.35;
    transform-origin: right;
    pointer-events: none;
    animation-name: toast-progress-drain;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes toast-progress-drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Action button inside toast (Undo, Retry, etc.) — same treatment as
   .btn-secondary everywhere else, just sized to fit inline. */
.toast-action-btn {
    flex-shrink: 0;
    margin-left: 2px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.toast-action-btn:hover { background: var(--bg-hover); }

.toast-action-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
