/* ==========================================================================
   FLOW TOAST COMPONENT (VFWToast)
   ========================================================================== */

.vfw-toast {
    position: fixed;
    bottom: var(--vfw-space-lg);
    right: var(--vfw-space-lg);
    background-color: var(--vfw-color-surface);
    border-radius: var(--vfw-border-radius);
    padding: var(--vfw-space-md);
    box-shadow: var(--vfw-shadow-bottom-lg);
    z-index: var(--vfw-z-toast, 400);
    width: 320px;
    max-width: calc(100vw - var(--vfw-space-xl));
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity var(--vfw-transition-normal), transform var(--vfw-transition-normal), visibility var(--vfw-transition-normal);
}

/* Visibility states */
.vfw-toast-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

.vfw-toast-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Static modifier (for testing inline layout tables) */
.vfw-toast.vfw-toast-static {
    position: relative;
    bottom: auto;
    right: auto;
    top: auto;
    left: auto;
    max-width: 100%;
    width: 100%;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none;
}

/* --- 1. STATUS VARIANT STYLES --- */

.vfw-toast-info {
    border: 1.5px solid var(--vfw-color-info-border);
}

.vfw-toast-info .vfw-toast-icon {
    color: var(--vfw-color-info);
}

.vfw-toast-success {
    border: 1.5px solid var(--vfw-color-success-border);
}

.vfw-toast-success .vfw-toast-icon {
    color: var(--vfw-color-success);
}

.vfw-toast-warning {
    border: 1.5px solid var(--vfw-color-warning-border);
}

.vfw-toast-warning .vfw-toast-icon {
    color: var(--vfw-color-warning);
}

.vfw-toast-error {
    border: 1.5px solid var(--vfw-color-error-border);
}

.vfw-toast-error .vfw-toast-icon {
    color: var(--vfw-color-error);
}

.vfw-toast-neutral {
    border: 1.5px solid var(--vfw-color-border);
}

.vfw-toast-neutral .vfw-toast-icon {
    color: var(--vfw-color-text-muted);
}

/* --- 2. INTERNAL STRUCTURES --- */

.vfw-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vfw-toast-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2.2;
}

.vfw-toast-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Ensures text wrapping works properly */
}

.vfw-toast-title {
    font-size: var(--vfw-font-size-sm);
    font-weight: 700;
    color: var(--vfw-color-text);
    line-height: 1.2;
}

.vfw-toast-description {
    font-size: 13px;
    color: var(--vfw-color-text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.vfw-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--vfw-color-text-muted);
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--vfw-transition-fast);
}

.vfw-toast-close:hover {
    color: var(--vfw-color-text);
}

.vfw-toast-close svg {
    width: 100%;
    height: 100%;
    stroke-width: 2.5;
}

/* --- 3. VIEWPORT MOBILE MODIFIER --- */

.vfw-toast-mobile {
    padding: var(--vfw-space-sm) 12px;
    gap: 10px;
    width: 280px;
}

.vfw-toast-mobile .vfw-toast-icon {
    width: 16px;
    height: 16px;
}

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

.vfw-toast-mobile .vfw-toast-description {
    font-size: 12px;
}

.vfw-toast-mobile .vfw-toast-close {
    width: 12px;
    height: 12px;
}

/* Media Query Responsive Sizing Fallback */
@media (max-width: 768px) {
    .vfw-toast:not(.vfw-toast-desktop):not(.vfw-toast-static) {
        padding: var(--vfw-space-sm) 12px;
        gap: 10px;
        width: 280px;
        bottom: var(--vfw-space-md);
        right: var(--vfw-space-md);
        max-width: calc(100vw - var(--vfw-space-lg));
    }

    .vfw-toast:not(.vfw-toast-desktop):not(.vfw-toast-static) .vfw-toast-icon {
        width: 16px;
        height: 16px;
    }

    .vfw-toast:not(.vfw-toast-desktop):not(.vfw-toast-static) .vfw-toast-title {
        font-size: 13px;
    }

    .vfw-toast:not(.vfw-toast-desktop):not(.vfw-toast-static) .vfw-toast-description {
        font-size: 12px;
    }

    .vfw-toast:not(.vfw-toast-desktop):not(.vfw-toast-static) .vfw-toast-close {
        width: 12px;
        height: 12px;
    }
}

/* Global Dynamic Toast Stacking Container */
.vfw-toast-container {
    position: fixed;
    bottom: var(--vfw-space-lg);
    right: var(--vfw-space-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: var(--vfw-z-toast, 400);
    pointer-events: none;
}

.vfw-toast-container .vfw-toast {
    position: relative;
    bottom: auto;
    right: auto;
    z-index: auto;
    pointer-events: auto;
}
