/**
 * Avisos de la tienda: los mensajes de PrestaShop en #notifications
 * ("Direccion anadida", errores del carrito, "Usaremos esta direccion...") y
 * los errores generales de un formulario, que el tema pinta justo encima de el
 * (_partials/form-errors.tpl: "Error de autenticacion" al iniciar sesion...).
 * Los errores de cada campo van dentro de su .form-group y no se tocan.
 *
 * OJO: afecta a TODA la tienda. Solo CSS sobre el HTML del tema
 * (_partials/notifications.tpl), mas el boton de cerrar de avisos.js. La
 * plantilla no se toca: tiene un error oculto a proposito para el modulo B2B
 * (style="display:none"), y aqui no se le da display con !important para no
 * hacerlo aparecer.
 */

#notifications .alert,
.help-block:has(+ form) .alert {
    --ek-aviso: #2f5d9a;
    --ek-aviso-fondo: #f4f8fd;
    --ek-aviso-borde: #d6e2f2;
    --ek-aviso-icono: "i";

    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 16px;
    padding: 16px 52px 16px 18px;
    border: 1px solid var(--ek-aviso-borde);
    border-left: 4px solid var(--ek-aviso);
    border-radius: 12px;
    background: var(--ek-aviso-fondo);
    box-shadow: 0 10px 28px rgb(22 32 43 / 8%), 0 1px 3px rgb(22 32 43 / 6%);
    color: #16202b;
    font-size: 14px;
    line-height: 1.5;
    animation: ek-aviso-entra 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#notifications .alert-success,
.help-block:has(+ form) .alert-success {
    --ek-aviso: #1f8a4c;
    --ek-aviso-fondo: #f1faf4;
    --ek-aviso-borde: #cfe9d9;
    --ek-aviso-icono: "\2713";
}
#notifications .alert-danger,
.help-block:has(+ form) .alert-danger {
    --ek-aviso: #c0392b;
    --ek-aviso-fondo: #fdf3f2;
    --ek-aviso-borde: #f2d3cf;
    --ek-aviso-icono: "!";
}
#notifications .alert-warning,
.help-block:has(+ form) .alert-warning {
    --ek-aviso: #b8860b;
    --ek-aviso-fondo: #fffaf0;
    --ek-aviso-borde: #f1e2b8;
    --ek-aviso-icono: "!";
}

/* El icono, en un circulo del color del aviso */
#notifications .alert::before,
.help-block:has(+ form) .alert::before {
    content: var(--ek-aviso-icono);
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ek-aviso);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 28px;
    text-align: center;
    animation: ek-aviso-icono 0.5s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1.4) both;
}

#notifications .alert ul {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 3px 0 0;
    list-style: none;
}
/* El primero manda; los demas lo completan */
#notifications .alert li:first-child {
    font-weight: 600;
}
#notifications .alert li + li {
    margin-top: 4px;
    color: #4a5763;
}

/* "Ir al campo" dentro de un aviso (direcciones.js) */
#notifications .alert .form-aviso__ir {
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ek-aviso);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* Errores generales de un formulario: cada error es su propio aviso (li.alert) */
.help-block:has(+ form) {
    margin: 0 0 4px;
}
.help-block:has(+ form) ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.help-block:has(+ form) .alert {
    font-weight: 600;
}

/* Cerrar (lo anade avisos.js) */
#notifications .ek-aviso-cerrar,
.help-block:has(+ form) .ek-aviso-cerrar {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6c7a86;
    font-size: 20px;
    line-height: 30px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
#notifications .ek-aviso-cerrar:hover,
#notifications .ek-aviso-cerrar:focus-visible,
.help-block:has(+ form) .ek-aviso-cerrar:hover,
.help-block:has(+ form) .ek-aviso-cerrar:focus-visible {
    background: rgb(22 32 43 / 7%);
    color: #16202b;
}

#notifications .alert.ek-aviso--saliendo,
.help-block:has(+ form) .alert.ek-aviso--saliendo {
    animation: ek-aviso-sale 0.25s ease-in both;
}

@keyframes ek-aviso-entra {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
}

@keyframes ek-aviso-icono {
    from {
        opacity: 0;
        transform: scale(0.4);
    }
}

@keyframes ek-aviso-sale {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* Quien pide menos movimiento ve el aviso quieto */
@media (prefers-reduced-motion: reduce) {
    #notifications .alert,
    #notifications .alert::before,
    #notifications .alert.ek-aviso--saliendo,
    .help-block:has(+ form) .alert,
    .help-block:has(+ form) .alert::before,
    .help-block:has(+ form) .alert.ek-aviso--saliendo {
        animation: none;
    }
}
