/**
 * NOMA Toast — jquery-toast-plugin
 * Cartão branco legível + acento colorido + animações (via noma-toast-loader.js)
 */

:root {
    --noma-toast-radius: 22px;
    --noma-toast-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --noma-toast-success: #02b677;
    --noma-toast-success-deep: #009963;
    --noma-toast-success-soft: #ecfdf5;
    --noma-toast-info: #229ee3;
    --noma-toast-info-deep: #0d84c7;
    --noma-toast-info-soft: #eff8ff;
    --noma-toast-error: #e32222;
    --noma-toast-error-deep: #c91a1a;
    --noma-toast-error-soft: #fef2f2;
    --noma-toast-warning: #e89a00;
    --noma-toast-warning-deep: #c47f00;
    --noma-toast-warning-soft: #fffbeb;

    --noma-toast-text: #1f2937;
    --noma-toast-heading: #111827;
    --noma-toast-muted: #4b5563;
}

/* ── Container ── */
.jq-toast-wrap,
.jq-toast-wrap * {
    box-sizing: border-box;
}

.jq-toast-wrap {
    width: min(23rem, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem);
    pointer-events: none !important;
    z-index: 10050 !important;
    letter-spacing: normal;
}

.jq-toast-wrap.top-right,
.jq-toast-wrap.bottom-right {
    right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
}

.jq-toast-wrap.top-left,
.jq-toast-wrap.bottom-left {
    left: max(0.75rem, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
}

.jq-toast-wrap.top-right,
.jq-toast-wrap.top-left,
.jq-toast-wrap.top-center {
    top: calc(0.75rem + env(safe-area-inset-top, 0px)) !important;
    bottom: auto !important;
}

.jq-toast-wrap.bottom-right,
.jq-toast-wrap.bottom-left,
.jq-toast-wrap.bottom-center {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
}

.jq-toast-wrap.top-center,
.jq-toast-wrap.bottom-center {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
}

/* ── Cartão legível (fundo branco opaco) ── */
.jq-toast-single {
    --toast-accent: var(--noma-toast-info);
    --toast-accent-deep: var(--noma-toast-info-deep);
    --toast-soft: var(--noma-toast-info-soft);

    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 0.7rem;
    padding: 0.95rem 2.5rem 0.95rem 3.65rem !important;
    border-radius: var(--noma-toast-radius) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, var(--toast-soft) 100%) !important;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow:
        0 14px 36px rgba(15, 23, 42, 0.12),
        0 2px 8px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    color: var(--noma-toast-text) !important;
    font-family: var(--noma-toast-font);
    font-size: 0.8125rem;
    line-height: 1.45;
    overflow: hidden;
    pointer-events: auto !important;
    word-break: normal;
    overflow-wrap: anywhere;
    isolation: isolate;
    will-change: transform, opacity;
}

.jq-toast-single:not(.jq-has-icon) {
    padding-left: 1.1rem !important;
}

.jq-toast-single.jq-has-icon {
    background-image: none !important;
}

/* Brilho subtil no topo */
.jq-toast-single::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Ícone — círculo sólido colorido */
.jq-toast-single.jq-has-icon::before {
    content: "";
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--toast-accent) 0%, var(--toast-accent-deep) 100%);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--toast-accent) 35%, transparent);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.15rem;
}

/* Cores por tipo */
.jq-toast-single.jq-icon-success,
.jq-toast-wrap .jq-toast-single.jq-icon-success {
    --toast-accent: var(--noma-toast-success);
    --toast-accent-deep: var(--noma-toast-success-deep);
    --toast-soft: var(--noma-toast-success-soft);
}

.jq-toast-single.jq-icon-success::before,
.jq-toast-wrap .jq-toast-single.jq-icon-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.jq-toast-single.jq-icon-error,
.jq-toast-wrap .jq-toast-single.jq-icon-error {
    --toast-accent: var(--noma-toast-error);
    --toast-accent-deep: var(--noma-toast-error-deep);
    --toast-soft: var(--noma-toast-error-soft);
}

.jq-toast-single.jq-icon-error::before,
.jq-toast-wrap .jq-toast-single.jq-icon-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

.jq-toast-single.jq-icon-warning,
.jq-toast-wrap .jq-toast-single.jq-icon-warning {
    --toast-accent: var(--noma-toast-warning);
    --toast-accent-deep: var(--noma-toast-warning-deep);
    --toast-soft: var(--noma-toast-warning-soft);
}

