/* ──── Scan Toast Notifications ──────────────────────────────────── */
#scan-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: 100%;
}

.scan-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 14px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 1px 3px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    pointer-events: all;
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.scan-toast--visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.scan-toast--exit {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.35s cubic-bezier(0.55, 0, 1, 0.45);
}

/* Toast type-specific  styles */
.scan-toast--running {
    background: rgba(30, 35, 55, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.scan-toast--done {
    background: rgba(20, 45, 35, 0.95);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.scan-toast--failed,
.scan-toast--error {
    background: rgba(50, 25, 25, 0.95);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.scan-toast--cached {
    background: rgba(30, 35, 55, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Toast icon */
.scan-toast__icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 1;
}

.scan-toast--running .scan-toast__icon {
    animation: toast-spin 1.5s linear infinite;
}

@keyframes toast-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Toast body */
.scan-toast__body {
    flex: 1;
    min-width: 0;
}

.scan-toast__title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 2px;
    line-height: 1.3;
}

.scan-toast__message {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.4;
}

.scan-toast__link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #818cf8;
    text-decoration: none;
    transition: color 0.2s;
    padding: 5px 14px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.scan-toast__link:hover {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.25);
}

.scan-toast--done .scan-toast__link {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.2);
}

.scan-toast--done .scan-toast__link:hover {
    color: #86efac;
    background: rgba(34, 197, 94, 0.25);
}

/* Close button */
.scan-toast__close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.2s;
}

.scan-toast__close:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Progress bar for running state */
.scan-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.scan-toast__progress-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #6366f1, #818cf8, #6366f1);
    background-size: 200% 100%;
    animation: toast-progress 1.5s ease-in-out infinite;
    border-radius: 0 3px 3px 0;
}

@keyframes toast-progress {
    0%   { transform: translateX(-100%); background-position: 0% 0; }
    50%  { background-position: 100% 0; }
    100% { transform: translateX(400%); background-position: 0% 0; }
}

/* Mobile responsive */
@media (max-width: 480px) {
    #scan-toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .scan-toast {
        padding: 12px 14px;
        border-radius: 10px;
    }

    .scan-toast__icon {
        font-size: 1.25rem;
    }
}

/* Light theme adjustments */
[data-theme="light"] .scan-toast--running {
    background: rgba(245, 245, 255, 0.97);
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .scan-toast--done {
    background: rgba(240, 255, 245, 0.97);
    border-color: rgba(34, 197, 94, 0.4);
}

[data-theme="light"] .scan-toast--failed,
[data-theme="light"] .scan-toast--error {
    background: rgba(255, 240, 240, 0.97);
    border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="light"] .scan-toast__title {
    color: #1e293b;
}

[data-theme="light"] .scan-toast__message {
    color: rgba(30, 41, 59, 0.7);
}

[data-theme="light"] .scan-toast__close {
    color: rgba(30, 41, 59, 0.4);
}

[data-theme="light"] .scan-toast__close:hover {
    color: rgba(30, 41, 59, 0.8);
}

[data-theme="light"] .scan-toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
                0 1px 3px rgba(0, 0, 0, 0.08);
}
