/* ============================================================
   LTWNC English — Modern SaaS Toast Popup System
   ============================================================ */

.app-popup-stack {
    position: fixed;
    z-index: 1085;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    width: min(440px, calc(100vw - 2rem));
    gap: 0.75rem;
    pointer-events: none;
}

.app-popup-stack .app-popup {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin: 0 !important;
    padding: 1.1rem 2.8rem 1.1rem 1.15rem !important;
    border-radius: var(--radius-card, 16px);
    border: 1px solid var(--line, #E0E4DB);
    background: var(--surface, #FFFDF7);
    box-shadow: 0 16px 40px -6px rgba(41, 50, 38, 0.16), 0 4px 12px rgba(0, 0, 0, 0.03);
    font-family: var(--font-body, 'Be Vietnam Pro', sans-serif);
    opacity: 0;
    pointer-events: auto;
    transform: translateY(1rem) scale(0.96);
    transition: opacity 220ms var(--ease-out, ease), transform 220ms var(--ease-out, ease);
    overflow: hidden;
}

.app-popup-stack .app-popup.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.app-popup-stack .app-popup.is-leaving {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.96);
}

/* ================= TONE VARIANTS ================= */

/* Success Toast — Solid Emerald with White Text */
.app-popup-stack .app-popup--success {
    background: #059669;
    border-color: #047857;
    color: #ffffff;
    box-shadow: 0 16px 40px -6px rgba(5, 150, 105, 0.35), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-popup-stack .app-popup--success .app-popup__icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.app-popup-stack .app-popup--success .app-popup__content {
    color: #ffffff;
}

/* Error Toast — Solid Crimson Red with White Text */
.app-popup-stack .app-popup--error {
    background: #dc2626;
    border-color: #b91c1c;
    color: #ffffff;
    box-shadow: 0 16px 40px -6px rgba(220, 38, 38, 0.35), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-popup-stack .app-popup--error .app-popup__icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.app-popup-stack .app-popup--error .app-popup__content {
    color: #ffffff;
}

/* Info Toast — Solid Blue with White Text */
.app-popup-stack .app-popup--info {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 16px 40px -6px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.app-popup-stack .app-popup--info .app-popup__icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.app-popup-stack .app-popup--info .app-popup__content {
    color: #ffffff;
}

/* ================= ELEMENTS ================= */

.app-popup__icon {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

.app-popup__content {
    flex: 1 1 auto;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
}

.app-popup__content a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.app-popup__close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    display: grid;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.app-popup__close:hover,
.app-popup__close:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

/* ================= MODAL CONFIRM DIALOG ================= */

html.app-confirm-open,
html.app-confirm-open body {
    overflow: hidden;
}

.app-confirm-backdrop {
    position: fixed;
    z-index: 1090;
    inset: 0;
    display: grid;
    padding: 1rem;
    place-items: center;
    background: rgba(20, 22, 19, .58);
    backdrop-filter: blur(5px);
    animation: app-confirm-backdrop-in 160ms ease-out both;
}

.app-confirm {
    width: min(460px, 100%);
    padding: 1.4rem;
    color: var(--ink, #252722);
    border: 1px solid var(--line, #d7d8d0);
    border-radius: var(--radius-card, 18px);
    background: var(--surface, #fffef9);
    box-shadow: 0 28px 80px rgba(15, 17, 14, .32);
    font-family: var(--font-body, "Be Vietnam Pro", sans-serif);
    animation: app-confirm-in 200ms var(--ease-out, ease-out) both;
}

.app-confirm__mark {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 1rem;
    place-items: center;
    color: #8b3e38;
    border-radius: 50%;
    background: #f7e8e5;
    font-size: 1.3rem;
    font-weight: 800;
}

.app-confirm--warning .app-confirm__mark {
    color: var(--brass-deep, #8f6115);
    background: var(--brass-soft, #f5eedc);
}

.app-confirm h2 {
    margin: 0 0 .45rem;
    font-size: 1.2rem;
    font-weight: 750;
}

.app-confirm p {
    margin: 0;
    color: var(--muted, #66695f);
    line-height: 1.65;
}

.app-confirm__actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    margin-top: 1.4rem;
}

.app-confirm__actions button {
    min-height: 2.7rem;
    padding: .65rem 1rem;
    border-radius: var(--radius-control, 10px);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.app-confirm__actions button:active {
    transform: translateY(1px);
}

.app-confirm__cancel {
    color: #40423c;
    border: 1px solid #d2d4cc;
    background: #fff;
}

.app-confirm__accept {
    color: #fff;
    border: 1px solid #303a31;
    background: #303a31;
}

.app-confirm--warning .app-confirm__accept {
    border-color: var(--brass-deep, #8f6115);
    background: var(--brass-deep, #8f6115);
}

@media (hover: hover) {
    .app-confirm__cancel:hover {
        border-color: var(--ink-soft, #45503f);
        background: var(--surface-sunken, #f0ebdd);
    }

    .app-confirm__accept:hover {
        border-color: var(--ink-soft, #45503f);
        background: var(--ink-soft, #45503f);
    }
}

.app-confirm__actions button:focus-visible {
    outline: 3px solid rgba(76, 111, 85, .28);
    outline-offset: 2px;
}

@keyframes app-confirm-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes app-confirm-in {
    from {
        opacity: 0;
        transform: translateY(.75rem) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-confirm-backdrop,
    .app-confirm {
        animation-duration: 1ms;
    }
}

@media (max-width: 640px) {
    .app-popup-stack {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }
}
