/* ============================================================
   Toast Notifications for WooCommerce – Frontend Styles
   Basado en la UX / estructura visual de ProveSource
   ============================================================ */

/* ── Contenedor principal ── */
#tnfw-container {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    max-width: 340px;
    width: 100%;
}

/* Posiciones */
#tnfw-container.pos-bottom-left  { bottom: 24px; left: 24px; }
#tnfw-container.pos-bottom-right { bottom: 24px; right: 24px; }
#tnfw-container.pos-top-left     { top: 24px;    left: 24px; }
#tnfw-container.pos-top-right    { top: 24px;    right: 24px; }

/* ── Toast card ── */
.tnfw-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.13);
    pointer-events: all;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    max-width: 340px;
    border-left: 4px solid #7825f3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* ── Imagen del producto ── */
.tnfw-toast__img {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}

.tnfw-toast__img-placeholder {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7825f3 0%, #a855f7 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
}

/* ── Cuerpo del toast ── */
.tnfw-toast__body {
    flex: 1;
    min-width: 0;
}

.tnfw-toast__message {
    color: #1f2937;
    font-weight: 500;
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tnfw-toast__meta {
    color: #6b7280;
    font-size: 12px;
    margin: 0;
}

.tnfw-toast__time {
    color: #9ca3af;
    font-size: 11px;
    margin-top: 3px;
}

/* ── Botón cerrar ── */
.tnfw-toast__close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}
.tnfw-toast__close:hover { color: #374151; }

/* ── Barra de progreso ── */
.tnfw-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #7825f3, #a855f7);
    border-radius: 0 0 0 12px;
    width: 100%;
    transform-origin: left;
    animation: tnfw-progress var(--tnfw-display-time, 5s) linear forwards;
}

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

/* ── Animaciones de entrada/salida ── */

/* Slide (desde la izquierda o derecha según posición) */
.tnfw-toast.anim-slide {
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tnfw-toast.anim-slide.entering-left  { opacity: 0; transform: translateX(-110%); }
.tnfw-toast.anim-slide.entering-right { opacity: 0; transform: translateX(110%); }
.tnfw-toast.anim-slide.visible        { opacity: 1; transform: translateX(0); }
.tnfw-toast.anim-slide.leaving        { opacity: 0; transform: translateY(20px) scale(0.95); }

/* Fade */
.tnfw-toast.anim-fade {
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.tnfw-toast.anim-fade.entering-left,
.tnfw-toast.anim-fade.entering-right { opacity: 0; transform: scale(0.9); }
.tnfw-toast.anim-fade.visible        { opacity: 1; transform: scale(1); }
.tnfw-toast.anim-fade.leaving        { opacity: 0; transform: scale(0.9); }

/* Bounce */
.tnfw-toast.anim-bounce {
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1.5, 0.36, 1);
}
.tnfw-toast.anim-bounce.entering-left  { opacity: 0; transform: translateX(-110%) scale(0.8); }
.tnfw-toast.anim-bounce.entering-right { opacity: 0; transform: translateX(110%) scale(0.8); }
.tnfw-toast.anim-bounce.visible        { opacity: 1; transform: translateX(0) scale(1); }
.tnfw-toast.anim-bounce.leaving        { opacity: 0; transform: scale(0.85) translateY(10px); }

/* ── Responsive ── */
@media (max-width: 480px) {
    #tnfw-container {
        max-width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px !important;
    }
    #tnfw-container.pos-bottom-left,
    #tnfw-container.pos-bottom-right {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
    #tnfw-container.pos-top-left,
    #tnfw-container.pos-top-right {
        top: 16px;
        left: 16px;
        right: 16px;
    }
}
