/* Case workflow navigator and page transitions (static/js/case_nav.js). */

.mcn {
    container-type: inline-size; /* the label rule below measures the bar in app-font rem */
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--mira-border);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    font-family: inherit;
}
.mcn-inner {
    max-width: 1800px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
}
.mcn button { font-family: inherit; }
.mcn.is-busy { cursor: progress; }
.mcn.is-busy button { pointer-events: none; opacity: 0.6; }

/* Case List */
.mcn-home {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--mira-gray-300);
    border-radius: 6px;
    background: #fff;
    color: var(--mira-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mcn-home:hover { background: var(--mira-gray-100); border-color: var(--mira-gray-400); }

/* Steps */
.mcn-steps {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mcn-step { flex: none; }
.mcn-link {
    flex: 1 1 24px;
    max-width: 56px;
    min-width: 10px;
    height: 2px;
    background: var(--mira-gray-300);
    margin: 0 4px;
}
.mcn-step-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--mira-text-subtle);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.mcn-step-btn:hover:not(:disabled) { background: var(--mira-gray-100); color: var(--mira-text); }
.mcn-step-btn:focus-visible,
.mcn-home:focus-visible,
.mcn-btn:focus-visible { outline: 2px solid var(--mira-primary); outline-offset: 2px; }
.mcn-dot {
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid var(--mira-gray-300);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: #fff;
}
.mcn-step.is-done .mcn-dot { background: var(--mira-success); border-color: var(--mira-success); }
.mcn-step.is-done .mcn-step-btn { color: var(--mira-success); }
.mcn-step.is-current .mcn-dot {
    background: var(--mira-primary);
    border-color: var(--mira-primary);
    box-shadow: 0 0 0 3px rgba(54, 94, 130, 0.18);
}
.mcn-step.is-current .mcn-dot:empty::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}
.mcn-step.is-current .mcn-step-btn { color: var(--mira-ink); font-weight: 700; cursor: default; }
.mcn-step.is-locked .mcn-step-btn { color: var(--mira-gray-500); cursor: not-allowed; }
.mcn-step.is-locked .mcn-dot { border-style: dashed; color: var(--mira-gray-500); }
.mcn-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Back / Next */
.mcn-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.mcn-actions[hidden] { display: none; }
.mcn-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--mira-gray-300);
    border-radius: 6px;
    background: #fff;
    color: var(--mira-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mcn-btn:hover { background: var(--mira-gray-100); border-color: var(--mira-gray-400); }
.mcn-btn.is-primary { background: var(--mira-primary); border-color: var(--mira-primary); color: #fff; }
.mcn-btn.is-primary:hover { background: var(--mira-primary-hover); border-color: var(--mira-primary-hover); }
/* The next step while its gate is closed (the Final Report before its Final Discussion). */
.mcn-btn[disabled],
.mcn-btn[disabled]:hover { background: var(--mira-gray-100); border-color: var(--mira-gray-300); color: var(--mira-gray-500); cursor: not-allowed; }
.mcn-btn-short { display: none; }

/* Narrow bars: labels give way to the marks, the open step keeps its name. Every label plus Case List and
   both step buttons needs about 70 app-font rem in English (less in zh-TW): 1120px at 100%, so a 1512px laptop
   keeps them beside expanded navigation. Container rem follows the app font; a media query rem would not. */
@container (width < 71rem) {
    .mcn-step:not(.is-current) .mcn-label { display: none; }
    .mcn-link { max-width: 28px; }
}
@media (max-width: 900px) {
    .mcn-btn-label, .mcn-home-label { display: none; }
    .mcn-btn-short { display: inline; }
    .mcn-inner { gap: 8px; padding: 8px 12px; }
}
@media (max-width: 560px) {
    .mcn-inner { flex-wrap: wrap; }
    .mcn-steps { order: 3; flex-basis: 100%; }
    .mcn-actions { margin-left: auto; }
}

/* Page transitions: one entrance, one exit, on every page. */
.mcn-entering { animation: mcnEnter 0.26s ease-out both; }
@keyframes mcnEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.mcn-leaving {
    opacity: 0 !important;
    transform: translateY(-4px);
    transition: opacity 0.16s ease-in, transform 0.16s ease-in;
    pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
    .mcn-entering { animation: none; }
    .mcn-leaving { transition: none; transform: none; }
}

@media print {
    .mcn { display: none !important; }
}
/* The Board has one report action in its case header. */
.mcn [hidden] { display: none !important; }
