/* ──────────────────────────────────────────────────────────
   Namespace: ckc-  (Create Kiosk Codes V2 — mass action popup)
   Source:    HR101BL/Pages/employeeslist-v2/CreateKioskCodesV2.razor
              HR101BL/Pages/employeeslist-v2/CreateKioskCodesV2Base.cs

   Scope:
   - Standalone modal chrome (header + body + footer) for the
     "Create Kiosk Codes" mass action triggered from /employeeslist-v2.
   - Self-contained — does NOT depend on redesign-popup-shell.css,
     redesign-employeeslist.css or any V1 popup CSS. Re-implements
     the mockup's `ma-modal__*` / `ma-warn--*` / `ma-btn--*` atoms
     under the `ckc-*` prefix so this popup ships isolated.
   - Desktop-only by request — no @media mobile/tablet rules.
   - Tokens are sourced from the globally-loaded design system
     (--is-brand-blue, --is-fg-1, etc.). Fallback values inlined
     in case insync-tokens.css is not present.
   ────────────────────────────────────────────────────────── */

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

.ckc-pop {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    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);
}

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

.ckc-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-purple, #3a0647);
}

.ckc-pop__icon--success {
    background: var(--is-success, #26b050);
}

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

.ckc-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;
}

.ckc-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);
}

.ckc-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;
}

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

/* ── Context bar ─────────────────────────────────────────── */
.ckc-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;
}

.ckc-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);
}

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

.ckc-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);
}

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

.ckc-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;
}

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

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

/* ── Stat cards row ──────────────────────────────────────── */
.ckc-stats {
    display: flex;
    gap: 12px;
}

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

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

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

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

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

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

.ckc-stat--success .ckc-stat__label {
    color: #1a6e35;
}

/* ── Warning / info callouts ─────────────────────────────── */
.ckc-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;
}

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

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

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

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

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

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

/* ── Footer ──────────────────────────────────────────────── */
.ckc-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);
}

.ckc-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;
}

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

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

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

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

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

.ckc-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Result state ─────────────────────────────────────────── */
/* Per MD §2d: Result panel is wider than Intent (620 vs 560) to fit
   the code table at a reasonable density. */
.ckc-pop--result {
    width: 620px;
}

.ckc-stat--danger {
    background: var(--is-danger-bg, #fde7e7);
    border-color: #f3b6b6;
}

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

.ckc-stat--danger .ckc-stat__label {
    color: #872020;
}

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

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

/* ── Result panel — code table ────────────────────────────── */
.ckc-table-wrap {
    border: 1px solid var(--is-border-1, #e6e9ef);
    border-radius: var(--is-radius-sm, 6px);
    overflow: hidden;
    max-height: 222px;
    overflow-y: auto;
}

.ckc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ckc-table thead th {
    font: 700 10.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px;
    background: var(--is-bg-surface-3, #f8f9fa);
    text-align: left;
    border-bottom: 1px solid var(--is-border-1, #e6e9ef);
    position: sticky;
    top: 0;
    z-index: 1;
}

.ckc-table thead th.ckc-table__col-code {
    text-align: right;
}

.ckc-table tbody td {
    padding: 7px 10px;
    font: 500 12.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-1, #1a1f2e);
    border-bottom: 1px solid var(--is-border-1, #e6e9ef);
}

.ckc-table tbody tr:last-child td {
    border-bottom: 0;
}

.ckc-table__cell-muted {
    color: var(--is-fg-3, #7a8395) !important;
}

.ckc-table__cell-code {
    text-align: right;
    font-family: var(--is-font-mono, 'JetBrains Mono', ui-monospace, monospace) !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums;
}

.ckc-table__overflow {
    text-align: center;
    font: 500 11.5px var(--is-font-sans, 'Plus Jakarta Sans', sans-serif);
    color: var(--is-fg-3, #7a8395);
    background: var(--is-bg-surface-3, #f8f9fa);
}

/* ── Progress state ───────────────────────────────────────────
   Mirror of Edit Office V2 / Edit Department V2 Progress atoms.
   Replaces the SfSpinner overlay with a full-shell "Allocating Kiosk
   Codes…" panel: 64×64 brand-blue tile + headline + indeterminate
   sweeping bar + info callout + shield-meta footer.
   ─────────────────────────────────────────────────────────── */

/* Narrow modal width modifier per MD §2c (Progress = 560px). */
.ckc-pop--narrow { width: 560px; }

/* Centered body for Progress anchor block. */
.ckc-pop__body--centered {
    align-items: center;
    text-align: center;
}

/* Danger callout (used by Progress error / Result partial-failure if added). */
.ckc-warn--danger {
    background: var(--is-danger-bg, #fde8e8);
    border-color: #f1b5b5;
    color: #8c1a1a;
}

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

/* 64×64 anchor tile — brand-blue glyph on brand-blue-100 surface. */
.ckc-tile-lg {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    background: var(--is-brand-blue-100, #e6f4fb);
    color: var(--is-brand-blue, #0494da);
    font-size: 26px;
    margin-bottom: 6px;
}

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

.ckc-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 — 4px tall pill, blue gradient sweeps L→R
   on 1.1s loop. Not a percentage bar (per MD §2c — "we'd be lying"). */
.ckc-sweep {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--is-brand-blue-100, #e6f4fb);
    overflow: hidden;
    margin: 0 0 14px;
}

.ckc-sweep::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg,
        rgba(4, 148, 218, 0) 0%,
        var(--is-brand-blue, #0494da) 50%,
        rgba(4, 148, 218, 0) 100%);
    animation: ckc-sweep 1.1s linear infinite;
}

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

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

.ckc-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);
}

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