/* ── Toast Container ── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}

/* ── Toast Notification ── */
.toast {
    display: block;
    position: relative;
    min-width: 340px;
    max-width: 440px;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    border: none;
    overflow: hidden;

    /* Estado inicial (oculto) */
    opacity: 0;
    transform: translateX(120%) scale(0.9);
    max-height: 0;
    margin-bottom: 0;
    padding: 0 2.2rem 0 0.8rem;
    visibility: hidden;

    transition:
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.4s ease,
        max-height 0.4s ease 0.1s,
        margin 0.4s ease 0.1s,
        padding 0.4s ease 0.1s,
        visibility 0s linear 0.6s;
    pointer-events: none;
}

.toast.active {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 200px;
    /* Suficiente para el contenido */
    padding: 1.1rem 2.2rem 1.1rem 0.8rem;
    visibility: visible;
    pointer-events: auto;
    transition:
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.4s ease,
        max-height 0.4s ease,
        margin 0.4s ease,
        padding 0.4s ease,
        visibility 0s linear;
}

template {
    display: none !important;
}

/* ── Content layout ── */
.toast .toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ── Icon ── */
.toast-content .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 42px;
    width: 42px;
    color: #fff;
    font-size: 1.1rem;
    border-radius: 0.9rem;
    padding: 9px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fill-white {
    fill: #fff;
}

/* ── Message ── */
.toast-content .message {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.message .text {
    font-size: 0.85rem;
    font-weight: 450;
    color: #475569;
    line-height: 1.4;
}

.message .text.text-1 {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}

/* ── Close button ── */
.toast .close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.4;
    font-size: 0.9rem;
    color: #64748b;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.toast:hover .close {
    opacity: 1;
}

.toast .close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
    transform: rotate(90deg);
}

/* ── Progress bar ── */
.toast .progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: rgba(0, 0, 0, 0.03);
}

.toast .progress:before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    height: 100%;
    width: 100%;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.progress.active:before {
    animation: toast-progress var(--timing) linear forwards;
}

@keyframes toast-progress {
    100% {
        right: 100%;
    }
}

/* ── Type-specific styling ── */
.toast[data-type="success"] .icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast[data-type="danger"] .icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast[data-type="warning"] .icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast[data-type="info"] .icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toast[data-type="cart"] .icon {
    background: linear-gradient(135deg, var(--primary), #1177a6);
}

.toast[data-type="mcd"] .icon {
    background: linear-gradient(135deg, var(--color-secondary, #333), #000);
}

.toast[data-type="success"] .progress:before {
    background: #22c55e;
}

.toast[data-type="danger"] .progress:before {
    background: #ef4444;
}

.toast[data-type="warning"] .progress:before {
    background: #f59e0b;
}

.toast[data-type="info"] .progress:before {
    background: #3b82f6;
}