/* =========================================================
   TOASTIFY THEME · AGROSTOCK
   Compatible con Toastify JS 1.12.0 + Bootstrap 5.3
========================================================= */

/* Variables locales para evitar depender de otros estilos */
.toastify.agro-toast {
    --toast-bg: rgba(27, 31, 30, .97);
    --toast-text: #FFFFFF;
    --toast-muted: rgba(255, 255, 255, .84);
    --toast-border: rgba(255, 255, 255, .14);

    display: flex !important;
    align-items: flex-start;
    gap: .8rem;

    box-sizing: border-box;
    width: min(430px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 24px) !important;
    min-width: 0;

    padding: 1rem 2.6rem 1rem 1rem !important;

    /* Fondo y texto: prioridad sobre Toastify y estilos globales */
    background: var(--toast-bg) !important;
    background-color: var(--toast-bg) !important;
    background-image: none !important;
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);

    border: 1px solid var(--toast-border) !important;
    border-left: 4px solid var(--brand-red, #E73B41) !important;
    border-radius: var(--radius-md, 12px) !important;

    box-shadow: 0 14px 38px rgba(0, 0, 0, .24) !important;

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    font-family: 'Inter', sans-serif;
    font-size: .88rem;
    line-height: 1.45;

    overflow-wrap: anywhere;
    white-space: normal;

    z-index: 20000 !important;
}

/* Asegura que los elementos internos no hereden colores blancos
   sobre un fondo blanco procedente de estilos globales */
.toastify.agro-toast,
.toastify.agro-toast * {
    box-sizing: border-box;
}

.toastify.agro-toast .agro-toast__layout,
.toastify.agro-toast .agro-toast__content {
    color: var(--toast-text) !important;
}

/* Botón de cierre */
.toastify.agro-toast .toast-close {
    position: absolute;
    top: .65rem;
    right: .65rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 1.65rem;
    height: 1.65rem;
    padding: 0;

    color: rgba(255, 255, 255, .85) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, .85);

    background: rgba(255, 255, 255, .09) !important;
    border: 1px solid rgba(255, 255, 255, .16) !important;
    border-radius: var(--radius-sm, 8px);

    font-family: inherit;
    font-size: 1rem;
    line-height: 1;

    opacity: 1 !important;
    cursor: pointer;

    transition:
        background .18s ease,
        color .18s ease,
        border-color .18s ease;
}

.toastify.agro-toast .toast-close:hover,
.toastify.agro-toast .toast-close:focus-visible {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, .18) !important;
    border-color: rgba(255, 255, 255, .3) !important;

    outline: 2px solid rgba(231, 59, 65, .65);
    outline-offset: 2px;
}

/* Estructura interna */
.toastify.agro-toast .agro-toast__layout {
    display: flex;
    align-items: flex-start;
    gap: .8rem;

    width: 100%;
    min-width: 0;
}

.toastify.agro-toast .agro-toast__icon {
    display: inline-flex;
    flex: 0 0 2rem;

    align-items: center;
    justify-content: center;

    width: 2rem;
    height: 2rem;
    margin-top: .05rem;

    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF;

    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;

    font-size: 1rem;
    font-weight: 700;
}

.toastify.agro-toast .agro-toast__content {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: .1rem;
}

.toastify.agro-toast .agro-toast__title {
    display: block;
    margin: 0 0 .15rem;

    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF;

    font-size: .91rem;
    font-weight: 700;
    line-height: 1.35;
}

.toastify.agro-toast .agro-toast__message {
    display: block;

    color: rgba(255, 255, 255, .84) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, .84);

    font-size: .84rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* Elementos de texto comunes */
.toastify.agro-toast p,
.toastify.agro-toast span,
.toastify.agro-toast strong,
.toastify.agro-toast small {
    color: inherit;
}

/* =========================================================
   ESTADOS SEMÁNTICOS · AGROSTOCK
========================================================= */

/* ÉXITO: fondo verde suave */
.toastify.agro-toast--success {
    --toast-bg: rgba(226, 245, 222, .97);
    --toast-text: #245B27;
    --toast-muted: #386B3A;

    background: var(--toast-bg) !important;
    background-color: var(--toast-bg) !important;
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);

    border: 1px solid rgba(94, 184, 66, .35) !important;
    border-left: 4px solid #5EB842 !important;
}

