/**
 * Toast — estilos para el componente de notificaciones reutilizable
 * Tema: Dark Green Glassmorphism (consistente con el resto de la app)
 */

/* ========================================
   CONTENEDOR
======================================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 11000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

/* ========================================
   TOAST BASE
======================================== */
.toast {
    position: relative;
    min-width: 320px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 40px 14px 14px;
    background: rgba(8, 16, 12, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    pointer-events: all;
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.toast--leaving {
    animation: toastSlideOut 0.25s ease-in forwards;
}

/* ========================================
   ACCENT POR TIPO (borde izquierdo)
======================================== */
.toast--success { border-left: 4px solid #4ade80; }
.toast--error   { border-left: 4px solid #f87171; }
.toast--warning { border-left: 4px solid #fbbf24; }
.toast--info    { border-left: 4px solid #60a5fa; }

/* ========================================
   ICONO
======================================== */
.toast__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}

.toast__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.toast--success .toast__icon { color: #4ade80; }
.toast--error   .toast__icon { color: #f87171; }
.toast--warning .toast__icon { color: #fbbf24; }
.toast--info    .toast__icon { color: #60a5fa; }

/* ========================================
   CUERPO
======================================== */
.toast__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.toast__title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    font-family: 'Inter', -apple-system, sans-serif;
    letter-spacing: -0.1px;
}

.toast__message {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
    font-family: 'Inter', -apple-system, sans-serif;
    word-break: break-word;
}

/* Si no hay título, el mensaje toma un poco más de peso */
.toast:not(:has(.toast__title)) .toast__message {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.90);
}

/* ========================================
   BOTÓN CERRAR
======================================== */
.toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
    transition: color 0.15s ease, background 0.15s ease;
    font-family: sans-serif;
}

.toast__close:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   BARRA DE PROGRESO
======================================== */
.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 10px 10px;
    animation-name: toastProgress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    transform-origin: left center;
}

.toast--success .toast__progress { background: #4ade80; }
.toast--error   .toast__progress { background: #f87171; }
.toast--warning .toast__progress { background: #fbbf24; }
.toast--info    .toast__progress { background: #60a5fa; }

/* ========================================
   ANIMACIONES
======================================== */
@keyframes toastSlideIn {
    from {
        transform: translateX(calc(100% + 24px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
        max-height: 120px;
        margin-bottom: 0;
    }
    to {
        transform: translateX(calc(100% + 24px));
        opacity: 0;
        max-height: 0;
        margin-bottom: -10px;
    }
}

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

/* ========================================
   ACCESIBILIDAD / REDUCED MOTION
======================================== */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast--leaving {
        animation: none;
    }
    .toast__progress {
        animation: none;
        transform: scaleX(0);
    }
}