.jq-toast-single.jq-icon-warning::before,
.jq-toast-wrap .jq-toast-single.jq-icon-warning::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3C/svg%3E");
}

.jq-toast-single.jq-icon-info,
.jq-toast-wrap .jq-toast-single.jq-icon-info {
    --toast-accent: var(--noma-toast-info);
    --toast-accent-deep: var(--noma-toast-info-deep);
    --toast-soft: var(--noma-toast-info-soft);
}

.jq-toast-single.jq-icon-info::before,
.jq-toast-wrap .jq-toast-single.jq-icon-info::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E");
}

/* Tipografia legível */
.jq-toast-single h2,
.jq-toast-single .jq-toast-heading {
    position: relative;
    z-index: 1;
    margin: 0 0 0.2rem !important;
    padding: 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.015em;
    line-height: 1.25 !important;
    color: var(--noma-toast-heading) !important;
    background: none !important;
}

.jq-toast-single:not(:has(h2)):not(:has(.jq-toast-heading)) {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.jq-toast-single p,
.jq-toast-single .jq-toast-text,
.jq-toast-single > span:not(.close-jq-toast-single):not(.jq-toast-loader) {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--noma-toast-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.jq-toast-single a {
    position: relative;
    z-index: 1;
    color: var(--toast-accent-deep) !important;
    font-weight: 700;
    border-bottom: 1px solid color-mix(in srgb, var(--toast-accent) 45%, transparent) !important;
    text-decoration: none !important;
    padding-bottom: 1px;
}

.jq-toast-single ul,
.jq-toast-single .jq-toast-ul {
    position: relative;
    z-index: 1;
    margin: 0.35rem 0 0 1rem;
    padding: 0;
    color: var(--noma-toast-muted);
}

.jq-toast-single ul li,
.jq-toast-single .jq-toast-li {
    list-style-type: disc !important;
    line-height: 1.4;
    margin-bottom: 0.15rem;
}

/* Fechar */
.jq-toast-single .close-jq-toast-single {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #6b7280 !important;
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1;
    text-decoration: none !important;
    opacity: 1 !important;
    transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.jq-toast-single .close-jq-toast-single:hover {
    background: rgba(15, 23, 42, 0.1);
    color: #374151 !important;
    transform: scale(1.04);
}

/* Barra de progresso (topo) — cor do tipo */
.jq-toast-single .jq-toast-loader {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    z-index: 3;
    height: 3px !important;
    width: 0;
    margin: 0 !important;
    border-radius: var(--noma-toast-radius) var(--noma-toast-radius) 0 0;
    background-color: var(--toast-accent) !important;
    opacity: 1;
}

.jq-toast-single .jq-toast-loader.jq-toast-loaded {
    background-color: var(--toast-accent) !important;
}

/* ── Animações entrada / saída ── */
.jq-toast-single.noma-toast-enter {
    opacity: 0;
}

.jq-toast-single.noma-toast-enter.noma-toast-from-bottom {
    transform: translateY(18px) scale(0.96);
}

.jq-toast-single.noma-toast-enter.noma-toast-from-top {
    transform: translateY(-18px) scale(0.96);
}

.jq-toast-single.noma-toast-enter-active.noma-toast-from-bottom {
    animation: noma-toast-in-bottom 0.42s cubic-bezier(0.22, 1.12, 0.36, 1) forwards;
}

.jq-toast-single.noma-toast-enter-active.noma-toast-from-top {
    animation: noma-toast-in-top 0.42s cubic-bezier(0.22, 1.12, 0.36, 1) forwards;
}

.jq-toast-single.noma-toast-exit.noma-toast-from-bottom {
    animation: noma-toast-out-bottom 0.3s cubic-bezier(0.4, 0, 0.85, 0.25) forwards;
}

.jq-toast-single.noma-toast-exit.noma-toast-from-top {
    animation: noma-toast-out-top 0.3s cubic-bezier(0.4, 0, 0.85, 0.25) forwards;
}

@keyframes noma-toast-in-bottom {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes noma-toast-in-top {
    from {
        opacity: 0;
        transform: translateY(-18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes noma-toast-out-bottom {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(14px) scale(0.95);
    }
}

@keyframes noma-toast-out-top {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-14px) scale(0.95);
    }
}

@media (max-width: 575.98px) {
    .jq-toast-wrap {
        width: calc(100vw - 1.25rem) !important;
    }

    .jq-toast-single {
        border-radius: 20px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jq-toast-single.noma-toast-enter,
    .jq-toast-single.noma-toast-enter-active,
    .jq-toast-single.noma-toast-exit {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
