/* Custom Toast Styles for Light/Dark Mode */

/* Base Toast Container */
#blazored-toast-container,
[id^="blazored-toast-container"],
.blazored-toast-container {
    position: fixed !important;
    /* Anchor in the viewport regardless of parents */
    inset: 80px 24px auto auto !important; /* top right */
    top: 80px !important;
    right: 24px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 2147483647 !important; /* Max 32-bit int */
    pointer-events: none; /* Allow clicks through container */
    transform: none !important; /* Avoid transformed containing blocks */
    display: block !important;
}

/* Toast Base Styles */
.blazored-toast {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    min-width: 320px;
    max-width: 420px;
    padding: 18px 20px;
    margin-bottom: 16px;
    animation: slideInRight 0.3s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto; /* Toasts are clickable */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Pin toast on hover - prevent auto-dismiss and add visual feedback */
.blazored-toast:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    /* Pause the auto-dismiss timer when hovering */
    animation-play-state: paused;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.blazored-toast-close-button {
    font-size: 22px;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-weight: 300;
}

.blazored-toast-close-button:hover {
    opacity: 1;
}

/* Light Mode Toast Styles */
html:not(.dark-mode) .toast-success-custom {
    background: #ffffff !important;
    color: #065f46 !important;
    border: 1px solid #10b981;
    border-left: 5px solid #10b981;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
    transition: all 0.2s ease;
}

html:not(.dark-mode) .toast-success-custom:hover {
    border-left-width: 8px;
}

html:not(.dark-mode) .toast-error-custom {
    background: #ffffff !important;
    color: #991b1b !important;
    border: 1px solid #ef4444;
    border-left: 5px solid #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
    transition: all 0.2s ease;
}

html:not(.dark-mode) .toast-error-custom:hover {
    border-left-width: 8px;
}

html:not(.dark-mode) .toast-warning-custom {
    background: #ffffff !important;
    color: #92400e !important;
    border: 1px solid #f59e0b;
    border-left: 5px solid #f59e0b;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
    transition: all 0.2s ease;
}

html:not(.dark-mode) .toast-warning-custom:hover {
    border-left-width: 8px;
}

html:not(.dark-mode) .toast-info-custom {
    background: #ffffff !important;
    color: #1e40af !important;
    border: 1px solid #3b82f6;
    border-left: 5px solid #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
}

html:not(.dark-mode) .toast-info-custom:hover {
    border-left-width: 8px;
}

/* Dark Mode Toast Styles - Match Light Mode Design */
html.dark-mode .toast-success-custom {
    background: #1f2937 !important; /* Dark gray background */
    color: #10b981 !important; /* Green text */
    border: 1px solid #10b981;
    border-left: 5px solid #10b981;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

html.dark-mode .toast-error-custom {
    background: #1f2937 !important; /* Dark gray background */
    color: #ef4444 !important; /* Red text */
    border: 1px solid #ef4444;
    border-left: 5px solid #ef4444;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

html.dark-mode .toast-warning-custom {
    background: #1f2937 !important; /* Dark gray background */
    color: #f59e0b !important; /* Orange text */
    border: 1px solid #f59e0b;
    border-left: 5px solid #f59e0b;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

html.dark-mode .toast-info-custom {
    background: #1f2937 !important; /* Dark gray background */
    color: #3b82f6 !important; /* Blue text */
    border: 1px solid #3b82f6;
    border-left: 5px solid #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* Toast Icon Styles */
.blazored-toast-icon {
    margin-right: 14px;
    font-size: 22px;
    flex-shrink: 0;
}

/* ===== RTL Support for Arabic ===== */

/* RTL: Position toast on the left side */
[dir="rtl"] #blazored-toast-container,
[dir="rtl"] [id^="blazored-toast-container"],
[dir="rtl"] .blazored-toast-container {
    inset: 80px auto auto 24px !important; /* top left */
    right: auto !important;
    left: 24px !important;
}

/* RTL: Flip animation - slide in from left */
[dir="rtl"] .blazored-toast {
    animation: slideInLeft 0.3s ease-out;
}

[dir="rtl"] .blazored-toast:hover {
    transform: translateX(4px); /* Move right instead of left */
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* RTL: Flip icon margin */
[dir="rtl"] .blazored-toast-icon {
    margin-right: 0;
    margin-left: 14px;
}

/* RTL: Flip border - show on right side instead of left */
[dir="rtl"] html:not(.dark-mode) .toast-success-custom {
    border-left: 1px solid #10b981;
    border-right: 5px solid #10b981;
}

[dir="rtl"] html:not(.dark-mode) .toast-success-custom:hover {
    border-left-width: 1px;
    border-right-width: 8px;
}

[dir="rtl"] html:not(.dark-mode) .toast-error-custom {
    border-left: 1px solid #ef4444;
    border-right: 5px solid #ef4444;
}

[dir="rtl"] html:not(.dark-mode) .toast-error-custom:hover {
    border-left-width: 1px;
    border-right-width: 8px;
}

[dir="rtl"] html:not(.dark-mode) .toast-warning-custom {
    border-left: 1px solid #f59e0b;
    border-right: 5px solid #f59e0b;
}

[dir="rtl"] html:not(.dark-mode) .toast-warning-custom:hover {
    border-left-width: 1px;
    border-right-width: 8px;
}

[dir="rtl"] html:not(.dark-mode) .toast-info-custom {
    border-left: 1px solid #3b82f6;
    border-right: 5px solid #3b82f6;
}

[dir="rtl"] html:not(.dark-mode) .toast-info-custom:hover {
    border-left-width: 1px;
    border-right-width: 8px;
}

/* RTL: Flip border in dark mode */
[dir="rtl"] html.dark-mode .toast-success-custom {
    border-left: 1px solid #10b981;
    border-right: 5px solid #10b981;
}

[dir="rtl"] html.dark-mode .toast-error-custom {
    border-left: 1px solid #ef4444;
    border-right: 5px solid #ef4444;
}

[dir="rtl"] html.dark-mode .toast-warning-custom {
    border-left: 1px solid #f59e0b;
    border-right: 5px solid #f59e0b;
}

[dir="rtl"] html.dark-mode .toast-info-custom {
    border-left: 1px solid #3b82f6;
    border-right: 5px solid #3b82f6;
}

/* Toast Message */
.blazored-toast-message {
    font-size: 15px;
    line-height: 1.6;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Toast Title */
.blazored-toast .toast-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Progress Bar */
.blazored-toast-progress {
    height: 3px;
    border-radius: 2px;
    margin-top: 12px;
}

html:not(.dark-mode) .toast-success-custom .blazored-toast-progress {
    background-color: rgba(16, 185, 129, 0.2) !important;
}

html:not(.dark-mode) .toast-success-custom .blazored-toast-progress > div {
    background-color: #10b981 !important;
}

html:not(.dark-mode) .toast-error-custom .blazored-toast-progress {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

html:not(.dark-mode) .toast-error-custom .blazored-toast-progress > div {
    background-color: #ef4444 !important;
}

html:not(.dark-mode) .toast-warning-custom .blazored-toast-progress {
    background-color: rgba(245, 158, 11, 0.2) !important;
}

html:not(.dark-mode) .toast-warning-custom .blazored-toast-progress > div {
    background-color: #f59e0b !important;
}

html:not(.dark-mode) .toast-info-custom .blazored-toast-progress {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

html:not(.dark-mode) .toast-info-custom .blazored-toast-progress > div {
    background-color: #3b82f6 !important;
}

/* Light mode icon colors */
html:not(.dark-mode) .toast-success-custom .blazored-toast-icon {
    color: #10b981;
}

html:not(.dark-mode) .toast-error-custom .blazored-toast-icon {
    color: #ef4444;
}

html:not(.dark-mode) .toast-warning-custom .blazored-toast-icon {
    color: #f59e0b;
}

html:not(.dark-mode) .toast-info-custom .blazored-toast-icon {
    color: #3b82f6;
}

/* Dark mode icon colors */
html.dark-mode .toast-success-custom .blazored-toast-icon {
    color: #10b981;
}

html.dark-mode .toast-error-custom .blazored-toast-icon {
    color: #ef4444;
}

html.dark-mode .toast-warning-custom .blazored-toast-icon {
    color: #f59e0b;
}

html.dark-mode .toast-info-custom .blazored-toast-icon {
    color: #3b82f6;
}

/* Dark mode progress bars */
html.dark-mode .toast-success-custom .blazored-toast-progress {
    background-color: rgba(16, 185, 129, 0.2) !important;
}

html.dark-mode .toast-success-custom .blazored-toast-progress > div {
    background-color: #10b981 !important;
}

html.dark-mode .toast-error-custom .blazored-toast-progress {
    background-color: rgba(239, 68, 68, 0.2) !important;
}

html.dark-mode .toast-error-custom .blazored-toast-progress > div {
    background-color: #ef4444 !important;
}

html.dark-mode .toast-warning-custom .blazored-toast-progress {
    background-color: rgba(245, 158, 11, 0.2) !important;
}

html.dark-mode .toast-warning-custom .blazored-toast-progress > div {
    background-color: #f59e0b !important;
}

html.dark-mode .toast-info-custom .blazored-toast-progress {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

html.dark-mode .toast-info-custom .blazored-toast-progress > div {
    background-color: #3b82f6 !important;
}
