/* ═══ Notificaciones ══════════════════════════════════════════════════════
   Estilo de los avisos de jquery.gritter que lanza alert_msg / fxToast
   (functions.js). Archivo aparte porque lo cargan tanto el sistema
   (head.php) como el login y la recuperación de contraseña.
   Los selectores empiezan con "body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast"
   para ganarle al estilo oscuro del tema Color Admin (bootstrap.css). */

body #gritter-notice-wrapper {
    top: 16px;
    right: 16px;
    width: 360px;
    max-width: calc(100vw - 32px);
    z-index: 1070;
}

body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast {
    --c: #2f7bf5;
    --cs: #eaf2ff;
    margin: 0 0 10px;
    border-radius: 16px;
    background: none;
    animation: fx-toast-entra .34s cubic-bezier(.2, .9, .3, 1.15) both;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--success { --c: #12a56b; --cs: #e4f6ee; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--error   { --c: #e5372b; --cs: #ffeceb; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--warning { --c: #e08a00; --cs: #fff4e0; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--info    { --c: #2f7bf5; --cs: #eaf2ff; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--loader  { --c: #00214e; --cs: #e8eef8; }

body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-top,
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-bottom,
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item > div[style*="clear"] { display: none; }

body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 44px 15px 13px;
    overflow: hidden;
    border: 1px solid rgba(0, 33, 78, .08);
    border-radius: 16px;
    background: #fff;
    color: #4b5876;
    box-shadow: 0 16px 36px -14px rgba(0, 33, 78, .38), 0 2px 6px rgba(0, 33, 78, .06);
    font-family: 'Plus Jakarta Sans', 'Inria Sans', 'Segoe UI', system-ui, Arial, sans-serif;
}

/* Ícono en una ficha de color */
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-image {
    display: grid;
    place-items: center;
    flex: none;
    float: none;
    width: 38px;
    height: 38px;
    margin: 0;
    border-radius: 12px;
    background: var(--cs);
    color: var(--c);
    font-size: 16px;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-image i { color: inherit; }

body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-with-image,
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-without-image {
    flex: 1 1 auto;
    float: none;
    width: auto;
    min-width: 0;
    padding: 1px 0 0;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-title {
    display: block;
    padding: 0 0 2px;
    color: #00214e;
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.35;
    text-shadow: none;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item p {
    margin: 0;
    color: #4b5876;
    font-size: 12.5px;
    line-height: 1.45;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item p:empty { display: none; }

/* Botón cerrar: una X discreta, siempre visible (en celular no hay hover) */
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-close {
    display: grid !important;
    place-items: center;
    top: 8px;
    right: 8px;
    bottom: auto;
    left: auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: #8a94a8;
    font-size: 0;
    text-indent: 0;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-close::before {
    content: "\f00d";
    position: static;
    margin: 0;
    color: inherit;
    font: 900 13px/1 "Font Awesome 5 Free";
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-close:hover { background: #f1f4f9; color: #00214e; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item .gritter-close:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--loader .gritter-item .gritter-close { display: none !important; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--loader .gritter-item { padding-right: 16px; }

/* Barra con el tiempo que le queda. Con el mouse encima gritter no la cierra
   y al salir vuelve a contar desde cero, igual que la barra. */
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--c);
    opacity: .85;
    transform-origin: left;
    animation: fx-toast-tiempo var(--fx-t, 4500ms) linear forwards;
}
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast.hover .gritter-item::after { animation: none; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--fijo .gritter-item::after { display: none; }
/* Procesando: barra que va y viene mientras dura */
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--loader .gritter-item::after {
    display: block;
    right: auto;
    width: 40%;
    animation: fx-toast-carga 1.3s ease-in-out infinite;
}

@keyframes fx-toast-entra {
    from { opacity: 0; transform: translateX(24px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes fx-toast-baja {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fx-toast-tiempo {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
@keyframes fx-toast-carga {
    from { transform: translateX(-100%); }
    to   { transform: translateX(250%); }
}

/* Celular: a todo el ancho, entrando desde arriba */
@media (max-width: 575.98px) {
    body #gritter-notice-wrapper {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast { animation-name: fx-toast-baja; }
    body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item { padding: 12px 42px 14px 12px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast { animation: none; }
    body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast--loader .gritter-item::after { width: 100%; animation: none; }
}

/* Enlaces dentro del aviso (por ejemplo, "Ver ficha") */
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item p a { color: var(--c); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
body #gritter-notice-wrapper .gritter-item-wrapper.fx-toast .gritter-item p b { color: #00214e; font-weight: 800; }
