/* ═══════════════════════════════════════════════════════════
   Storefront Centralized Toast System — Premium Design
   ═══════════════════════════════════════════════════════════ */

:root {
    --store-toast-z: 10000;
    --store-toast-width: 380px;
    --store-toast-radius: 20px;
    --store-toast-font: inherit;
    /* Default Colors (Themes should override these) */
    --brand-success: #10b981;
    --brand-error: #ef4444;
    --brand-info: #3b82f6;
    --brand-warning: #f59e0b;
}

#store-toast-container {
    position: fixed;
    bottom: 2rem;
    z-index: var(--store-toast-z);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    width: calc(100% - 2rem);
    max-width: var(--store-toast-width);
}

/* Position based on Dir */
[dir="ltr"] #store-toast-container { right: 1rem; }
[dir="rtl"] #store-toast-container { left: 1rem; }

@media (max-width: 640px) {
    #store-toast-container {
        left: 50% !important;
        transform: translateX(-50%);
        bottom: 5.5rem; /* Above mobile nav */
    }
}

.store-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--store-toast-radius);
    padding: 1rem;
    display: flex;
    align-items: start;
    gap: 0.85rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: store-toast-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
}

.store-toast::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--toast-color, #eee);
}
[dir="ltr"] .store-toast::before { left: 0; }
[dir="rtl"] .store-toast::before { right: 0; }

/* Types */
.store-toast.success { --toast-color: var(--brand-success); }
.store-toast.error { --toast-color: var(--brand-error); animation: store-toast-shake 0.4s ease-in-out; }
.store-toast.info { --toast-color: var(--brand-info); }
.store-toast.warning { --toast-color: var(--brand-warning); }

.store-toast-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(var(--icon-color-rgb, 100, 100, 100), 0.1);
    color: var(--toast-color);
}

.store-toast.success { --icon-color-rgb: 16, 185, 129; }
.store-toast.error   { --icon-color-rgb: 239, 68, 68; }
.store-toast.info    { --icon-color-rgb: 59, 130, 246; }

.store-toast-body {
    flex: 1;
    min-width: 0;
}

.store-toast-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.store-toast-message {
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    line-height: 1.4;
}

.store-toast-close {
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.2s;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
}

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

/* Animations */
@keyframes store-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes store-toast-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

@keyframes store-toast-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Progress bar (Optional touch) */
.store-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--toast-color);
    opacity: 0.2;
    transform-origin: left;
}
