/* ──────────────────────────────────────────────────────────
   Namespace: ejr-  (Edit Job Role V2 — mass action popup, NEW)
   Source:    HR101BL/Pages/employeeslist-v2/EditJobRoleV2.razor
              HR101BL/Pages/employeeslist-v2/EditJobRoleV2Base.cs

   Scope:
   - Standalone modal chrome (header + body + footer) for the
     "Edit Job Role" mass action triggered from /employeeslist-v2.
   - Mirrors EditDepartmentV2 (eded-*) atoms with the ejr-* prefix,
     same four-state extensions:
       · Intent  state: role picker + effective-from date + info
                        callouts + Apply CTA
       · No-op   state: success callout, only Close
       · Progress state: icon tile + sweeping bar + shield foot
       · Result  state: header icon flips to green + stat cards
   - Self-contained — does NOT depend on any other CSS.
   - Desktop-only by request — no @media mobile/tablet rules.
   - Header icon tone is ORANGE (--is-brand-orange) per MD spec
     §2a — signals that this is a newer / less-common action; the
     orange NEW chip in the dropdown menu matches.
   - Tokens are sourced from the globally-loaded design system
     (--is-brand-orange, --is-fg-1, etc.). Fallback values inlined
     in case insync-tokens.css is not present.
   ────────────────────────────────────────────────────────── */

/* ── Scrim + popup container ─────────────────────────────── */
.ejr-pop-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 50, 0.45);
    z-index: 1050;
}

