/**
 * Toast Notification System
 * Modernes Toast-Notification-System mit Animationen für RIP App V6
 */

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

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse; /* Neue Toasts oben */
    gap: 1rem;
    max-width: 360px;
    pointer-events: none; /* Container blockiert keine Klicks */
}

/* ========== TOAST ITEM ========== */

.toast-item {
    position: relative;
    background: #1c1c1f;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-height: 64px;
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: all; /* Toast selbst ist klickbar */
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========== TOAST TYPES ========== */

/* Success Toast */
.toast-item.toast-success {
    border-color: #198754;
    background: linear-gradient(135deg, #1c1c1f 0%, rgba(25, 135, 84, 0.15) 100%);
}

.toast-item.toast-success .toast-progress {
    background: #198754;
}

/* Error Toast */
.toast-item.toast-error {
    border-color: #dc3545;
    background: linear-gradient(135deg, #1c1c1f 0%, rgba(220, 53, 69, 0.15) 100%);
}

.toast-item.toast-error .toast-progress {
    background: #dc3545;
}

/* Warning Toast */
.toast-item.toast-warning {
    border-color: #ffc107;
    background: linear-gradient(135deg, #1c1c1f 0%, rgba(255, 193, 7, 0.15) 100%);
}

.toast-item.toast-warning .toast-progress {
    background: #ffc107;
}

/* Info Toast */
.toast-item.toast-info {
    border-color: #0dcaf0;
    background: linear-gradient(135deg, #1c1c1f 0%, rgba(13, 202, 240, 0.15) 100%);
}

.toast-item.toast-info .toast-progress {
    background: #0dcaf0;
}

/* ========== TOAST CONTENT ========== */

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.toast-message {
    flex: 1;
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-word;
}

/* ========== TOAST CLOSE BUTTON ========== */

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: Arial, sans-serif;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.toast-close:active {
    transform: scale(0.95);
}

/* ========== TOAST PROGRESS BAR ========== */

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 12px 12px;
    z-index: 1;
    transform-origin: left;
    animation: progress-shrink 5000ms linear forwards;
}

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

/* Slide In Animation */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide Out Animation */
@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Progress Bar Shrink Animation */
@keyframes progress-shrink {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* ========== RESPONSIVE ========== */

/* Tablets und kleine Desktops */
@media (max-width: 768px) {
    .toast-container {
        max-width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 1rem;
    }

    .toast-item {
        padding: 0.875rem 1rem;
        min-height: 56px;
    }

    .toast-message {
        font-size: 0.9rem;
    }
}

/* Mobile Geräte */
@media (max-width: 480px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
    }

    .toast-item {
        padding: 0.75rem 0.875rem;
        min-height: 52px;
    }

    .toast-message {
        font-size: 0.875rem;
    }

    .toast-close {
        width: 20px;
        height: 20px;
        font-size: 1.25rem;
    }
}

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

/* Reduzierte Bewegung für Benutzer mit Präferenz */
@media (prefers-reduced-motion: reduce) {
    .toast-item {
        animation: fadeIn 0.2s ease forwards;
    }

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

/* ========== HOVER EFFECTS ========== */

.toast-item:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

/* ========== STACKING ========== */

/* Gestaffelte z-index für korrektes Stacking */
.toast-item:nth-child(1) { z-index: 100; }
.toast-item:nth-child(2) { z-index: 99; }
.toast-item:nth-child(3) { z-index: 98; }
.toast-item:nth-child(4) { z-index: 97; }
.toast-item:nth-child(5) { z-index: 96; }
.toast-item:nth-child(n+6) { z-index: 95; }

/* ========== DARK MODE OPTIMIERUNG ========== */

/* Zusätzliche Optimierungen für Dark Mode */
.toast-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    border-radius: 12px;
}

/* ========== SCROLLBAR (falls Container scrollbar bekommt) ========== */

.toast-container::-webkit-scrollbar {
    width: 6px;
}

.toast-container::-webkit-scrollbar-track {
    background: transparent;
}

.toast-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.toast-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
