/**
 * Custom Toast Notifications
 * Designed for Linencraft mobile web app
 * Note: Uses CSS variables from design-system.css
 */

:root {
    /* Toast-specific aliases for semantic colors from design-system */
    --toast-success: var(--color-success);
    --toast-error: var(--color-danger);
    --toast-warning: var(--color-warning);
    --toast-info: var(--color-info);
    --toast-gold: var(--color-gold);
}

/* Toast Container */
.custom-toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
    width: calc(100% - var(--space-8));
    max-width: 400px;
}

/* Individual Toast */
.custom-toast {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 14px;
    pointer-events: all;
    animation: slideDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--toast-gold);
    min-height: 60px;
}

/* Toast Types */
.custom-toast.success {
    border-left-color: var(--toast-success);
}

.custom-toast.error {
    border-left-color: var(--toast-error);
}

.custom-toast.warning {
    border-left-color: var(--toast-warning);
}

.custom-toast.info {
    border-left-color: var(--toast-info);
}

/* Toast Icon */
.custom-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-2xl);
    color: var(--color-white);
    background: var(--toast-gold);
}

.custom-toast.success .custom-toast-icon {
    background: linear-gradient(135deg, var(--toast-success) 0%, #17A673 100%);
}

.custom-toast.error .custom-toast-icon {
    background: linear-gradient(135deg, var(--toast-error) 0%, #C73A2E 100%);
}

.custom-toast.warning .custom-toast-icon {
    background: linear-gradient(135deg, var(--toast-warning) 0%, #E0A80D 100%);
}

.custom-toast.info .custom-toast-icon {
    background: linear-gradient(135deg, var(--toast-info) 0%, #3A5FA8 100%);
}

/* Toast Content */
.custom-toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-toast-title {
    font-family: var(--font-secondary);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-gray-800);
    line-height: 1.3;
}

.custom-toast-message {
    font-family: var(--font-secondary);
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--color-gray-700);
    line-height: 1.4;
}

/* Close Button */
.custom-toast-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-gray-100);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-base);
    color: var(--color-gray-500);
    font-size: var(--text-base);
}

.custom-toast-close:hover {
    background: var(--color-gray-300);
    color: var(--color-gray-700);
    transform: scale(1.1);
}

/* Progress Bar */
.custom-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--toast-gold);
    width: 100%;
    transform-origin: left;
    animation: progressShrink 5s linear forwards;
    opacity: 0.6;
}

.custom-toast.success .custom-toast-progress {
    background: var(--toast-success);
}

.custom-toast.error .custom-toast-progress {
    background: var(--toast-error);
}

.custom-toast.warning .custom-toast-progress {
    background: var(--toast-warning);
}

.custom-toast.info .custom-toast-progress {
    background: var(--toast-info);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.custom-toast.removing {
    animation: slideOut 0.3s ease forwards;
}

/* Touch Swipe Indicator */
.custom-toast.swiping {
    transition: transform 0.1s ease;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .custom-toast-container {
        top: 70px;
        width: calc(100% - 24px);
    }

    .custom-toast {
        padding: 14px 16px;
        border-radius: 14px;
    }

    .custom-toast-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .custom-toast-title {
        font-size: 13px;
    }

    .custom-toast-message {
        font-size: 12px;
    }
}

/* Tablet and Desktop - Top Right */
@media (min-width: 768px) {
    .custom-toast-container {
        left: auto;
        right: 20px;
        transform: none;
        max-width: 380px;
    }

    .custom-toast {
        animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }

    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(400px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}
