/**
 * BPMB UI Helpers — toast notifications + confirm modal styles
 *
 * Pairs with public/js/bpmb-ui-helpers.js. This file is self-contained so
 * any caller (Free or Pro) can depend on the `bpmb-ui-helpers` style handle
 * without also needing the full plugin stylesheet.
 *
 * Includes its own body-scroll-lock + modal-appear keyframe so the helper
 * renders correctly even on Pro-only pages where the main Free public CSS
 * is not loaded.
 *
 * @package BuddyPress_Member_Blog
 * @since   3.4.2
 */

/*--------------------------------------------------------------
# Toast Notifications
--------------------------------------------------------------*/
.bpmb-toast-container {
    position: fixed;
    top: var(--bpmb-space-lg, 24px);
    right: var(--bpmb-space-lg, 24px);
    z-index: var(--bpmb-z-tooltip, 1100);
    display: flex;
    flex-direction: column;
    gap: var(--bpmb-space-sm, 8px);
    max-width: 400px;
    pointer-events: none;
}

.bpmb-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--bpmb-space-sm, 12px);
    padding: var(--bpmb-space-md, 16px);
    background: var(--bpmb-bg-primary, #fff);
    border-radius: var(--bpmb-radius-md, 8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    animation: bpmb-toast-slide-in 0.3s ease-out;
    transform-origin: top right;
    border-left: 4px solid var(--bpmb-primary, #2468c6);
}

.bpmb-toast.is-leaving,
.bpmb-toast--hiding {
    animation: bpmb-toast-slide-out 0.2s ease-in forwards;
}

@keyframes bpmb-toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bpmb-toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Toast Types */
.bpmb-toast--success {
    border-left-color: var(--bpmb-success, #28a745);
}

.bpmb-toast--success .bpmb-toast-icon {
    color: var(--bpmb-success, #28a745);
}

.bpmb-toast--error {
    border-left-color: var(--bpmb-danger, #dc3545);
}

.bpmb-toast--error .bpmb-toast-icon {
    color: var(--bpmb-danger, #dc3545);
}

.bpmb-toast--warning {
    border-left-color: var(--bpmb-warning, #ffc107);
}

.bpmb-toast--warning .bpmb-toast-icon {
    color: var(--bpmb-warning, #ffc107);
}

.bpmb-toast--info {
    border-left-color: var(--bpmb-info, #17a2b8);
}

.bpmb-toast--info .bpmb-toast-icon {
    color: var(--bpmb-info, #17a2b8);
}

/* Toast Icon */
.bpmb-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bpmb-toast-icon svg {
    width: 100%;
    height: 100%;
}

/* Toast Content */
.bpmb-toast-content {
    flex: 1;
    min-width: 0;
}

.bpmb-toast-title {
    margin: 0 0 var(--bpmb-space-xs, 4px) 0;
    font-size: var(--bpmb-font-size-md, 14px);
    font-weight: var(--bpmb-font-weight-semibold, 600);
    color: var(--bpmb-text-primary, #303030);
    line-height: var(--bpmb-line-height-tight, 1.2);
}

.bpmb-toast-message {
    margin: 0;
    font-size: var(--bpmb-font-size-sm, 13px);
    color: var(--bpmb-text-secondary, #6c757d);
    line-height: var(--bpmb-line-height-base, 1.5);
}

/* Toast Close Button */
.bpmb-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--bpmb-text-muted, #999);
    cursor: pointer;
    border-radius: var(--bpmb-radius-sm, 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background-color var(--bpmb-transition-fast, 150ms ease), color var(--bpmb-transition-fast, 150ms ease);
}

.bpmb-toast-close:hover {
    background-color: var(--bpmb-bg-hover, rgba(0, 0, 0, 0.05));
    color: var(--bpmb-text-primary, #303030);
}

.bpmb-toast-close:focus {
    outline: none;
    box-shadow: var(--bpmb-shadow-focus, 0 0 0 3px rgba(36, 104, 198, 0.25));
}

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

/* Mobile responsive toasts */
@media (max-width: 480px) {
    .bpmb-toast-container {
        top: auto;
        bottom: var(--bpmb-space-md, 16px);
        right: var(--bpmb-space-md, 16px);
        left: var(--bpmb-space-md, 16px);
        max-width: none;
    }

    .bpmb-toast {
        animation-name: bpmb-toast-slide-up;
    }

    .bpmb-toast.is-leaving,
    .bpmb-toast--hiding {
        animation-name: bpmb-toast-slide-down;
    }
}

@keyframes bpmb-toast-slide-up {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bpmb-toast-slide-down {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(100%);
    }
}

/* Dark mode toast styles */
.dark-mode .bpmb-toast,
.dark-scheme .bpmb-toast {
    background: var(--bpmb-bg-secondary, #2d2d2d);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dark-mode .bpmb-toast-title,
.dark-scheme .bpmb-toast-title {
    color: var(--bpmb-text-primary, #e0e0e0);
}

.dark-mode .bpmb-toast-message,
.dark-scheme .bpmb-toast-message {
    color: var(--bpmb-text-secondary, #a0a0a0);
}

/*--------------------------------------------------------------
# Body scroll lock (shared with other plugin modals)
--------------------------------------------------------------*/
body.bpmb-modal-open {
    overflow: hidden;
}

/*--------------------------------------------------------------
# Confirmation Modal
--------------------------------------------------------------*/
.bpmb-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--bpmb-z-modal, 1000);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--bpmb-space-md, 16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--bpmb-transition-base, 200ms ease), visibility var(--bpmb-transition-base, 200ms ease);
}

.bpmb-confirm-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.bpmb-confirm-modal .bpmb-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.bpmb-confirm-modal .bpmb-confirm-content {
    position: relative;
    background: var(--bpmb-bg-primary, #fff);
    border-radius: var(--bpmb-radius-lg, 12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
    padding: var(--bpmb-space-xl, 32px);
    text-align: center;
    animation: bpmb-modal-appear 0.2s ease-out;
}

@keyframes bpmb-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.bpmb-confirm-modal .bpmb-confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--bpmb-space-md, 16px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Confirm type styles */
.bpmb-confirm-modal .bpmb-confirm--danger .bpmb-confirm-icon {
    background: var(--bpmb-danger-light, #fce8ea);
    color: var(--bpmb-danger, #dc3545);
}

.bpmb-confirm-modal .bpmb-confirm--warning .bpmb-confirm-icon {
    background: var(--bpmb-warning-light, #fff8e1);
    color: var(--bpmb-warning, #ffc107);
}

.bpmb-confirm-modal .bpmb-confirm--info .bpmb-confirm-icon {
    background: var(--bpmb-info-light, #e8f4fd);
    color: var(--bpmb-info, #17a2b8);
}

.bpmb-confirm-modal .bpmb-confirm-icon svg {
    width: 32px;
    height: 32px;
}

.bpmb-confirm-modal .bpmb-confirm-title {
    margin: 0 0 var(--bpmb-space-sm, 8px) 0;
    font-size: var(--bpmb-font-size-xl, 18px);
    font-weight: var(--bpmb-font-weight-semibold, 600);
    color: var(--bpmb-text-primary, #303030);
}

.bpmb-confirm-modal .bpmb-confirm-message {
    margin: 0 0 var(--bpmb-space-lg, 24px) 0;
    font-size: var(--bpmb-font-size-md, 14px);
    color: var(--bpmb-text-secondary, #6c757d);
    line-height: var(--bpmb-line-height-relaxed, 1.7);
}

.bpmb-confirm-modal .bpmb-confirm-actions {
    display: flex;
    gap: var(--bpmb-space-sm, 8px);
    justify-content: center;
}

.bpmb-confirm-modal .bpmb-confirm-btn {
    min-width: 100px;
    min-height: 40px;
    padding: var(--bpmb-space-sm, 10px) var(--bpmb-space-md, 16px);
    border: none;
    border-radius: var(--bpmb-radius-md, 6px);
    font-size: var(--bpmb-font-size-md, 14px);
    font-weight: var(--bpmb-font-weight-medium, 500);
    cursor: pointer;
    transition: all var(--bpmb-transition-fast, 150ms ease);
}

.bpmb-confirm-modal .bpmb-confirm-btn--cancel {
    background: var(--bpmb-bg-secondary, #f8f9fa);
    color: var(--bpmb-text-primary, #303030);
}

.bpmb-confirm-modal .bpmb-confirm-btn--cancel:hover {
    background: var(--bpmb-bg-tertiary, #e9ecef);
}

.bpmb-confirm-modal .bpmb-confirm-btn--confirm {
    background: var(--bpmb-danger, #dc3545);
    color: var(--bpmb-text-light, #fff);
}

/* Confirm button color based on type */
.bpmb-confirm-modal .bpmb-confirm--danger .bpmb-confirm-btn--confirm {
    background: var(--bpmb-danger, #dc3545);
}

.bpmb-confirm-modal .bpmb-confirm--danger .bpmb-confirm-btn--confirm:hover {
    background: #c82333;
}

.bpmb-confirm-modal .bpmb-confirm--warning .bpmb-confirm-btn--confirm {
    background: var(--bpmb-warning, #ffc107);
    color: var(--bpmb-text-dark, #212529);
}

.bpmb-confirm-modal .bpmb-confirm--warning .bpmb-confirm-btn--confirm:hover {
    background: #e0a800;
}

.bpmb-confirm-modal .bpmb-confirm--info .bpmb-confirm-btn--confirm {
    background: var(--bpmb-info, #17a2b8);
}

.bpmb-confirm-modal .bpmb-confirm--info .bpmb-confirm-btn--confirm:hover {
    background: #138496;
}

.bpmb-confirm-modal .bpmb-confirm-btn:focus {
    outline: none;
    box-shadow: var(--bpmb-shadow-focus, 0 0 0 3px rgba(36, 104, 198, 0.25));
}

.bpmb-confirm-btn:focus-visible {
    outline: 2px solid var(--bpmb-text-light, #fff);
    outline-offset: 2px;
}

/*--------------------------------------------------------------
# Confirmation Modal - Mobile
--------------------------------------------------------------*/
@media only screen and (max-width: 480px) {
    .bpmb-confirm-modal {
        padding: var(--bpmb-space-sm, 8px);
    }

    .bpmb-confirm-modal .bpmb-confirm-content {
        padding: var(--bpmb-space-lg, 24px) var(--bpmb-space-md, 16px);
        max-width: 100%;
    }

    .bpmb-confirm-modal .bpmb-confirm-icon {
        width: 48px;
        height: 48px;
    }

    .bpmb-confirm-modal .bpmb-confirm-icon svg {
        width: 24px;
        height: 24px;
    }

    .bpmb-confirm-modal .bpmb-confirm-title {
        font-size: var(--bpmb-font-size-lg, 16px);
    }

    .bpmb-confirm-modal .bpmb-confirm-message {
        font-size: var(--bpmb-font-size-sm, 13px);
    }

    .bpmb-confirm-modal .bpmb-confirm-actions {
        flex-direction: column-reverse;
        gap: var(--bpmb-space-sm, 8px);
    }

    .bpmb-confirm-modal .bpmb-confirm-btn {
        width: 100%;
    }
}

/*--------------------------------------------------------------
# Reduced motion
--------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
    .bpmb-toast {
        animation: none;
    }

    .bpmb-confirm-modal .bpmb-confirm-content {
        animation: none;
    }
}

/*--------------------------------------------------------------
# High contrast mode
--------------------------------------------------------------*/
@media (prefers-contrast: high) {
    .bpmb-toast {
        border-width: 2px;
    }
}
