/* ======================================================
     APP MODAL (Global) - estilo tipo "Producto agregado"
     Tipos: success | warning | error
     ====================================================== */

.appModal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 2.2vw, 20px);
}

.appModal.is-open {
    display: flex;
}

.appModal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.appModal__dialog {
    position: relative;
    width: min(720px, 100%);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.14);
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.26);
    padding: clamp(18px, 2.4vw, 28px);
    overflow: hidden;

    border-radius: 0;

    display: grid;
    gap: 14px;
    justify-items: center;

    transform: translateY(10px);
    opacity: 0;
    animation: appModalIn 180ms ease forwards;
}

@keyframes appModalIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close button */
.appModal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 0;
    border: 1px solid rgba(0, 0, 0, 0.16);
    background: #fff;
    cursor: pointer;

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

    color: rgba(0, 0, 0, 0.7);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.appModal__close span {
    font-size: 1.5rem;
    line-height: 1;
    transform: translateY(-1px);
}

.appModal__close:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.08);
}

.appModal__close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Icon wrapper */
.appModal__iconWrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 6px;
}

/* ✅ SIEMPRE ROJO PRINCIPAL */
.appModal__icon {
    width: 96px;
    height: 96px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: color-mix(in srgb, var(--color-primary, #e74c3c) 14%, #fff);
    border: 1px solid color-mix(in srgb, var(--color-primary, #e74c3c) 45%, transparent);

    /* Icono oscuro como tu captura (puedes cambiar a #fff si quieres blanco) */
    color: rgba(0, 0, 0, 0.86);
}

.appModal__icon svg {
    width: 54px;
    height: 54px;
}

/* ✅ Ya NO dependemos del type para el fondo del icono */
.appModal[data-type="success"] .appModal__icon,
.appModal[data-type="warning"] .appModal__icon,
.appModal[data-type="error"] .appModal__icon {
    background: color-mix(in srgb, var(--color-primary, #e74c3c) 14%, #fff);
    border-color: color-mix(in srgb, var(--color-primary, #e74c3c) 45%, transparent);
    color: rgba(0, 0, 0, 0.86);
}

/* Body centered */
.appModal__body {
    width: min(560px, 100%);
    text-align: center;
    display: grid;
    gap: 8px;
    padding: 2px 6px 0;
}

.appModal__title {
    margin: 0;
    font-size: clamp(20px, 2.2vw, 28px);
    font-weight: 850;
    color: rgba(0, 0, 0, 0.92);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    line-height: 1.15;
}

.appModal__desc {
    margin: 0;
    font-size: clamp(14px, 1.4vw, 16px);
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.5;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    word-wrap: break-word;
}

/* Footer */
.appModal__footer {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 6px;
}

.appModal__btn {
    border-radius: 0;
    padding: 0.68rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.16);
    background: #fff;
    color: rgba(0, 0, 0, 0.88);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
    min-width: 140px;
}

.appModal__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
}

.appModal__btn--ghost {
    background: #fff;
}

.appModal__btn--primary {
    background: #000;
    border-color: #000;
    color: #fff;
}

.appModal__btn--primary:hover {
    opacity: 0.92;
}

/* Responsive */
@media (max-width: 520px) {
    .appModal__dialog {
        padding: 18px;
    }

    .appModal__icon {
        width: 88px;
        height: 88px;
    }

    .appModal__btn {
        min-width: 0;
        width: 100%;
    }

    .appModal__footer {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .appModal__dialog {
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }

    .appModal__close,
    .appModal__btn {
        transition: none !important;
    }
}