/* ==========================================================================
   KunjMart Toast — shared admin + storefront
   ========================================================================== */

.km-toast-host {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    width: min(420px, calc(100vw - 24px));
    pointer-events: none;
}

.km-toast {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: start;
    gap: 12px;
    width: 100%;
    padding: 14px 14px 16px 0;
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow:
        0 18px 40px rgba(17, 24, 39, 0.14),
        0 2px 8px rgba(17, 24, 39, 0.06);
    overflow: hidden;
    opacity: 0;
    transform: translateX(28px) translateY(-4px) scale(0.98);
    transition:
        opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.km-toast.is-in {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
}

.km-toast.is-out {
    opacity: 0;
    transform: translateX(24px) scale(0.98);
}

.km-toast__accent {
    width: 5px;
    align-self: stretch;
    margin: 0;
    border-radius: 14px 0 0 14px;
    background: #111827;
}

.km-toast__icon {
    width: 36px;
    height: 36px;
    margin-top: 2px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #111827;
}

.km-toast__body {
    min-width: 0;
    padding-top: 2px;
}

.km-toast__title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 2px;
}

.km-toast__msg {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
    color: #111827;
    word-break: break-word;
}

.km-toast__close {
    width: 28px;
    height: 28px;
    margin-top: -2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.km-toast__close:hover {
    background: #f3f4f6;
    color: #111827;
}

.km-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left center;
    animation: km-toast-progress linear forwards;
    background: rgba(17, 24, 39, 0.2);
}

@keyframes km-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Success */
.km-toast--success .km-toast__accent { background: #059669; }
.km-toast--success .km-toast__icon {
    background: #ecfdf5;
    color: #059669;
}
.km-toast--success .km-toast__progress { background: #059669; }

/* Error */
.km-toast--error .km-toast__accent { background: #dc2626; }
.km-toast--error .km-toast__icon {
    background: #fef2f2;
    color: #dc2626;
}
.km-toast--error .km-toast__progress { background: #dc2626; }

/* Warning */
.km-toast--warning .km-toast__accent { background: #d97706; }
.km-toast--warning .km-toast__icon {
    background: #fffbeb;
    color: #d97706;
}
.km-toast--warning .km-toast__progress { background: #d97706; }

/* Info — KunjMart yellow brand */
.km-toast--info .km-toast__accent { background: #fedc19; }
.km-toast--info .km-toast__icon {
    background: #fff8cc;
    color: #111827;
}
.km-toast--info .km-toast__progress { background: #e5c700; }

/* Legacy status-pop bridge (slide-in still works if old markup exists) */
.status-pop {
    position: fixed;
    right: -450px;
    top: 88px;
    color: #fff;
    padding: 14px 22px;
    border-radius: 12px 0 0 12px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    font-weight: 500;
    font-size: 0.8125rem;
    max-width: 400px;
    box-shadow: 0 12px 40px rgba(17, 24, 39, 0.1);
}
.pop-success { background: #059669; }
.pop-error { background: #dc2626; }
.status-pop.show { right: 0; }

@media (max-width: 640px) {
    .km-toast-host {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        align-items: stretch;
    }

    .km-toast {
        grid-template-columns: auto auto 1fr auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .km-toast,
    .km-toast__progress {
        transition: none;
        animation: none;
    }
}

/* Required-field highlight (shared with km-form-validate.js) */
.km-field-invalid,
input.km-field-invalid,
select.km-field-invalid,
textarea.km-field-invalid,
.km-input-wrap.km-field-invalid .km-form-input,
.km-pf-field.km-field-invalid .km-pf-input,
.km-pf-field.km-field-invalid .km-pf-textarea,
.km-form-group.km-field-invalid .km-form-input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.km-upload-card.km-field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}
