/* Enhanced Toast Styling for UJN HR System */

/* Toast container improvements */
.toast-container {
    z-index: 9999;
    pointer-events: none;
}

.toast-container > * {
    pointer-events: auto;
}

/* Enhanced toast styling */
.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Toast type specific styling */
.toast-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-left: 4px solid #1e7e34;
}

.toast-error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
    border-left: 4px solid #c82333;
}

.toast-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
    border-left: 4px solid #e0a800;
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
    color: white;
    border-left: 4px solid #138496;
}

/* Toast header */
.toast-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
    font-weight: 600;
    padding: 12px 16px 8px;
}

.toast-header .close {
    color: inherit;
    opacity: 0.7;
    text-shadow: none;
    transition: opacity 0.2s ease;
}

.toast-header .close:hover {
    opacity: 1;
}

/* Toast body */
.toast-body {
    padding: 8px 16px 12px;
    color: inherit;
}

/* Progress bar styling */
.toast-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    transition: width 0.1s linear;
}

/* Toast icons */
.toast-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* Toast animations */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-slide-in {
    animation: toastSlideIn 0.3s ease-out;
}

.toast-slide-out {
    animation: toastSlideOut 0.3s ease-in;
}

/* Toast Loader Styling */
.toast-loader {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    animation: toastLoaderSlideIn 0.3s ease-out;
}

.toast-loader-spinner {
    flex-shrink: 0;
}

.toast-loader-spinner .spinner-border {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.toast-loader-text {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

@keyframes toastLoaderSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastLoaderSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-loader.hiding {
    animation: toastLoaderSlideOut 0.3s ease-in;
}

/* Position specific styling */
.toast-container.top-right {
    top: 20px;
    right: 20px;
}

.toast-container.top-left {
    top: 20px;
    left: 20px;
}

.toast-container.top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.toast-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

.toast-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

.toast-container.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Responsive design */
@media (max-width: 768px) {
    .toast {
        min-width: 280px;
        max-width: calc(100vw - 40px);
        margin: 0 10px 10px;
    }
    
    .toast-container {
        width: 100%;
        max-width: none;
    }
    
    .toast-container.top-center,
    .toast-container.bottom-center {
        left: 0;
        transform: none;
        width: 100%;
    }
    
    .toast-loader {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        width: calc(100vw - 20px);
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .toast {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .toast-warning {
        background: linear-gradient(135deg, #ffc107, #fd7e14);
        color: #000;
    }
    
    .toast-loader {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        backdrop-filter: blur(15px);
    }
}

/* Accessibility improvements */
.toast:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.toast-header .close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

.toast-loader:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .toast {
        border: 2px solid currentColor;
    }
    
    .toast-success {
        background: #28a745;
        color: white;
    }
    
    .toast-error {
        background: #dc3545;
        color: white;
    }
    
    .toast-warning {
        background: #ffc107;
        color: black;
    }
    
    .toast-info {
        background: #17a2b8;
        color: white;
    }
    
    .toast-loader {
        background: #000;
        color: #fff;
        border: 2px solid currentColor;
    }
}

/* Loading state animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.toast-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Toast queue management */
.toast-queue-full {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}
