/* ==========================================================================
   COMPACT & NEAT TOAST NOTIFICATION SYSTEM
   With Visible Medical Pattern Background Image
   ========================================================================== */

.lab-toast-container,
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

/* Compact Card */
.toast-card {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    background-color: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 6px 10px -4px rgba(0, 0, 0, 0.05);
    min-width: 240px;
    max-width: 340px;
    width: max-content;
    animation: toast-slide-in 0.25s ease-out forwards;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast-card.dismissing {
    animation: toast-slide-out 0.2s ease-in forwards !important;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
}

/* Background Image Layer (ECG + Lab pattern) */
.toast-card-bg-img {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.35;
}

.toast-card-bg-img svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Content */
.toast-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
}

/* Circular Icon */
.toast-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Text */
.toast-body {
    flex: 1 1 auto;
    min-width: 0;
}

.toast-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 1px 0;
    color: #0f172a;
}

.toast-message {
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.35;
    color: #475569;
    margin: 0;
    word-break: break-word;
}

/* Close Button */
.toast-close-btn {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    margin-left: 6px;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.toast-close-btn:hover {
    background-color: #f1f5f9;
    color: #334155;
}

/* Thin Progress Bar */
.toast-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 2;
}

.toast-progress-fill {
    height: 100%;
    width: 100%;
    transform-origin: left;
}

.toast-progress-fill.active {
    animation: toast-shrink linear forwards;
}

@keyframes toast-shrink {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* ==========================================================================
   STATUS COLORS (LIGHT THEME)
   ========================================================================== */

/* Error */
.toast-error {
    border-color: #fecaca;
}
.toast-error .toast-icon {
    background-color: #fee2e2;
    color: #ef4444;
}
.toast-error .toast-title {
    color: #dc2626;
}
.toast-error .toast-progress-fill {
    background-color: #ef4444;
}
.toast-error .toast-card-bg-img {
    color: #ef4444;
}

/* Delete / Destructive */
.toast-delete {
    border-color: #fecdd3;
}
.toast-delete .toast-icon {
    background-color: #ffe4e6;
    color: #e11d48;
}
.toast-delete .toast-title {
    color: #e11d48;
}
.toast-delete .toast-progress-fill {
    background-color: #f43f5e;
}
.toast-delete .toast-card-bg-img {
    color: #f43f5e;
}

/* Success */
.toast-success {
    border-color: #bbf7d0;
}
.toast-success .toast-icon {
    background-color: #dcfce7;
    color: #16a34a;
}
.toast-success .toast-title {
    color: #16a34a;
}
.toast-success .toast-progress-fill {
    background-color: #10b981;
}
.toast-success .toast-card-bg-img {
    color: #10b981;
}

/* Warning */
.toast-warning {
    border-color: #fef08a;
}
.toast-warning .toast-icon {
    background-color: #fef3c7;
    color: #d97706;
}
.toast-warning .toast-title {
    color: #d97706;
}
.toast-warning .toast-progress-fill {
    background-color: #f59e0b;
}
.toast-warning .toast-card-bg-img {
    color: #f59e0b;
}

/* Info */
.toast-info {
    border-color: #bfdbfe;
}
.toast-info .toast-icon {
    background-color: #dbeafe;
    color: #2563eb;
}
.toast-info .toast-title {
    color: #2563eb;
}
.toast-info .toast-progress-fill {
    background-color: #3b82f6;
}
.toast-info .toast-card-bg-img {
    color: #3b82f6;
}

/* ==========================================================================
   DARK THEME (COMPACT & CLEAN)
   ========================================================================== */
body:not(.light-theme) .toast-card,
.dark .toast-card {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

body:not(.light-theme) .toast-card-bg-img,
.dark .toast-card-bg-img {
    opacity: 0.45;
}

body:not(.light-theme) .toast-card .toast-message,
.dark .toast-card .toast-message {
    color: #cbd5e1;
}

body:not(.light-theme) .toast-card .toast-close-btn,
.dark .toast-card .toast-close-btn {
    color: #64748b;
}

body:not(.light-theme) .toast-card .toast-close-btn:hover,
.dark .toast-card .toast-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

body:not(.light-theme) .toast-card .toast-progress-bar,
.dark .toast-card .toast-progress-bar {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Dark theme status tweaks */
body:not(.light-theme) .toast-error,
.dark .toast-error {
    border-color: rgba(239, 68, 68, 0.35);
}
body:not(.light-theme) .toast-error .toast-icon,
.dark .toast-error .toast-icon {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
body:not(.light-theme) .toast-error .toast-title,
.dark .toast-error .toast-title {
    color: #f87171;
}
body:not(.light-theme) .toast-error .toast-card-bg-img,
.dark .toast-error .toast-card-bg-img {
    color: #ef4444;
}

body:not(.light-theme) .toast-delete,
.dark .toast-delete {
    border-color: rgba(244, 63, 94, 0.35);
}
body:not(.light-theme) .toast-delete .toast-icon,
.dark .toast-delete .toast-icon {
    background-color: rgba(244, 63, 94, 0.2);
    color: #fb7185;
}
body:not(.light-theme) .toast-delete .toast-title,
.dark .toast-delete .toast-title {
    color: #fb7185;
}
body:not(.light-theme) .toast-delete .toast-card-bg-img,
.dark .toast-delete .toast-card-bg-img {
    color: #f43f5e;
}

body:not(.light-theme) .toast-success,
.dark .toast-success {
    border-color: rgba(16, 185, 129, 0.35);
}
body:not(.light-theme) .toast-success .toast-icon,
.dark .toast-success .toast-icon {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
body:not(.light-theme) .toast-success .toast-title,
.dark .toast-success .toast-title {
    color: #34d399;
}
body:not(.light-theme) .toast-success .toast-card-bg-img,
.dark .toast-success .toast-card-bg-img {
    color: #10b981;
}

body:not(.light-theme) .toast-warning,
.dark .toast-warning {
    border-color: rgba(245, 158, 11, 0.35);
}
body:not(.light-theme) .toast-warning .toast-icon,
.dark .toast-warning .toast-icon {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}
body:not(.light-theme) .toast-warning .toast-title,
.dark .toast-warning .toast-title {
    color: #fbbf24;
}
body:not(.light-theme) .toast-warning .toast-card-bg-img,
.dark .toast-warning .toast-card-bg-img {
    color: #f59e0b;
}

body:not(.light-theme) .toast-info,
.dark .toast-info {
    border-color: rgba(59, 130, 246, 0.35);
}
body:not(.light-theme) .toast-info .toast-icon,
.dark .toast-info .toast-icon {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}
body:not(.light-theme) .toast-info .toast-title,
.dark .toast-info .toast-title {
    color: #60a5fa;
}
body:not(.light-theme) .toast-info .toast-card-bg-img,
.dark .toast-info .toast-card-bg-img {
    color: #3b82f6;
}

/* ==========================================================================
   MOBILE
   ========================================================================== */
@media (max-width: 576px) {
    .lab-toast-container,
    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        align-items: stretch;
    }

    .toast-card {
        max-width: 100%;
        width: 100%;
    }
}