.toastify.agro-toast--success .agro-toast__title,
.toastify.agro-toast--success .agro-toast__message {
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);
}

.toastify.agro-toast--success .agro-toast__icon {
    color: #347D31 !important;
    background: rgba(94, 184, 66, .18);
    border-color: rgba(94, 184, 66, .4);
}


/* ERROR: fondo rojo suave */
.toastify.agro-toast--error {
    --toast-bg: rgba(255, 228, 228, .97);
    --toast-text: #922D32;
    --toast-muted: #A33B40;

    background: var(--toast-bg) !important;
    background-color: var(--toast-bg) !important;
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);

    border: 1px solid rgba(231, 59, 65, .3) !important;
    border-left: 4px solid #E73B41 !important;
}

.toastify.agro-toast--error .agro-toast__title,
.toastify.agro-toast--error .agro-toast__message {
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);
}

.toastify.agro-toast--error .agro-toast__icon {
    color: #C7353B !important;
    background: rgba(231, 59, 65, .13);
    border-color: rgba(231, 59, 65, .35);
}


/* ADVERTENCIA */
.toastify.agro-toast--warning {
    --toast-bg: rgba(255, 244, 222, .97);
    --toast-text: #80551C;

    background: var(--toast-bg) !important;
    background-color: var(--toast-bg) !important;
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);

    border: 1px solid rgba(231, 168, 117, .4) !important;
    border-left: 4px solid #E7A875 !important;
}

.toastify.agro-toast--warning .agro-toast__title,
.toastify.agro-toast--warning .agro-toast__message {
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);
}

.toastify.agro-toast--warning .agro-toast__icon {
    color: #98651F !important;
    background: rgba(231, 168, 117, .2);
    border-color: rgba(231, 168, 117, .4);
}


/* INFORMACIÓN */
.toastify.agro-toast--info {
    --toast-bg: rgba(226, 241, 253, .97);
    --toast-text: #24577B;

    background: var(--toast-bg) !important;
    background-color: var(--toast-bg) !important;
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);

    border: 1px solid rgba(110, 182, 232, .4) !important;
    border-left: 4px solid #6EB6E8 !important;
}

.toastify.agro-toast--info .agro-toast__title,
.toastify.agro-toast--info .agro-toast__message {
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);
}

.toastify.agro-toast--info .agro-toast__icon {
    color: #286A9A !important;
    background: rgba(110, 182, 232, .2);
    border-color: rgba(110, 182, 232, .4);
}


/* Botón de cierre adaptado a fondos claros */
.toastify.agro-toast--success .toast-close,
.toastify.agro-toast--error .toast-close,
.toastify.agro-toast--warning .toast-close,
.toastify.agro-toast--info .toast-close {
    color: var(--toast-text) !important;
    -webkit-text-fill-color: var(--toast-text);
    background: rgba(255, 255, 255, .45) !important;
    border-color: rgba(0, 0, 0, .1) !important;
}

.toastify.agro-toast--success .toast-close:hover,
.toastify.agro-toast--error .toast-close:hover,
.toastify.agro-toast--warning .toast-close:hover,
.toastify.agro-toast--info .toast-close:hover {
    background: rgba(255, 255, 255, .75) !important;
}

/* =========================================================
   POSICIONAMIENTO
========================================================= */

.toastify.agro-toast.toastify-right {
    right: 1rem !important;
}

.toastify.agro-toast.toastify-left {
    left: 1rem !important;
}

.toastify.agro-toast.toastify-top {
    top: 1rem !important;
}

.toastify.agro-toast.toastify-bottom {
    bottom: 1rem !important;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 575.98px) {
    .toastify.agro-toast,
    .toastify.agro-toast.toastify-right,
    .toastify.agro-toast.toastify-left {
        right: .75rem !important;
        left: .75rem !important;

        width: auto !important;
        max-width: none !important;

        padding: .9rem 2.4rem .9rem .85rem !important;
    }

    .toastify.agro-toast.toastify-top {
        top: .75rem !important;
    }

    .toastify.agro-toast.toastify-bottom {
        bottom: .75rem !important;
    }
}

/* =========================================================
   ACCESIBILIDAD
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .toastify.agro-toast,
    .toastify.agro-toast * {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}