/* Custom Toast Styles - Modern UI, RTL & Responsive */

/* Gentle attention animation every 30s */
@keyframes toast-gentle-pulse {
    0%, 96%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    98% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Base toast styles */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Visual right corner for both LTR/RTL */
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse; /* Stack new toasts at bottom, upwards */
    gap: 10px;
    align-items: flex-end;
    max-width: 350px;
    width: calc(100% - 40px); /* Responsive width */
    font-family: inherit;
    direction: rtl; /* Ensure RTL direction for Hebrew content */
}

.toast {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px); /* Slide up from below */
    transition: all 0.3s ease-in-out;
    font-size: 14px;
    line-height: 1.4;
    unicode-bidi: embed; /* Better RTL embedding */
    width: 100%; /* Full width of container */
    text-align: right; /* RTL text alignment */
    animation: toast-gentle-pulse 30s ease-in-out infinite;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-inline-end: 12px; /* Logical spacing: works in RTL */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    color: white;
}

.toast-content {
    flex: 1;
    word-wrap: break-word;
    text-align: right; /* Ensure RTL alignment for content */
    direction: rtl;
}

.toast-close {
    flex-shrink: 0;
    background-color: #c28157 !important;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #fff !important;
    opacity: 0.9;
    margin-inline-start: 12px; /* Logical spacing: works in RTL */
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.toast-close:hover {
    opacity: 1;
    background-color: #a86d45 !important;
}

/* Cart reminder specific: Stack text above button with no offset */
.cart-reminder .toast-content {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Full width alignment */
    gap: 6px; /* Tight spacing between text and button */
    margin: 0; /* No margins for flush alignment */
}

.toast-text {
    text-align: center;
}

.cart-reminder .toast-text {
    margin: 0; /* No offset for text */
    line-height: 1.3;
}

/* Cart link/button - desktop: larger, site native colors (brown), noticeable */
.cart-link {
    display: block;
    background-color: #9d5d2c; /* Site primary brown */
    color: white !important;
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.35;
    margin: 0;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 8px rgba(157, 93, 44, 0.35);
    direction: rtl;
    text-align: center;
    width: 100%;
}

.cart-link:hover {
    background-color: #7f4b22; /* Darker brown on hover */
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(127, 75, 34, 0.4);
}

.cart-link:active {
    transform: translateY(0);
}

/* Type-specific styles */
.toast-success {
    background-color: #ffffffdb;
}


.toast-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toast-error .toast-icon {
    background-color: #dc3545;
}

.toast-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.toast-info .toast-icon {
    background-color: #17a2b8;
}

.toast-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.toast-warning .toast-icon {
    background-color: #ffc107;
}

/* Hide default WooCommerce messages */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info,
.woocommerce-notices-wrapper .notice {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast-container {
        right: 10px;
        bottom: 10px;
        gap: 8px;
        max-width: calc(100% - 20px);
    }
    
    .toast {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .toast-icon {
        width: 18px;
        height: 18px;
        font-size: 11px;
        margin-inline-end: 10px;
    }
    
    .toast-close {
        width: 18px;
        height: 18px;
        font-size: 16px;
        margin-inline-start: 10px;
    }

    .cart-reminder .toast-content {
        gap: 4px;
    }

    .cart-link {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Mobile: cart reminder toast full width, fixed at bottom */
@media (max-width: 768px) {
    .toast-container:has(.toast.cart-reminder) {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        width: 100%;
        border-radius: 0;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        align-items: stretch;
    }

    .toast-container:has(.toast.cart-reminder) .toast.cart-reminder {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .toast-container:has(.toast.cart-reminder) .cart-link {
        width: 100%;
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 6px;
    }
}