/* Fantasy Mate shared Insight Cards */

.insight-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    min-width: 0;
}

.insight-trigger {
    display: inline-grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    padding: 0;
    color: #70cf72;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font: inherit;
    line-height: 1;
    opacity: .9;
    cursor: help;
    vertical-align: middle;
    transition: opacity 140ms ease, background-color 140ms ease, color 140ms ease;
}

.insight-trigger::before {
    content: "i";
    display: flex;
    align-items: center;
    justify-content: center;
    width: .88rem;
    height: .88rem;
    padding: 0 0 .02rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .61rem;
    font-weight: 700;
    font-style: normal;
    line-height: .88rem;
    box-sizing: border-box;
}

.insight-trigger:hover,
.insight-trigger:focus-visible,
.insight-trigger[aria-expanded="true"] {
    opacity: 1;
}

.insight-trigger:focus-visible {
    outline: 2px solid #70cf72;
    outline-offset: 3px;
}

.insight-card-popover {
    position: fixed;
    z-index: 1200;
    width: min(360px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 24px));
    overflow: auto;
    padding: 1rem 1rem .95rem;
    color: #1e2923;
    background: #fff;
    border: 1px solid rgba(20, 56, 37, .18);
    border-radius: 14px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, .28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(.985);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity 130ms ease, transform 130ms ease, visibility 130ms ease;
}

.insight-card-popover.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.insight-card-popover__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .65rem;
}

.insight-card-popover__title {
    margin: 0;
    color: #173b28;
    font-size: 1.02rem;
    font-weight: 750;
    line-height: 1.3;
}

.insight-card-popover__close {
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 1.8rem;
    padding: 0;
    color: #53625a;
    background: #f0f4f1;
    border: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.insight-card-popover__close:hover,
.insight-card-popover__close:focus-visible {
    color: #173b28;
    background: #e4ece7;
}

.insight-card-popover__summary,
.insight-card-popover__why p {
    margin: 0;
    color: #3e4b44;
    font-size: .9rem;
    line-height: 1.52;
}

.insight-card-popover__why {
    margin: .85rem 0;
    padding: .75rem .8rem;
    background: #f4f8f5;
    border-left: 3px solid #3f9138;
    border-radius: 0 8px 8px 0;
}

.insight-card-popover__why strong {
    display: block;
    margin-bottom: .25rem;
    color: #244932;
    font-size: .75rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.insight-card-popover__link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #2d6f31;
    font-size: .86rem;
    font-weight: 750;
    text-decoration: none;
}

.insight-card-popover__link:hover,
.insight-card-popover__link:focus-visible {
    color: #1e5423;
    text-decoration: underline;
}

.insight-card-popover__error {
    margin: 0;
    color: #7a3030;
    font-size: .88rem;
    line-height: 1.45;
}

/* Receiving grid integration */
.ri-group-row .insight-label,
.ri-column-row .insight-label {
    white-space: nowrap;
}

.ri-group-row .insight-trigger,
.ri-column-row .insight-trigger {
    color: #8fb49a;
}


.ri-column-row .insight-trigger {
    margin-left: .05rem;
}

@media (max-width: 575.98px) {
    .insight-card-popover {
        width: calc(100vw - 20px);
        max-height: min(70vh, 520px);
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .insight-trigger,
    .insight-card-popover {
        transition: none;
    }
}


/* Cross-page integrations */
.pw-page .insight-label,
.hi-page .insight-label,
.dm-page .insight-label {
    justify-content: flex-start;
    text-align: inherit;
}

.pw-page th .insight-label,
.hi-table th .insight-label,
.dm-table th .insight-label {
    justify-content: center;
}

.pw-page .insight-trigger,
.hi-page .insight-trigger,
.dm-page .insight-trigger {
    color: currentColor;
    opacity: .62;
}

.hi-header-cell .insight-trigger,
.dm-table th .insight-trigger {
    margin-left: .12rem;
    flex: 0 0 1rem;
}

.dm-table th .insight-label {
    width: 100%;
}

@media (max-width: 767.98px) {
    .pw-page .insight-trigger,
    .hi-page .insight-trigger,
    .dm-page .insight-trigger {
        width: 1.1rem;
        height: 1.1rem;
        flex-basis: 1.1rem;
    }
}
