/**
 * Toast Notifications System - Sprint 5
 * Sistema moderno de notificações toast com animações suaves
 */

/* Container de Toasts */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 40rem;
    pointer-events: none;
}

@media (max-width: 768px) {
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* Toast Base */
.toast {
    pointer-events: auto;
    background: white;
    border-radius: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    min-width: 30rem;
    max-width: 40rem;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
    transform-origin: top center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Dark mode */
.dark .toast {
    background: #1f2937;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Toast Animations */
@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(120%) scale(0.8);
        opacity: 0;
    }
}

.toast-enter {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-exit {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 1, 1);
}

/* Progress Bar (auto-dismiss indicator) */
.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    width: 100%;
    transform-origin: left;
    animation: toast-progress 5s linear;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast.no-auto-dismiss::before {
    display: none;
}

/* Toast Icon */
.toast-icon {
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.4rem;
}

/* Toast Content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toast-title {
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.4;
    margin: 0;
}

.toast-message {
    font-size: 1.4rem;
    line-height: 1.5;
    opacity: 0.9;
    margin: 0;
}

/* Toast Close Button */
.toast-close {
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all 0.2s;
    opacity: 0.5;
    color: currentColor;
    padding: 0;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.dark .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Toast Types */

/* Success */
.toast-success {
    border-left-color: #10b981;
    color: #065f46;
}

.dark .toast-success {
    color: #d1fae5;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #065f46;
}

.dark .toast-success .toast-icon {
    background: #065f46;
    color: #d1fae5;
}

/* Error */
.toast-error {
    border-left-color: #ef4444;
    color: #991b1b;
}

.dark .toast-error {
    color: #fecaca;
}

.toast-error .toast-icon {
    background: #fecaca;
    color: #991b1b;
}

.dark .toast-error .toast-icon {
    background: #991b1b;
    color: #fecaca;
}

/* Warning */
.toast-warning {
    border-left-color: #f59e0b;
    color: #92400e;
}

.dark .toast-warning {
    color: #fef3c7;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #92400e;
}

.dark .toast-warning .toast-icon {
    background: #92400e;
    color: #fef3c7;
}

/* Info */
.toast-info {
    border-left-color: #3b82f6;
    color: #1e3a8a;
}

.dark .toast-info {
    color: #dbeafe;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #1e3a8a;
}

.dark .toast-info .toast-icon {
    background: #1e3a8a;
    color: #dbeafe;
}

/* Toast with Action Button */
.toast-action {
    margin-top: 0.8rem;
}

.toast-action-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: currentColor;
    padding: 0.6rem 1.2rem;
    border-radius: 0.4rem;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-action-btn:hover {
    background: currentColor;
    color: white;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }

    .toast-enter,
    .toast-exit {
        animation: none;
    }

    .toast::before {
        animation: none;
    }
}

/* Loading Toast (com spinner) */
.toast-loading {
    border-left-color: #6366f1;
    color: #4338ca;
}

.dark .toast-loading {
    color: #c7d2fe;
}

.toast-loading .toast-icon {
    background: transparent;
    color: #6366f1;
}

.toast-loading .toast-icon i {
    animation: spin 1s linear infinite;
}

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

/* Compact Toast (smaller version) */
.toast-compact {
    padding: 1rem 1.2rem;
    min-width: auto;
}

.toast-compact .toast-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
}

.toast-compact .toast-title {
    font-size: 1.4rem;
}

.toast-compact .toast-message {
    font-size: 1.3rem;
}

/* Stack multiple toasts */
.toast-container > .toast:not(:last-child) {
    margin-bottom: 0;
}

/* Hover pause auto-dismiss */
.toast:hover::before {
    animation-play-state: paused;
}
