/**
 * NetDuty Notification System Styles
 *
 * Styles for toast notifications and modal dialogs
 */

/* ============================================================================
   TOAST CONTAINER
   ============================================================================ */

.toast-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* Position variants */
.toast-container-top-right {
    top: 24px;
    right: 24px;
    align-items: flex-end;
}

.toast-container-top-left {
    top: 24px;
    left: 24px;
    align-items: flex-start;
}

.toast-container-bottom-right {
    bottom: 24px;
    right: 24px;
    align-items: flex-end;
}

.toast-container-bottom-left {
    bottom: 24px;
    left: 24px;
    align-items: flex-start;
}

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

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

/* Mobile responsive */
@media (max-width: 640px) {
    .toast-container {
        left: 12px !important;
        right: 12px !important;
        top: 12px !important;
        transform: none !important;
    }

    .toast-container-bottom-right,
    .toast-container-bottom-left,
    .toast-container-bottom-center {
        bottom: 12px !important;
        top: auto !important;
    }
}

/* ============================================================================
   TOAST NOTIFICATION
   ============================================================================ */

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    min-height: 56px;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
    color: white;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

/* Type variants */
.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Toast icon */
.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: bold;
}

/* Toast message */
.toast-message {
    flex: 1;
    word-wrap: break-word;
    font-weight: 500;
}

/* Toast dismiss button */
.toast-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.toast-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toast-dismiss:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ============================================================================
   TOAST ANIMATIONS
   ============================================================================ */

.toast-enter {
    animation: toastSlideIn 0.2s ease-out forwards;
}

.toast-exit {
    animation: toastSlideOut 0.15s ease-in forwards;
}

@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%);
    }
}

/* Left-side animations */
.toast-container-top-left .toast-enter,
.toast-container-bottom-left .toast-enter {
    animation: toastSlideInLeft 0.2s ease-out forwards;
}

.toast-container-top-left .toast-exit,
.toast-container-bottom-left .toast-exit {
    animation: toastSlideOutLeft 0.15s ease-in forwards;
}

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

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

/* Center animations */
.toast-container-top-center .toast-enter,
.toast-container-bottom-center .toast-enter {
    animation: toastFadeIn 0.2s ease-out forwards;
}

.toast-container-top-center .toast-exit,
.toast-container-bottom-center .toast-exit {
    animation: toastFadeOut 0.15s ease-in forwards;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Mobile responsive toast */
@media (max-width: 640px) {
    .toast {
        min-width: 280px;
        max-width: 100%;
        font-size: 13px;
    }
}

/* ============================================================================
   DIALOG OVERLAY
   ============================================================================ */

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: dialogOverlayFadeIn 0.2s ease-out;
    padding: 16px;
}

@keyframes dialogOverlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   DIALOG CONTAINER
   ============================================================================ */

.dialog-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: dialogSlideUp 0.2s ease-out;
}

@keyframes dialogSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive dialog */
@media (max-width: 640px) {
    .dialog-container {
        min-width: 280px;
        padding: 20px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-enter,
    .toast-exit,
    .dialog-overlay,
    .dialog-container {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .toast {
        border: 2px solid white;
    }

    .dialog-container {
        border: 2px solid black;
    }
}

/* Focus visible for keyboard navigation */
.toast-dismiss:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Loading spinner for loading toasts */
.toast-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress bar for timed toasts (optional enhancement) */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    transform-origin: left;
}

.toast-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}
