/**
 * Modern Toast / Popup Notices for WooCommerce
 * @package AstraOptima
 */

/* Hide native intrusive static banners from document flow */
.woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-notices-wrapper .woocommerce-info,
.woocommerce-notices-wrapper .woocommerce-notice,
.entry-content > .woocommerce-error,
.entry-content > .woocommerce-message,
.entry-content > .woocommerce-info {
    display: none !important;
}

/* Toast Container (Fixed Overlay - Centered on Screen) */
.ao-toast-container {
    position: fixed;
    z-index: 99999999 !important;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
    width: calc(100vw - 32px);
    box-sizing: border-box;
    top: 30px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    align-items: center !important;
    margin: 0 auto !important;
}

/* Positions */
.ao-toast-container.ao-pos-top-center,
.ao-toast-container.ao-pos-top-right,
.ao-toast-container.ao-pos-top-left {
    top: 30px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    align-items: center !important;
}

.ao-toast-container.ao-pos-center {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    align-items: center !important;
}

.ao-toast-container.ao-pos-bottom-right {
    bottom: 30px !important;
    top: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    align-items: center !important;
}

/* Toast Card Item */
.ao-toast {
    pointer-events: auto;
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.06);
    padding: 14px 16px 14px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    animation: aoToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.ao-toast.ao-toast-leaving {
    animation: aoToastSlideOut 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

/* Toast Header & Body Layout */
.ao-toast-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.ao-toast-icon-wrap {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.ao-toast-icon-wrap svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.ao-toast-content {
    flex: 1 1 auto;
    min-width: 0;
}

.ao-toast-title {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 3px;
    color: #0f172a;
}

.ao-toast-msg {
    font-size: 13px;
    line-height: 1.45;
    color: #334155;
    word-break: break-word;
}

.ao-toast-msg p {
    margin: 0 0 4px 0;
}

.ao-toast-msg p:last-child {
    margin-bottom: 0;
}

.ao-toast-msg ul {
    margin: 0;
    padding-left: 18px;
}

.ao-toast-msg li {
    margin-bottom: 3px;
}

.ao-toast-msg li:last-child {
    margin-bottom: 0;
}

/* Close Button */
.ao-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-top: -2px;
    margin-right: -4px;
    transition: all 0.15s ease;
}

.ao-toast-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ao-toast-close svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

/* Actions Footer */
.ao-toast-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.ao-toast-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    background-color: #ff7a00;
    color: #ffffff !important;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ao-toast-btn:hover {
    background-color: #e56d00;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.ao-toast-btn:active {
    transform: translateY(0);
}

/* Status Type Variants */
/* 1. Error / Warning */
.ao-toast-error {
    border-left: 4px solid #ef4444;
}

.ao-toast-error .ao-toast-icon-wrap {
    background-color: #fef2f2;
    color: #ef4444;
}

.ao-toast-error .ao-toast-title {
    color: #dc2626;
}

/* 2. Success */
.ao-toast-success {
    border-left: 4px solid #10b981;
}

.ao-toast-success .ao-toast-icon-wrap {
    background-color: #ecfdf5;
    color: #10b981;
}

.ao-toast-success .ao-toast-title {
    color: #059669;
}

/* 3. Info */
.ao-toast-info {
    border-left: 4px solid #0284c7;
}

.ao-toast-info .ao-toast-icon-wrap {
    background-color: #f0f9ff;
    color: #0284c7;
}

.ao-toast-info .ao-toast-title {
    color: #0369a1;
}

/* Progress bar animation */
.ao-toast-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #cbd5e1;
    width: 100%;
    transform-origin: left;
}

.ao-toast-error .ao-toast-progress-bar {
    background-color: #fca5a5;
}

.ao-toast-success .ao-toast-progress-bar {
    background-color: #6ee7b7;
}

.ao-toast-info .ao-toast-progress-bar {
    background-color: #93c5fd;
}

/* Keyframe Animations */
@keyframes aoToastSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes aoToastSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-12px) scale(0.93);
    }
}

/* Responsive adjustments for Mobile */
@media (max-width: 480px) {
    .ao-toast-container {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: 100% !important;
        transform: none !important;
    }

    .ao-toast {
        max-width: 100% !important;
        padding: 12px 14px;
    }
}
