/* Modern Toast Notification System - Glassmorphism & Centered */

.toast-container {
    /* JS handles fixed positioning and centering */
    z-index: 10019 !important;
}

.toast {
    /* Glassmorphism Base */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    padding: 12px 16px;
    display: flex;
    flex-direction: column; /* Changed to column for better organization */
    align-items: stretch; /* Stretch children to full width */
    gap: 0; /* Gap handled by individual sections */
    
    /* Animation */
    animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
    
    min-width: 300px;
    max-width: 90vw;
    position: relative;
    overflow: hidden;
    font-family: "Inter", "Montserrat", sans-serif;
}

.toast.hiding {
    animation: fadeOutUp 0.3s ease-in forwards;
}

/* Status Colors & Icons */
.toast-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
}

.toast.success .toast-icon-wrapper {
    background: #DCFCE7; /* Light green */
    color: #166534;      /* Dark green */
}

.toast.error .toast-icon-wrapper {
    background: #FEE2E2; /* Light red */
    color: #991B1B;      /* Dark red */
}

.toast.warning .toast-icon-wrapper {
    background: #FEF3C7; /* Light yellow */
    color: #92400E;      /* Dark yellow/orange */
}

.toast.info .toast-icon-wrapper {
    background: #E0F2FE; /* Light blue */
    color: #075985;      /* Dark blue */
}

.toast-icon {
    font-size: 12px; /* Small icon inside circle */
}

/* Toast Header - Contains icon, message, and close button */
.toast-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1F2937; /* Gray 800 */
    line-height: 1.4;
}

/* Toast Body - Contains additional content like cart popup */
.toast-body {
    width: 100%;
    margin-top: 8px;
}

/* Close Button */
.toast-close {
    background: none;
    border: none;
    color: #9CA3AF; /* Gray 400 */
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s;
    margin-left: 4px;
}

.toast-close:hover {
    background: rgba(0,0,0,0.05);
    color: #4B5563; /* Gray 600 */
}

/* Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor; /* Use text color */
    opacity: 0.2;
    animation: progressBar linear forwards;
    width: 100%;
}

.toast.success .toast-progress { background: #22c55e; }
.toast.error .toast-progress { background: #ef4444; }
.toast.warning .toast-progress { background: #f59e0b; }
.toast.info .toast-progress { background: #3b82f6; }

/* Regular Toast - Ensure proper spacing */
.toast:not(.cart-toast) {
    gap: 0;
}

/* Cart Toast Specifics */
.cart-toast {
    padding: 16px;
    gap: 0;
    min-width: 340px;
}

.cart-toast .toast-header {
    margin-bottom: 0;
}

.cart-toast .toast-body {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.toast-cart-popup {
    /* Removed redundant border-top as it's now in .toast-body */
}

.toast-cart-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.toast-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    background: rgba(249, 250, 251, 0.5); /* Very light gray */
    border-radius: 2px;
}

.toast-cart-item-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 2px;
}

.toast-cart-item-details {
    flex: 1;
}

.toast-cart-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #111;
}

.toast-cart-item-info, .toast-cart-item-price {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.toast-cart-summary {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-weight: 600;
    font-size: 14px;
}

.toast-cart-button {
    display: block;
    width: 100%;
    text-align: center;
    background: #000;
    color: #fff;
    padding: 8px;
    border-radius: 2px;
    margin-top: 12px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.toast-cart-button:hover {
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}

/* Keyframes */
@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOutUp {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

/* RTL Support */
[dir="rtl"] .toast {
    font-family: "Tajawal", "Almarai", sans-serif;
}

[dir="rtl"] .toast-header {
    flex-direction: row-reverse; /* Reverse order in RTL */
}

[dir="rtl"] .toast-close {
    margin-left: 0;
    margin-right: 4px;
}
