/* ============================================================
   Popups Manager Styles (Center Modals & Bottom Toasts)
   ============================================================ */

/* Wrapper */
.domrdm-popups-wrapper {
    position: relative;
    z-index: 100000;
}

.domrdm-popup-item[hidden] {
    display: none !important;
}

.domrdm-popup-item {
    pointer-events: none;
}

.domrdm-popup-item.is-active {
    pointer-events: auto;
}

/* Common Card Styles */
.domrdm-popup-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15);
    padding: 28px;
    position: relative;
    box-sizing: border-box;
}

/* Close button */
.domrdm-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    z-index: 10;
}
.domrdm-popup-close:hover {
    background: #e5e5e5;
    color: #000;
}
.domrdm-popup-close svg {
    width: 12px;
    height: 12px;
}

/* Title & Body */
.domrdm-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding-right: 36px;
    line-height: 1.3;
}
.domrdm-popup-body {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}
.domrdm-popup-body p {
    margin: 0 0 12px;
}
.domrdm-popup-body p:last-child {
    margin-bottom: 0;
}
.domrdm-popup-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 12px;
}
.domrdm-popup-body a:not([class]) {
    color: #1F9356;
    text-decoration: underline;
}
.domrdm-popup-body a:not([class]):hover {
    color: #157a45;
}

/* ============================================================
   1. Center Modal CPT Style
   ============================================================ */
.domrdm-popup-item--modal {
    position: fixed;
    inset: 0;
    z-index: 100005;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.domrdm-popup-item--modal .domrdm-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.domrdm-popup-item--modal.is-active .domrdm-popup-overlay {
    opacity: 1;
    pointer-events: auto;
}
.domrdm-popup-item--modal .domrdm-popup-card {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    z-index: 2;
}

/* Animations for Modal Active State */
.domrdm-popup-item--modal.is-active .domrdm-popup-card {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================================
   2. Bottom Toast Style (similar to Cookies consent popup)
   ============================================================ */
.domrdm-popup-item--toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    width: 360px;
    max-width: calc(100% - 48px);
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.domrdm-popup-item--toast .domrdm-popup-card {
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px 24px;
}
.domrdm-popup-item--toast.is-active {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* Center Modals on mobile slide up from bottom */
    .domrdm-popup-item--modal {
        padding: 0;
        align-items: flex-end;
    }
    .domrdm-popup-item--modal .domrdm-popup-card {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 85vh;
        transform: translateY(100%);
        padding: 28px 20px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .domrdm-popup-item--modal.is-active .domrdm-popup-card {
        transform: translateY(0);
    }

    /* Toasts on mobile slide up at the bottom and take full width */
    .domrdm-popup-item--toast {
        bottom: 76px; /* Avoid overlaying mobile bottom nav pill */
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }
    .domrdm-popup-item--toast .domrdm-popup-card {
        border-radius: 16px;
        padding: 16px 20px;
    }
}
