/* ============================================================
   PE Mass Actions Menu — Selection bar + dropdown popover
   Scope: ONLY Performance Evaluation mass actions
   (/performanceevaluation-v2 and employee PE detail).
   Namespace prefix: pma-* (PE Mass Actions).

   Cloned 1:1 from mass-actions-menu-v2.css (.mam-*) to keep
   visual parity with the Employees list mass-actions menu.

   Popover height adapts to viewport: JS measures the room between
   the trigger and the viewport edge and sets `max-height` inline.
   Content scrolls internally when the option list would overflow
   the available space.
   ============================================================ */

/* ─── Selection bar (above the grid, conditionally rendered) ── */
.pma-selbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: var(--is-brand-blue-100);
    border: 1px solid #cfe4f4;
    border-radius: var(--is-radius-md);
    font-family: var(--is-font-sans);
    color: var(--is-fg-1);
}

.pma-selbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.pma-selbar__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 10px;
    background: var(--is-brand-blue);
    color: #fff;
    font: 700 12px var(--is-font-mono);
    border-radius: 999px;
    flex-shrink: 0;
}

.pma-selbar__text {
    font: 600 13.5px var(--is-font-sans);
    color: var(--is-brand-blue-700);
}

.pma-selbar__text small {
    font: 500 12px var(--is-font-sans);
    color: var(--is-fg-3);
    margin-left: 6px;
}

.pma-selbar__selectall {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--is-brand-blue-700);
    font: 600 12.5px var(--is-font-sans);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.pma-selbar__selectall:hover { color: var(--is-brand-blue); }

.pma-selbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Clear-selection ghost button in the bar */
.pma-selbar__clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 11px;
    background: #fff;
    border: 1px solid #b9dcf0;
    border-radius: var(--is-radius-sm);
    color: var(--is-fg-2);
    font: 600 12.5px var(--is-font-sans);
    white-space: nowrap;
    cursor: pointer;
}
.pma-selbar__clear:hover { background: var(--is-bg-surface-3); }

/* Mass actions trigger button + chevron */
.pma-trigger-wrap {
    position: relative;
    display: inline-flex;
}

.pma-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--is-brand-blue);
    color: #fff;
    border: 0;
    font: 700 13px var(--is-font-sans);
    height: 32px;              /* PBI 6151 — ista visina kao "Poništi selekciju" (.pma-selbar__clear) */
    padding: 0 16px;
    border-radius: var(--is-radius-sm);
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
}
.pma-trigger:hover { background: var(--is-brand-blue-700); }
.pma-trigger:focus-visible {
    outline: 2px solid var(--is-action-blue);
    outline-offset: 2px;
}
.pma-trigger > i { font-size: 11px; }

/* PBI 6151 — informativan (plav) hint kad je PDF stavka klikabilna ali nema završenih (mockup #0a5c8c). */
/* Veća specifičnost od `.pma-menu__opt-text small` (0,1,1) + !important — inače siva boja pobijedi plavu. */
.pma-menu__opt-text small.pma-menu__opt-hint--info { color: #0a5c8c !important; font-weight: 600; }
.pma-trigger__chev { margin-left: 2px; font-size: 9px; }

/* ─── Dropdown popover ──────────────────────────────────────── */
.pma-menu {
    position: absolute;
    z-index: 9000;
    width: 352px;
    max-width: calc(100vw - 16px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--is-border-1);
    border-radius: var(--is-radius-md);
    box-shadow: var(--is-shadow-3);
    font-family: var(--is-font-sans);
    color: var(--is-fg-1);
    /* Static viewport-bounded max-height applied from the FIRST paint
       so the popover never extends past the viewport bottom and never
       causes a transient page-level scrollbar. The reserve covers the
       PE page header + filter bar above the trigger plus a small safety
       margin. The PE menu only has 4 options so it fits comfortably at
       any realistic height; the cap simply prevents overflow on short
       viewports. Scroll inside the popover is whitelisted in the JS
       scroll handler so it does NOT close the menu. */
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

/* Default placement = bottom-end (right edge aligned with button) */
.pma-menu--bottom-end {
    top: calc(100% + 4px);
    right: 0;
    bottom: auto;
    left: auto;
}

/* Auto-flip = top-end (above button, right edge aligned) */
.pma-menu--top-end {
    bottom: calc(100% + 4px);
    right: 0;
    top: auto;
    left: auto;
}

.pma-menu__head {
    padding: 8px 10px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--is-border-1);
}
.pma-menu__head h4 {
    margin: 0 0 2px;
    font: 700 13px var(--is-font-sans);
    color: var(--is-fg-1);
}
.pma-menu__head p {
    margin: 0;
    font: 500 11.5px var(--is-font-sans);
    color: var(--is-fg-3);
}

.pma-menu__group {
    padding: 6px 10px 4px;
    font: 700 10px var(--is-font-sans);
    color: var(--is-fg-3);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.pma-menu__opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    border-radius: var(--is-radius-sm);
    cursor: pointer;
    color: var(--is-fg-1);
    font-family: var(--is-font-sans);
}
.pma-menu__opt:hover,
.pma-menu__opt:focus-visible {
    background: var(--is-bg-surface-3);
    outline: none;
}
.pma-menu__opt.is-focused { background: var(--is-bg-surface-3); }

.pma-menu__opt-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--is-radius-sm);
    background: var(--is-brand-blue-100);
    color: var(--is-brand-blue-700);
    display: inline-grid;
    place-items: center;
    font-size: 12px;
}

.pma-menu__opt-text {
    flex: 1;
    min-width: 0;
}
.pma-menu__opt-text b {
    display: block;
    font: 600 12.5px var(--is-font-sans);
    color: var(--is-fg-1);
}
.pma-menu__opt-text small {
    display: block;
    margin-top: 1px;
    font: 500 11px var(--is-font-sans);
    color: var(--is-fg-3);
}

/* Disabled option — dimmed, no hover, reason in amber, lock/ban on right */
.pma-menu__opt.is-dis {
    opacity: .42;
    cursor: not-allowed;
}
.pma-menu__opt.is-dis:hover,
.pma-menu__opt.is-dis:focus-visible,
.pma-menu__opt.is-dis.is-focused {
    background: transparent;
}
.pma-menu__opt.is-dis .pma-menu__opt-text small {
    color: #8a6500;
    font-weight: 600;
}
.pma-menu__opt-lock {
    margin-left: auto;
    color: var(--is-fg-muted);
    font-size: 10.5px;
    align-self: center;
    flex-shrink: 0;
}

/* ─── Responsive ─────────────────────────────────────────────
   Tablet keeps inline layout (flex-wrap handles overflow).
   Mobile (≤600px) per MobileLayoutStandards §6:
   - selection bar: full-width, stacked count/label/cta column.
   - popover: capped at calc(100vw - 16px), anchored under trigger.
*/
@media (max-width: 600px) {
    .pma-selbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }
    .pma-selbar__left {
        justify-content: flex-start;
    }
    .pma-selbar__right { width: 100%; }
    .pma-trigger-wrap { flex: 1; }
    .pma-trigger {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        min-height: 40px;
    }
    .pma-menu {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        right: auto;
        left: 0;
        /* Tighter reserve on mobile — the page header collapses to
           a smaller footprint so the popover gets a bit more room. */
        max-height: calc(100vh - 240px);
    }
    .pma-menu__opt { min-height: 44px; }
}
