/**
 * NinjaTech - Modern Floating Toasts System
 * Estilos para notificaciones flotantes globales (Frontend & Admin)
 * Tema oscuro, esquinas redondeadas, barra de progreso y animaciones suaves.
 */

:root {
    --nt-toast-success: var(--nt-primary, #00e676);
    --nt-toast-warning: #f59e0b;
    --nt-toast-error: #ef4444;
    --nt-toast-info: var(--nt-secondary, #00b0ff);
    --nt-toast-bg: var(--nt-surface, #0e1319);
    --nt-toast-text: var(--nt-text, #ffffff);
    --nt-toast-muted: var(--nt-text-muted, #94a3b8);
}

/* Contenedor flotante en esquina superior derecha */
.nt-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 420px;
    width: 100%;
    pointer-events: none; /* No bloquea clics debajo */
}

/* Tarjeta individual de Toast */
.nt-toast {
    position: relative;
    pointer-events: auto; /* Permite interacción (clic, hover) */
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1rem 1.15rem 1rem;
    background: rgba(14, 19, 25, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.35s ease,
                margin-bottom 0.35s ease,
                padding 0.35s ease;
    max-height: 250px;
}

/* Estado visible */
.nt-toast.nt-toast-show {
    transform: translateX(0);
    opacity: 1;
}

/* Estado de salida */
.nt-toast.nt-toast-hide {
    transform: translateX(120%);
    opacity: 0;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: -0.75rem !important;
    border-width: 0 !important;
}

/* Borde acento izquierdo según el tipo */
.nt-toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.nt-toast-success::before {
    background: var(--nt-toast-success);
    box-shadow: 0 0 10px var(--nt-toast-success);
}
.nt-toast-warning::before {
    background: var(--nt-toast-warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
.nt-toast-error::before,
.nt-toast-danger::before {
    background: var(--nt-toast-error);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}
.nt-toast-info::before {
    background: var(--nt-toast-info);
    box-shadow: 0 0 10px rgba(0, 176, 255, 0.5);
}

/* Icono del Toast */
.nt-toast-icon-wrap {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.nt-toast-success .nt-toast-icon-wrap {
    background: rgba(0, 230, 118, 0.14);
    color: var(--nt-toast-success);
    border: 1px solid rgba(0, 230, 118, 0.25);
}
.nt-toast-warning .nt-toast-icon-wrap {
    background: rgba(245, 158, 11, 0.14);
    color: var(--nt-toast-warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.nt-toast-error .nt-toast-icon-wrap,
.nt-toast-danger .nt-toast-icon-wrap {
    background: rgba(239, 68, 68, 0.14);
    color: var(--nt-toast-error);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.nt-toast-info .nt-toast-icon-wrap {
    background: rgba(0, 176, 255, 0.14);
    color: var(--nt-toast-info);
    border: 1px solid rgba(0, 176, 255, 0.25);
}

/* Contenido / Textos */
.nt-toast-content {
    flex-grow: 1;
    min-width: 0;
}

.nt-toast-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.nt-toast-message {
    font-size: 0.84rem;
    color: var(--nt-toast-muted);
    line-height: 1.45;
    word-break: break-word;
}

.nt-toast-message a {
    color: var(--nt-toast-success);
    text-decoration: underline;
}

/* Botón de cierre manual */
.nt-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #64748b;
    padding: 0.2rem 0.35rem;
    margin: -0.25rem -0.25rem 0 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.nt-toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Barra inferior de progreso (5 segundos) */
.nt-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    animation: nt-toast-progress-anim 5s linear forwards;
}

.nt-toast-success .nt-toast-progress {
    background: var(--nt-toast-success);
}
.nt-toast-warning .nt-toast-progress {
    background: var(--nt-toast-warning);
}
.nt-toast-error .nt-toast-progress,
.nt-toast-danger .nt-toast-progress {
    background: var(--nt-toast-error);
}
.nt-toast-info .nt-toast-progress {
    background: var(--nt-toast-info);
}

/* Pausar barra de progreso si el usuario pasa el mouse */
.nt-toast:hover .nt-toast-progress {
    animation-play-state: paused;
}

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

/* Adaptación responsive para dispositivos móviles */
@media (max-width: 576px) {
    .nt-toast-container {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: none;
    }
    
    .nt-toast {
        padding: 0.85rem 0.85rem 1rem 0.85rem;
    }
}
