/* ==========================================================================
   Catalyst — Badge Shortcode Frontend Styles
   Provides styles for [catalyst_badge] and [catalyst_badge_system].
   Inline styles in the PHP handle per-badge sizing and earned/unearned
   appearance; this file handles hover states and criteria layout that
   cannot be expressed as inline styles.
   ========================================================================== */

/* ── Badge item container ──────────────────────────────────────────────── */

.cat-badge-item {
    position: relative; /* Required for tooltip positioning */
}

/* ── Criteria: list mode (rendered below the badge label) ──────────────── */

.cat-badge-item__criteria--list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 2px;
    width: 100%;
    max-width: 160px;
    text-align: left;
}

/* ── Criteria: tooltip mode (shown on hover) ───────────────────────────── */

.cat-badge-item__criteria--tooltip {
    /* Hidden by default; shown on .cat-badge-item hover via the rule below */
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: 280px;
    padding: 10px 14px;
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    text-align: left;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Used when display is switched to 'flex' */
    flex-direction: column;
    gap: 5px;
}

/* Downward-pointing arrow on the tooltip */
.cat-badge-item__criteria--tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #e2e8f0;
}

/* Show tooltip on hover */
.cat-badge-item:hover .cat-badge-item__criteria--tooltip {
    display: flex;
}

/* ── Criteria item row ─────────────────────────────────────────────────── */

.cat-criteria-item {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 11px;
    line-height: 1.45;
    color: inherit;
}

/* Tooltip items inherit the light-background colour */
.cat-badge-item__criteria--tooltip .cat-criteria-item {
    font-size: 12px;
    color: #1e293b;
}

/* Icon column: prevents the emoji from wrapping */
.cat-criteria-item__icon {
    flex-shrink: 0;
    line-height: 1.45;
}

/* ── Pending (not yet fulfilled) ───────────────────────────────────────── */

/* Light background (list mode) — muted grey */
.cat-criteria-item--pending .cat-criteria-item__text {
    color: #9ca3af;
}

/* Light background (tooltip) — muted grey */
.cat-badge-item__criteria--tooltip .cat-criteria-item--pending .cat-criteria-item__text {
    color: #9ca3af;
}
