/* ==========================================================================
 * Experience Cloud (LWR) HTML component with CSS class "lwr-udm-bubble"
 * -> floating gradient bubble, lower right, left of the Flowise chat bubble.
 *
 * Host:  <community_builder-html-editor class="lwr-udm-bubble">
 * Inner: <div class="cb-outputRichText-container">UDM</div>
 *
 * Put a link in the HTML component (<a href="...">UDM</a>) to make it clickable;
 * the anchor is stretched over the whole bubble. Its text is hidden visually
 * (the bolt icon replaces it) but stays in the DOM.
 * ========================================================================== */

.lwr-udm-bubble {
    position: fixed !important;
    right: 80px !important;
    bottom: 20px !important;
    left: auto !important;
    top: auto !important;
    z-index: 10000 !important;

    display: block !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    margin: 0 !important;
    padding: 0 !important;

    overflow: visible !important;
    border-radius: 9999px !important;
    background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 55%, #06b6d4 100%) !important;
    box-shadow:
        0 4px 10px rgba(15, 23, 42, 0.22),
        0 1px 3px rgba(15, 23, 42, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;

    transition:
        filter 200ms ease,
        box-shadow 200ms ease;
}

.lwr-udm-bubble community_builder-output-rich-text,
.lwr-udm-bubble .cb-outputRichText-container {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
}

.lwr-udm-bubble a,
.lwr-udm-bubble p {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    color: transparent !important;
}

.lwr-udm-bubble a {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    border-radius: 9999px !important;
    cursor: pointer;
}

/* utility:connected_apps icon, white, centered. */
.lwr-udm-bubble::before {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;

    width: 26px;
    height: 26px;
    content: "";
    pointer-events: none;

    background-color: #ffffff;

    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 520 520'%3E%3Cpath d='m238 312-38 176c-2 10 11 17 17 9l210-260c6-7 1-17-7-17H308c-8 0-13-9-9-15l99-162c6-10-1-23-13-23H208c-11 0-20 7-24 17l-83 243c-3 10 4 20 14 20h114c6 0 11 6 9 12'/%3E%3C/svg%3E")
        center / contain no-repeat;

    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 520 520'%3E%3Cpath d='m238 312-38 176c-2 10 11 17 17 9l210-260c6-7 1-17-7-17H308c-8 0-13-9-9-15l99-162c6-10-1-23-13-23H208c-11 0-20 7-24 17l-83 243c-3 10 4 20 14 20h114c6 0 11 6 9 12'/%3E%3C/svg%3E")
        center / contain no-repeat;

    transform: translate(-50%, -50%) scale(1);
    transition: transform 200ms ease;
}

/* Soft pulsing ring (reuses the udgBubblePulse keyframes defined above). */
.lwr-udm-bubble::after {
    position: absolute;
    inset: 0;
    content: "";
    pointer-events: none;
    border-radius: 9999px;
    animation: udgBubblePulse 2.8s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .lwr-udm-bubble::after {
        animation: none;
    }
}

.lwr-udm-bubble:hover {
    filter: brightness(1.1) saturate(1.1);
    box-shadow:
        0 8px 18px rgba(14, 165, 233, 0.4),
        0 2px 4px rgba(15, 23, 42, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
}

.lwr-udm-bubble:hover::before {
    transform: translate(-50%, -50%) scale(1.12) rotate(-8deg);
}

.lwr-udm-bubble:active::before {
    transform: translate(-50%, -50%) scale(0.95);
}

.lwr-udm-bubble:focus-within {
    outline: 3px solid rgba(147, 197, 253, 0.95);
    outline-offset: 3px;
}


/* ==========================================================================
 * Experience Cloud (LWR) udgAnyModal containing the UDG
 *
 * Give the modal a fixed height,
 * stop the modal body from scrolling, and cap the grid's table scroller to
 * (modal height - grid chrome) so the grid's own scroller is the only one.
 * Tune --udg-modal-chrome if a gap shows at the bottom or the Load More row
 * is clipped.
 * ========================================================================== */

/* Variables */
community_layout-section section.slds-modal:is([c-anymodal_anymodal], [udg-anymodal_anymodal]):has(c-universal-data-grid, udg-universal-data-grid) {
  --udg-modal-h: min(820px, calc(100vh - 100px));
  --udg-modal-chrome: 7.5rem; /* grid title/toolbar + Load More row + padding around the scrolling table */
}

/* Modal content */
community_layout-section section.slds-modal:is([c-anymodal_anymodal], [udg-anymodal_anymodal]):has(c-universal-data-grid, udg-universal-data-grid) .slds-modal__content {
  height: var(--udg-modal-h) !important;
  max-height: var(--udg-modal-h) !important;
  overflow: hidden !important;
  padding: 0 !important;
}

/* Grid host */
community_layout-section section.slds-modal:is([c-anymodal_anymodal], [udg-anymodal_anymodal]):has(c-universal-data-grid, udg-universal-data-grid)
:is(c-universal-data-grid, udg-universal-data-grid).taller-mode {
  max-height: var(--udg-modal-h) !important;
}

/* Scroll area */
community_layout-section section.slds-modal:is([c-anymodal_anymodal], [udg-anymodal_anymodal]):has(c-universal-data-grid, udg-universal-data-grid)
:is(c-universal-data-grid, udg-universal-data-grid).taller-mode .slds-scrollable_y {
  max-height: calc(var(--udg-modal-h) - var(--udg-modal-chrome)) !important;
}

/* Table container */
community_layout-section section.slds-modal:is([c-anymodal_anymodal], [udg-anymodal_anymodal]):has(c-universal-data-grid, udg-universal-data-grid)
:is(c-universal-data-grid, udg-universal-data-grid).taller-mode .data-table-container {
  max-height: calc(var(--udg-modal-h) - var(--udg-modal-chrome) + 2.5rem) !important;
}