.ejr-pop {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 680px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    background: var(--is-bg-surface, #ffffff);
    border: 1px solid var(--is-border-1, #e6e9ef);
    border-radius: var(--is-radius-lg, 14px);
    box-shadow: var(--is-shadow-3, 0 8px 24px rgba(20, 28, 50, 0.10), 0 2px 6px rgba(20, 28, 50, 0.06));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1051;
    font-family: var(--is-font-sans, 'Plus Jakarta Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif);
    color: var(--is-fg-1, #1a1f2e);
}

/* Modal width modifiers (per MD spec §2a–§2d). */
.ejr-pop--narrow { width: 560px; }
.ejr-pop--medium { width: 680px; }

/* ── Header ──────────────────────────────────────────────── */
.ejr-pop__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--is-border-1, #e6e9ef);
}

.ejr-pop__icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--is-radius-sm, 6px);
    display: inline-grid;
    place-items: center;
    font-size: 16px;
    color: #ffffff;
    background: var(--is-brand-orange, #ee7d23);
    transition: background 0.18s;
}

/* Result state flips the header icon tone to success green. */
.ejr-pop__icon--success {
    background: var(--is-success, #26b050);
}

.ejr-pop__titles {
    flex: 1;
    min-width: 0;
}

.ejr-pop__titles h3 {
    font: 700 17px/1.25 var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    margin: 0 0 3px;
    color: var(--is-fg-1, #1a1f2e);
    letter-spacing: -0.005em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ejr-pop__titles p {
    font: 500 12.5px/1.45 var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    margin: 0;
    color: var(--is-fg-3, #7a8395);
}

/* NEW chip — small yellow-on-orange pill next to the title.
   Background = warning yellow, text + border = brand orange.
   Matches the menu-side "NEW" badge so users can connect the
   dots between the dropdown entry and the popup header. */
.ejr-newchip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--is-warning-bg, #fff5d6);
    color: var(--is-brand-orange, #ee7d23);
    border: 1px solid var(--is-brand-orange, #ee7d23);
    font: 700 9.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}

.ejr-newchip i {
    font-size: 8px;
    color: var(--is-brand-orange, #ee7d23);
}

.ejr-pop__close {
    width: 30px;
    height: 30px;
    border-radius: var(--is-radius-sm, 6px);
    border: 0;
    background: transparent;
    color: var(--is-fg-3, #7a8395);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.ejr-pop__close:hover:not(:disabled) {
    background: var(--is-bg-surface-3, #f8f9fa);
    color: var(--is-fg-1, #1a1f2e);
}

.ejr-pop__close:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Context bar ─────────────────────────────────────────── */
.ejr-pop__ctx {
    padding: 12px 20px;
    background: var(--is-brand-blue-100, #e6f4fb);
    border-bottom: 1px solid #cfe4f4;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ejr-pop__ctx-lead {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 600 12.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-brand-blue-700, #066894);
}

.ejr-pop__ctx-lead i {
    font-size: 11px;
}

.ejr-pop__ctx-count {
    background: var(--is-brand-blue, #0494da);
    color: #ffffff;
    padding: 2px 9px;
    border-radius: 999px;
    font: 700 11px var(--is-font-mono, 'JetBrains Mono', ui-monospace, monospace);
}

.ejr-pop__ctx-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.ejr-empchip {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #cfe4f4;
    font: 600 11px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ejr-empchip--more {
    background: var(--is-brand-blue-700, #066894);
    color: #ffffff;
    border-color: var(--is-brand-blue-700, #066894);
}

/* ── Body ────────────────────────────────────────────────── */
.ejr-pop__body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

/* Centered body for Progress + Result anchor blocks. */
.ejr-pop__body--centered {
    align-items: center;
    text-align: center;
}

/* ── Job role / effective-date fields ────────────────────── */
.ejr-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.ejr-field__label {
    font: 600 12px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-2, #4a5468);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ejr-field__label i {
    font-size: 11px;
    color: var(--is-brand-orange, #ee7d23);
}

.ejr-field__hint {
    font: 500 11.5px/1.45 var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
}

/* Syncfusion single-dropdown alignment — matches the canonical V2 pattern
   (36px wrapper + 34px inner input). Required so Syncfusion's popup-anchor
   JS reads the correct field bounding rect and aligns the popup just below
   the trigger. */
.ejr-field .e-input-group {
    border-radius: var(--is-radius-sm, 6px);
}

.ejr-field .e-ddl.e-input-group {
    min-height: 36px;
    height: 36px;
    box-sizing: border-box;
}

.ejr-field .e-ddl.e-input-group input.e-input {
    height: 34px;
    line-height: 34px;
    box-sizing: border-box;
}

/* ── Date picker (modern flat input, matches HTML mockup) ──
   Override Syncfusion's default chrome — no underline, no
   inset shadow, just a 1px border that turns blue on focus,
   matching the .ma-input style from mass-actions.css. The
   trailing calendar icon button is kept (Syncfusion needs it
   to open the popup) but re-skinned to read as a neutral
   affordance instead of a Syncfusion button. */
.ejr-field .e-date-wrapper.ejr-datepicker {
    width: 100% !important;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    border: 1px solid var(--is-border-3, #b9bfca);
    border-radius: var(--is-radius-sm, 6px);
    background: #ffffff;
    padding: 0;
    box-shadow: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}

/* Kill Syncfusion's bottom underline / focus-line that ships
   on most themes — we replace it with the full-border focus
   ring below. */
.ejr-field .e-date-wrapper.ejr-datepicker::before,
.ejr-field .e-date-wrapper.ejr-datepicker::after {
    display: none !important;
    content: none !important;
}

.ejr-field .e-date-wrapper.ejr-datepicker.e-input-focus,
.ejr-field .e-date-wrapper.ejr-datepicker:focus-within {
    border-color: var(--is-brand-blue, #0494da);
    box-shadow: 0 0 0 3px rgba(4, 148, 218, 0.15);
}

.ejr-field .e-date-wrapper.ejr-datepicker input.e-input {
    height: 36px;
    line-height: 36px;
    padding: 0 12px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font: 500 13.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    box-sizing: border-box;
}

/* Calendar trigger button — re-skinned to read as a neutral
   icon affordance: transparent bg, fg-3 icon, square footprint
   on the right edge of the wrapper. */
.ejr-field .e-date-wrapper.ejr-datepicker .e-input-group-icon,
.ejr-field .e-date-wrapper.ejr-datepicker span.e-date-icon {
    background: transparent !important;
    border: 0 !important;
    border-left: 0 !important;
    color: var(--is-fg-3, #7a8395) !important;
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 var(--is-radius-sm, 6px) var(--is-radius-sm, 6px) 0;
}

.ejr-field .e-date-wrapper.ejr-datepicker .e-input-group-icon:hover,
.ejr-field .e-date-wrapper.ejr-datepicker span.e-date-icon:hover {
    background: var(--is-bg-surface-3, #f8f9fa) !important;
    color: var(--is-fg-1, #1a1f2e) !important;
}

.ejr-field .e-date-wrapper.ejr-datepicker .e-input-group-icon::before,
.ejr-field .e-date-wrapper.ejr-datepicker span.e-date-icon::before {
    font-size: 13px;
}

/* SfDropDownList popup — Syncfusion renders this at <body> level, NOT inside
   the modal's DOM tree. We target it globally by combining e-popup.e-popup-open
   .e-ddl with our custom CssClass "ejr-popup" applied on SfDropDownList. The
   6px margin-top is the V2 standard gap so the popup doesn't visually merge
   with the trigger border. */
.e-popup.e-popup-open.e-ddl.ejr-popup {
    border-radius: var(--is-radius-md, 8px);
    box-shadow: 0 10px 28px rgba(8, 12, 36, 0.18);
    border: 1px solid var(--is-border-2, #d1d1d6);
    margin-top: 6px !important;
}

.e-popup.e-popup-open.e-ddl.ejr-popup .e-list-item {
    font: 500 13px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    line-height: 1.3;
    padding: 8px 12px;
}

.e-popup.e-popup-open.e-ddl.ejr-popup .e-list-item.e-hover {
    background: var(--is-bg-surface-3, #f8f9fa);
    color: var(--is-fg-1, #1a1f2e);
}

.e-popup.e-popup-open.e-ddl.ejr-popup .e-list-item.e-active {
    background: var(--is-brand-orange-100, #fdeede);
    color: var(--is-brand-orange-700, #a45007);
}

/* ── Preview block ───────────────────────────────────────── */
/* Used in two flavours:
   - Intent: `Job Role: <from>  →  <to>`  (label · from · arrow · to)
   - Result: `<N> employees · now in <role>`  (count phrase · to)
   Both layouts share the same chrome — flex row, surface-3 bg, soft
   border. */
.ejr-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: var(--is-radius-sm, 6px);
    background: var(--is-bg-surface-3, #f8f9fa);
    border: 1px solid var(--is-border-1, #e6e9ef);
    font: 500 12.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-2, #4a5468);
    flex-wrap: wrap;
}

/* Id-badge-icon prefix on the preview row. Same fg-3 tone as the label so
   they read as a single "Job Role:" lead. */
.ejr-preview__icon {
    color: var(--is-fg-3, #7a8395);
    font-size: 13px;
    flex-shrink: 0;
}

.ejr-preview__label {
    font-weight: 600;
    color: var(--is-fg-3, #7a8395);
    text-transform: none;
    flex-shrink: 0;
}

.ejr-preview__label::after {
    content: ":";
    margin-left: 2px;
}

.ejr-preview__from {
    font-weight: 600;
    color: var(--is-fg-1, #1a1f2e);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.ejr-preview__arrow {
    color: var(--is-fg-3, #7a8395);
    font-size: 11px;
    flex-shrink: 0;
}

.ejr-preview__to {
    font-weight: 700;
    color: var(--is-brand-orange, #ee7d23);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}


/* ── Warning / info callouts ─────────────────────────────── */
.ejr-warn {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--is-radius-sm, 6px);
    font: 500 12.5px/1.5 var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    border: 1px solid;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.ejr-warn i {
    flex-shrink: 0;
    font-size: 13px;
    margin-top: 1px;
}

.ejr-warn b {
    font-weight: 700;
}

.ejr-warn--info {
    background: var(--is-info-bg, #e6f4fb);
    border-color: #b7dcf2;
    color: #08577f;
}

.ejr-warn--info i {
    color: var(--is-info, #0d8fd9);
}

.ejr-warn--success {
    background: var(--is-success-bg, #e6f7ec);
    border-color: #b6e0c1;
    color: #1a6e35;
}

.ejr-warn--success i {
    color: var(--is-success, #26b050);
}

.ejr-warn--warning {
    background: var(--is-warning-bg, #fff5d6);
    border-color: #f1d684;
    color: #7a5800;
}

.ejr-warn--warning i {
    color: var(--is-warning, #e6a700);
}

.ejr-warn--danger {
    background: var(--is-danger-bg, #fde8e8);
    border-color: #f1b5b5;
    color: #8c1a1a;
}

.ejr-warn--danger i {
    color: var(--is-danger, #d93131);
}

/* ── Progress anchor — large icon tile (64×64), orange tone ── */
.ejr-tile-lg {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    background: var(--is-brand-orange-100, #fdeede);
    color: var(--is-brand-orange, #ee7d23);
    font-size: 26px;
    margin-bottom: 6px;
}

.ejr-progress__headline {
    font: 700 16px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    margin: 0;
}

.ejr-progress__subhead {
    font: 500 12.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
    margin: 4px 0 14px;
}

/* ── Indeterminate sweeping bar (Progress state), orange gradient ── */
.ejr-sweep {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--is-brand-orange-100, #fdeede);
    overflow: hidden;
    margin: 0 0 14px;
}

.ejr-sweep::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg,
        rgba(238, 125, 35, 0) 0%,
        var(--is-brand-orange, #ee7d23) 50%,
        rgba(238, 125, 35, 0) 100%);
    animation: ejr-sweep 1.1s linear infinite;
}

@keyframes ejr-sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* ── Stat cards (Result state) ───────────────────────────── */
.ejr-stats {
    display: flex;
    gap: 12px;
    width: 100%;
}

.ejr-stat {
    flex: 1;
    padding: 14px 16px;
    border-radius: var(--is-radius-sm, 6px);
    border: 1px solid var(--is-border-1, #e6e9ef);
    background: var(--is-bg-surface-3, #f8f9fa);
    text-align: left;
}

.ejr-stat--success {
    background: var(--is-success-bg, #e6f7ec);
    border-color: #b6e0c1;
}

.ejr-stat--danger {
    background: var(--is-danger-bg, #fde8e8);
    border-color: #f1b5b5;
}

.ejr-stat__num {
    font: 800 24px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    line-height: 1;
}

.ejr-stat--success .ejr-stat__num {
    color: var(--is-success, #26b050);
}

.ejr-stat--muted .ejr-stat__num {
    color: var(--is-fg-3, #7a8395);
}

.ejr-stat--danger .ejr-stat__num {
    color: var(--is-danger, #d93131);
}

.ejr-stat__label {
    font: 500 11.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
    margin-top: 4px;
}

.ejr-stat--success .ejr-stat__label { color: #1a6e35; }
.ejr-stat--danger .ejr-stat__label  { color: #8c1a1a; }

/* ── Footer ──────────────────────────────────────────────── */
.ejr-pop__foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--is-border-1, #e6e9ef);
    background: var(--is-bg-surface, #ffffff);
}

/* Progress footer pushes the shield meta to the left, button to the right. */
.ejr-pop__foot--spread {
    justify-content: space-between;
}

.ejr-foot-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 500 11.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
}

.ejr-foot-meta i {
    color: var(--is-info, #0d8fd9);
    font-size: 12px;
}

.ejr-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--is-radius-sm, 6px);
    border: 1px solid transparent;
    font: 600 13px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.ejr-btn i {
    font-size: 11px;
}

.ejr-btn--primary {
    background: var(--is-brand-blue, #0494da);
    color: #ffffff;
    border-color: var(--is-brand-blue, #0494da);
}

.ejr-btn--primary:hover:not(:disabled) {
    background: var(--is-brand-blue-700, #066894);
    border-color: var(--is-brand-blue-700, #066894);
}

.ejr-btn--ghost {
    background: #ffffff;
    color: var(--is-fg-2, #4a5468);
    border-color: var(--is-border-3, #b9bfca);
}

.ejr-btn--ghost:hover:not(:disabled) {
    background: var(--is-bg-surface-3, #f8f9fa);
    color: var(--is-fg-1, #1a1f2e);
}

.ejr-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
