/*
    Sistema de Notificaciones Toast - TiendaCloud
    Versión mejorada con diseño moderno y consistente
    
    Author: André Luiz Rabêllo (modificado para TiendaCloud)
    Version: 2.0.0
*/

/* Contenedor principal de toasts */
#jq-toast-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 360px;
    max-width: 450px;
    z-index: 10000;
    pointer-events: none;
}

/* Posicionamiento responsivo */
@media only screen and (max-width: 600px) {
    #jq-toast-container {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 300px;
        max-width: calc(100% - 2rem);
    }
}

@media only screen and (min-width: 601px) and (max-width: 992px) {
    #jq-toast-container {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 360px;
        max-width: 400px;
    }
}

@media only screen and (min-width: 993px) {
    #jq-toast-container {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 360px;
        max-width: 450px;
    }
}

/* Toast moderno */
.jq-toast-modern {
    background: var(--surface-2, #ffffff);
    border: 1px solid var(--border-weak, #e5e7eb);
    border-left: 3px solid var(--toast-border-color, var(--brand, #3b82f6));
    border-radius: 8px;
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));
    color: var(--text-primary, #1f2937);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    max-width: 100%;
    min-width: 320px;
    min-height: 40px;
    overflow: hidden;
    position: relative;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    pointer-events: auto;
}

.jq-toast-modern:hover {
    box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
    transform: scale(1.02);
}

.jq-toast-modern:active {
    cursor: grabbing;
}

/* Contenido del toast */
.toast-content {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    position: relative;
    z-index: 2;
}

/* Icono del toast */
.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: var(--toast-bg-color, rgba(59, 130, 246, 0.1));
    color: var(--toast-color, var(--brand));
    flex-shrink: 0;
}

.toast-icon .material-symbols-rounded {
    font-size: 1rem;
    font-variation-settings: 'FILL' 1;
}

/* Mensaje del toast */
.toast-message {
    flex: 1;
    color: var(--text-primary, #1f2937);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    margin: 0;
    word-wrap: break-word;
}

/* Botón de cerrar */
.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: var(--surface-1, #f9fafb);
    color: var(--text-primary, #1f2937);
}

.toast-close .material-symbols-rounded {
    font-size: 1rem;
    font-variation-settings: 'FILL' 1;
}

/* Barra de progreso */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--toast-color, var(--brand));
    width: 100%;
    transform-origin: left;
    transition: width 0.02s linear;
}

/* Estados específicos por tipo */
.jq-toast-modern[data-type="success"] {
    background: #f0fdf4;
    border-left-color: var(--success, #22c55e);
}

.jq-toast-modern[data-type="success"] .toast-icon {
    background: #dcfce7;
    color: var(--success, #22c55e);
}

.jq-toast-modern[data-type="success"] .toast-progress {
    background: var(--success, #22c55e);
}

.jq-toast-modern[data-type="error"] {
    background: #ef4444;
    border-left-color: var(--danger, #fef2f2);
}

.jq-toast-modern[data-type="error"] .toast-message {
    color: var(--bs-white);

}

.jq-toast-modern[data-type="error"] .toast-icon {
    background: #fecaca;
    color: var(--danger, #ef4444);
}

.jq-toast-modern[data-type="error"] .toast-progress {
    background: var(--danger, #ef4444);
}

.jq-toast-modern[data-type="warning"] {
    background: #fffbeb;
    border-left-color: var(--warning, #f59e0b);
}

.jq-toast-modern[data-type="warning"] .toast-icon {
    background: #fed7aa;
    color: var(--warning, #f59e0b);
}

.jq-toast-modern[data-type="warning"] .toast-progress {
    background: var(--warning, #f59e0b);
}

.jq-toast-modern[data-type="info"] {
    background: #f0f9ff;
    border-left-color: var(--info, #06b6d4);
}

.jq-toast-modern[data-type="info"] .toast-icon {
    background: #cffafe;
    color: var(--info, #06b6d4);
}

.jq-toast-modern[data-type="info"] .toast-progress {
    background: var(--info, #06b6d4);
}

/* Animaciones */
@keyframes toastSlideIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

.jq-toast-modern.slide-in {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.jq-toast-modern.slide-out {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Estados de arrastre */
.jq-toast-modern.panning {
    transition: none;
}

/* Responsive para móviles */
@media only screen and (max-width: 600px) {
    .jq-toast-modern {
        margin-bottom: 0.5rem;
        min-height: 38px;
        min-width: 280px;
    }

    .toast-content {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .toast-icon {
        width: 22px;
        height: 22px;
    }

    .toast-icon .material-symbols-rounded {
        font-size: 0.9375rem;
    }

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

    .toast-close {
        width: 20px;
        height: 20px;
    }

    .toast-close .material-symbols-rounded {
        font-size: 0.875rem;
    }
}

/* Soporte para modo oscuro/claro */
@media (prefers-color-scheme: dark) {
    .jq-toast-modern {
        background: var(--surface-2);
        border-color: var(--border-weak);
    }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .jq-toast-modern {
        transition: none;
    }

    .jq-toast-modern:hover {
        transform: none;
    }

    .toast-progress {
        transition: none;
    }
}

/* Focus visible para accesibilidad */
.toast-close:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Estados de hover mejorados */
.jq-toast-modern:hover .toast-progress {
    opacity: 0.8;
}

/* Animación de entrada escalonada para múltiples toasts */
.jq-toast-modern:nth-child(1) { animation-delay: 0s; }
.jq-toast-modern:nth-child(2) { animation-delay: 0.1s; }
.jq-toast-modern:nth-child(3) { animation-delay: 0.2s; }
.jq-toast-modern:nth-child(4) { animation-delay: 0.3s; }
.jq-toast-modern:nth-child(5) { animation-delay: 0.4s; }
