/* Global Toast Notification System */
.global-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    min-width: 300px;
    color: #1f2937;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.global-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.global-toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Toast Types */
.global-toast.success {
    border-left: 4px solid #10b981;
}

.global-toast.error {
    border-left: 4px solid #ef4444;
}

.global-toast.warning {
    border-left: 4px solid #f59e0b;
}

.global-toast.info {
    border-left: 4px solid #3b82f6;
}

/* Toast Content */
.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.global-toast.success .toast-icon {
    background: #10b981;
    color: white;
}

.global-toast.error .toast-icon {
    background: #ef4444;
    color: white;
}

.global-toast.warning .toast-icon {
    background: #f59e0b;
    color: white;
}

.global-toast.info .toast-icon {
    background: #3b82f6;
    color: white;
}

.toast-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    margin: 0;
}

.toast-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
}

.toast-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.toast-action-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toast-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.toast-action-btn.primary {
    background: #3b82f6;
    color: white;
}

.toast-action-btn.primary:hover {
    background: #2563eb;
}

.toast-action-btn.danger {
    background: #ef4444;
    color: white;
}

.toast-action-btn.danger:hover {
    background: #dc2626;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.7;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #6b7280;
    opacity: 1;
}

.toast-close svg {
    width: 12px;
    height: 12px;
}

/* Stacking for multiple toasts - handled by JavaScript */

/*
 * Strategy canvas: bottom-right stack + same visual language as
 * lead-magnet-page-builder (.lmpb-toast in lead-magnet-page-builder.css)
 */
body.strategy-canvas-page .global-toast {
    top: auto;
    right: 20px;
    left: auto;
    min-width: 0;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    backdrop-filter: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    word-wrap: break-word;
    transform: translateX(calc(100% + 24px));
    transition:
        opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.strategy-canvas-page .global-toast.show {
    opacity: 1;
    transform: translateX(0);
}

body.strategy-canvas-page .global-toast.fade-out {
    opacity: 0;
    transform: translateX(calc(100% + 24px));
    transition:
        opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
        bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* LMPB-style solid chips (no frosted panel / left accent) */
body.strategy-canvas-page .global-toast.success {
    background: var(--qb-brand-primary, #5ab774);
    color: #ffffff;
}

body.strategy-canvas-page .global-toast.error {
    background: #dc2626;
    color: #ffffff;
}

body.strategy-canvas-page .global-toast.warning {
    background: var(--qb-brand-accent, #fef3a4);
    color: var(--qb-brand-deep, #072b2e);
    border: 1px solid rgba(7, 43, 46, 0.14);
}

body.strategy-canvas-page .global-toast.info {
    background: var(--qb-brand-deep, #072b2e);
    color: var(--qb-header-text, #f3fcf6);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Text-only feel like .lmpb-toast — hide circular badge; message uses full width */
body.strategy-canvas-page .global-toast .toast-icon {
    display: none;
}

body.strategy-canvas-page .global-toast .toast-content {
    gap: 10px;
    align-items: flex-start;
}

body.strategy-canvas-page .global-toast .toast-title,
body.strategy-canvas-page .global-toast .toast-description {
    color: inherit;
}

body.strategy-canvas-page .global-toast.warning .toast-title,
body.strategy-canvas-page .global-toast.warning .toast-description {
    color: var(--qb-brand-deep, #072b2e);
}

/* Close control: contrast per chip */
body.strategy-canvas-page .global-toast.success .toast-close,
body.strategy-canvas-page .global-toast.error .toast-close {
    color: rgba(255, 255, 255, 0.85);
}

body.strategy-canvas-page .global-toast.success .toast-close:hover,
body.strategy-canvas-page .global-toast.error .toast-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body.strategy-canvas-page .global-toast.warning .toast-close {
    color: rgba(7, 43, 46, 0.55);
}

body.strategy-canvas-page .global-toast.warning .toast-close:hover {
    background: rgba(7, 43, 46, 0.08);
    color: var(--qb-brand-deep, #072b2e);
}

body.strategy-canvas-page .global-toast.info .toast-close {
    color: rgba(243, 252, 246, 0.75);
}

body.strategy-canvas-page .global-toast.info .toast-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--qb-header-text, #f3fcf6);
}

body.strategy-canvas-page .global-toast .toast-action-btn {
    color: inherit;
    opacity: 0.95;
}

body.strategy-canvas-page .global-toast .toast-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
}

body.strategy-canvas-page .global-toast.warning .toast-action-btn:hover {
    background: rgba(7, 43, 46, 0.08);
}

body.strategy-canvas-page .global-toast .toast-action-btn.primary {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

body.strategy-canvas-page .global-toast.warning .toast-action-btn.primary {
    background: var(--qb-brand-primary, #5ab774);
    color: #ffffff;
}

body.strategy-canvas-page .global-toast.warning .toast-action-btn.primary:hover {
    background: var(--qb-primary-hover, #4a9d63);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .global-toast {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        min-width: auto;
        transform: translateY(-100%);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .global-toast.show {
        transform: translateY(0);
    }
    
    .global-toast.fade-out {
        transform: translateY(-100%);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Mobile stacking handled by JavaScript */

    body.strategy-canvas-page .global-toast {
        top: auto;
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        min-width: auto;
        transform: translateY(100%);
        transition:
            all 0.4s cubic-bezier(0.16, 1, 0.3, 1),
            bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    body.strategy-canvas-page .global-toast.show {
        transform: translateY(0);
    }

    body.strategy-canvas-page .global-toast.fade-out {
        transform: translateY(100%);
        transition:
            all 0.3s cubic-bezier(0.16, 1, 0.3, 1),
            bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

/* Animation keyframes */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes toastSlideInMobile {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOutMobile {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}
