/* Toast no padrão do admin (referência: Polaris/Shopify): pill escuro no
   centro-inferior, texto claro, ícone por tipo, ação opcional e ✕.
   Os nomes de classe e de keyframe são contrato com o app-toast.js — o
   restyle é só visual. Cores usam os tokens do admin com fallback fixo,
   porque as telas de login também carregam este arquivo. */
.trigger_notify_box {
    position: fixed;
    left: 50%;
    bottom: 24px;
    top: auto;
    right: auto;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    width: min(480px, calc(100vw - 24px));
    z-index: 100000;
    pointer-events: none;
}

.trigger_notify_box .toast_message,
.trigger_notify_box .trigger {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 0 10px;
    width: fit-content;
    max-width: 100%;
    min-width: 220px;
    margin: 8px 0 0;
    padding: 12px 40px 13px 14px;
    overflow: hidden;
    border: 0 !important;
    border-radius: 8px;
    background: var(--toast-bg, var(--ui-ink, #1f2226)) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.32), 0 2px 6px rgba(15, 23, 42, 0.2);
    font-size: 0.88rem;
    line-height: 1.45;
    cursor: pointer;
    pointer-events: auto;
    animation: appToastBounceIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
    /* Acento por tipo: o timer e o ícone leem daqui */
    --toast-accent: #60a5fa;
}

/* Texto nunca estoura o pill: palavra comprida, URL ou código quebram
   dentro da caixa em vez de alargar ou vazar. */
.trigger_notify_box .toast_message p,
.trigger_notify_box .trigger p {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

.trigger_notify_box .toast_message b,
.trigger_notify_box .trigger b,
.trigger_notify_box .toast_message strong,
.trigger_notify_box .trigger strong {
    display: inline;
    font-weight: 650;
    color: #ffffff;
}

/* Ícone do tipo: glifo colorido em disco translúcido, legível no escuro */
.trigger_notify_box .toast_message::before,
.trigger_notify_box .trigger::before {
    content: "i";
    grid-column: 1;
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--toast-accent) 22%, transparent);
    color: var(--toast-accent);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

/* O tipo define só o acento — o texto continua branco */
.trigger_notify_box .toast_message_success,
.trigger_notify_box .trigger_success {
    --toast-accent: #4ade80;
}

.trigger_notify_box .toast_message_error,
.trigger_notify_box .trigger_error {
    --toast-accent: #fb7185;
}

.trigger_notify_box .toast_message_alert,
.trigger_notify_box .trigger_alert {
    --toast-accent: #fbbf24;
}

.trigger_notify_box .toast_message_info,
.trigger_notify_box .trigger_info {
    --toast-accent: #60a5fa;
}

.trigger_notify_box .toast_message_success::before,
.trigger_notify_box .trigger_success::before {
    content: "\2713";
}

.trigger_notify_box .toast_message_error::before,
.trigger_notify_box .trigger_error::before,
.trigger_notify_box .toast_message_alert::before,
.trigger_notify_box .trigger_alert::before {
    content: "!";
}

.trigger_notify_box .toast_message_info::before,
.trigger_notify_box .trigger_info::before {
    content: "i";
}

.trigger_notify_box .toast_message_icon {
    display: none !important;
}

.trigger_notify_box .ajax_close {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    opacity: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.trigger_notify_box .ajax_close::before,
.trigger_notify_box .ajax_close::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 1.5px;
    border-radius: 99px;
    background: currentColor;
}

.trigger_notify_box .ajax_close::before {
    transform: rotate(45deg);
}

.trigger_notify_box .ajax_close::after {
    transform: rotate(-45deg);
}

.trigger_notify_box .ajax_close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* Barra de tempo: discreta, na cor do acento */
.trigger_notify_box .toast_message_timer,
.trigger_notify_box .trigger_notify_timer,
.trigger_notify_box .trigger_progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--toast-accent);
    opacity: 0.65;
    z-index: 1;
}

.trigger_notify_box .app_toast_timer_run {
    animation-name: appToastTimer;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.trigger_notify_box .trigger_progress span {
    display: none;
}

.trigger_notify_box .app_toast_bounce_click {
    animation: appToastClickBounce 0.18s ease-out both;
}

.trigger_notify_box .app_toast_exit_right {
    pointer-events: none;
    animation: appToastExitRight 0.22s ease-in both !important;
}

/* Ações: links claros no padrão do pill escuro */
.toast_message_actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    grid-column: 2;
    margin-top: 10px;
    min-width: 0;
}

.toast_message_actions a,
.toast_message_actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 6px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    font-size: 0.78rem;
    text-decoration: none;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.toast_message_actions a:hover,
.toast_message_actions button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Entrada: sobe do rodapé com leve overshoot (nome do keyframe é contrato) */
@keyframes appToastBounceIn {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    70% {
        opacity: 1;
        transform: translateY(-3px) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes appToastClickBounce {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(0.97);
    }
    100% {
        transform: scale(1);
    }
}

/* Saída: desce e some (o nome ficou pelo contrato com o JS) */
@keyframes appToastExitRight {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(16px);
    }
}

@keyframes appToastTimer {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .trigger_notify_box {
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .trigger_notify_box .toast_message,
    .trigger_notify_box .trigger {
        width: 100%;
        padding: 12px 38px 13px 12px;
        font-size: 0.84rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trigger_notify_box .toast_message,
    .trigger_notify_box .trigger,
    .trigger_notify_box .app_toast_bounce_click,
    .trigger_notify_box .app_toast_exit_right {
        animation-duration: 0.01s !important;
    }
}

.btn_loading,
button.btn_loading,
.btn.btn_loading,
.btn-submit.btn_loading {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: wait !important;
    pointer-events: none;
}

/* Spinner do design system: funciona dentro de .btn_loading e também
   sozinho (ex.: "Gerando combinações..." na grade de variações). */
.app_button_loader {
    display: inline-block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: 0.9;
    animation: appButtonLoaderSpin 0.7s linear infinite;
}

/* O load.gif foi aposentado: o feedback de espera agora é o spinner no
   próprio botão. O overlay de upload (app_upload) tem gif próprio e fica. */
.form_load {
    display: none !important;
}

@keyframes appButtonLoaderSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Modo escuro do admin/painel (<html data-theme="dark">): --ui-ink vira
   claro, então o toast ganha um grafite próprio e segue com texto branco. */
:root[data-theme="dark"] { --toast-bg: #2b2b2b; }
