/* Toast Notification Container */
.custom-toast-container {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 380px;
    max-width: 92%;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Position Configurations */
.custom-toast-container.top-right {
    top: 20px;
    right: 20px;
}
.custom-toast-container.top-left {
    top: 20px;
    left: 20px;
}
.custom-toast-container.bottom-right {
    bottom: 20px;
    right: 20px;
}
.custom-toast-container.bottom-left {
    bottom: 20px;
    left: 20px;
}
.custom-toast-container.top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}
.custom-toast-container.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Stackable Toast Card */
.custom-toast {
    background: #ffffff;
    color: #1f2937;
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    border-left: 5px solid var(--toast-theme, #16a34a);
}

/* Success, Error, Warning modifier color updates */
.custom-toast.success {
    --toast-theme: var(--toast-success-bg, #16a34a);
}
.custom-toast.error {
    --toast-theme: #dc2626;
}
.custom-toast.warning {
    --toast-theme: #eab308;
}
.custom-toast.info {
    --toast-theme: #2563eb;
}

/* Solid background style option (matching user settings if themeColor is used as bg) */
.custom-toast.solid {
    background: var(--toast-theme, #16a34a);
    color: #ffffff;
    border-left: none;
}
.custom-toast.solid .custom-toast-title {
    color: #ffffff;
}
.custom-toast.solid .custom-toast-message,
.custom-toast.solid .custom-toast-time {
    color: rgba(255, 255, 255, 0.9);
}
.custom-toast.solid .custom-toast-close {
    color: rgba(255, 255, 255, 0.8);
}
.custom-toast.solid .custom-toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}
.custom-toast.solid .custom-toast-btn.btn-cart {
    background: #ffffff;
    color: var(--toast-theme, #16a34a);
}
.custom-toast.solid .custom-toast-btn.btn-cart:hover {
    background: rgba(255, 255, 255, 0.9);
}
.custom-toast.solid .custom-toast-btn.btn-close-toast {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.custom-toast.solid .custom-toast-btn.btn-close-toast:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Header Content Layout */
.custom-toast-header {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px 10px 16px;
    gap: 12px;
}

.custom-toast-icon {
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1px;
}
.custom-toast:not(.solid) .custom-toast-icon {
    background: rgba(0, 0, 0, 0.05);
    color: var(--toast-theme);
}
.custom-toast.solid .custom-toast-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.custom-toast-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.custom-toast-message {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
    word-break: break-word;
}
.custom-toast-message strong {
    font-weight: 600;
}

.custom-toast-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.custom-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: all 0.2s;
    margin-top: -4px;
    margin-right: -4px;
}
.custom-toast-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Action Buttons Quick Actions */
.custom-toast-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px 16px;
}

.custom-toast-btn {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    text-align: center;
    text-decoration: none !important;
    transition: all 0.2s;
}

.custom-toast-btn.btn-cart {
    background: var(--toast-theme, #16a34a);
    color: #ffffff;
}
.custom-toast-btn.btn-cart:hover {
    opacity: 0.9;
}

.custom-toast-btn.btn-close-toast {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}
.custom-toast-btn.btn-close-toast:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Progress Bar indicator */
.custom-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.15);
    width: 100%;
    transform-origin: left;
}
.custom-toast:not(.solid) .custom-toast-progress {
    background: var(--toast-theme, #16a34a);
}

/* Animations */
@keyframes slideInRight {
    from { transform: translateX(110%); }
    to { transform: translateX(0); }
}
@keyframes slideInLeft {
    from { transform: translateX(-110%); }
    to { transform: translateX(0); }
}
@keyframes slideInTop {
    from { transform: translateY(-110%); }
    to { transform: translateY(0); }
}
@keyframes slideInBottom {
    from { transform: translateY(110%); }
    to { transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

/* Animation Classes classes */
.custom-toast.slide-in-right { animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.custom-toast.slide-in-left { animation: slideInLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.custom-toast.slide-in-top { animation: slideInTop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.custom-toast.slide-in-bottom { animation: slideInBottom 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.custom-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .custom-toast-container {
        width: 92%;
        left: 4% !important;
        right: 4% !important;
        transform: none !important;
    }
    
    .custom-toast-container.top-right,
    .custom-toast-container.top-left,
    .custom-toast-container.top-center {
        top: 10px;
    }
    
    .custom-toast-container.bottom-right,
    .custom-toast-container.bottom-left,
    .custom-toast-container.bottom-center {
        bottom: 10px;
    }
    
    .custom-toast {
        margin: 0 auto;
    }
}
