/* Contextual help drawer (Layout/HelpDrawer.razor) + field highlight. Global because the drawer pushes the page body,
   sits above Radzen dialogs (non-modal: the user keeps working in the dialog) and pulses inputs outside the component.
   Colours come only from the --hr-* tokens of app.css (light + dark theme); soft tints are color-mix() of a token. */
:root {
    --hh-help-width: 440px;
    --hh-help-top: 56px;
    --hh-help-accent: var(--hr-primary);
    --hh-help-accent-soft: color-mix(in srgb, var(--hr-primary) 12%, transparent);
    --hh-help-accent-strong: color-mix(in srgb, var(--hr-primary) 24%, transparent);
    --hh-help-muted: var(--hr-text-secondary);
    --hh-help-border: var(--hr-border);
}

.hh-help-drawer {
    position: fixed;
    top: var(--hh-help-top);
    right: 0;
    bottom: 0;
    width: var(--hh-help-width);
    max-width: 100vw;
    z-index: calc(var(--rz-dialog-zindex, 1001) + 4);   /* above .rz-dialog-wrapper / mask so it stays usable while a dialog is open */
    background: var(--hr-surface);
    color: var(--hr-text);
    border-left: 1px solid var(--hh-help-border);
    box-shadow: var(--hr-shadow-lg);
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
}

.hh-help-drawer__resize {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
}

.hh-help-drawer__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem 0.4rem 1rem;
    border-bottom: 1px solid var(--hh-help-border);
}

.hh-help-drawer__icon { color: var(--hh-help-accent); }

.hh-help-drawer__title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 1rem;
    color: var(--hh-help-accent);
}

.hh-help-drawer__kind {
    font-size: 0.7rem;
    color: var(--hh-help-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hh-help-drawer__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.hh-help-drawer__body .rz-tabview-panels {
    padding: 0.75rem 1rem 1.25rem;
}

.hh-help-drawer h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hh-help-muted);
    margin: 1rem 0 0.4rem;
}

.hh-help-drawer h4:first-child { margin-top: 0; }
.hh-help-drawer p { margin: 0 0 0.5rem; line-height: 1.45; }
.hh-help-drawer ul { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.hh-help-drawer li { margin-bottom: 0.2rem; line-height: 1.4; }
.hh-help-drawer a { color: var(--hh-help-accent); }
.hh-help-muted { color: var(--hh-help-muted); }
.hh-help-footer { margin-top: 1rem; font-size: 0.72rem; color: var(--hh-help-muted); }

/* Organization note (Settings > Organization > Help Content). */
.hh-help-orgnote {
    border-left: 3px solid var(--hr-warning);
    background: var(--hr-surface-2);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

/* Rights badges: success = the user holds the right, neutral = not. */
.hh-help-roles { display: flex; flex-direction: column; gap: 0.35rem; }
.hh-help-role { display: flex; gap: 0.5rem; align-items: baseline; }
.hh-help-badge {
    display: inline-block;
    flex: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}
.hh-help-badge--on { background: var(--hr-success); color: var(--hr-on-status); }
.hh-help-badge--off { background: var(--hr-surface-2); color: var(--hh-help-muted); border: 1px solid var(--hh-help-border); }
.hh-help-role--off .hh-help-role__text { color: var(--hh-help-muted); }

/* Document flow strip: upstream -> this page -> downstream. */
.hh-help-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 0.35rem; align-items: center; margin-bottom: 0.5rem; }
.hh-help-flow__col { display: flex; flex-direction: column; gap: 0.25rem; }
.hh-help-flow__node {
    border: 1px solid var(--hh-help-border);
    border-radius: 6px;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.25;
    background: var(--hr-surface-2);
}
.hh-help-flow__node a { text-decoration: none; }
.hh-help-flow__node a:hover { text-decoration: underline; }
.hh-help-flow__self {
    border: 2px solid var(--hh-help-accent);
    background: var(--hh-help-accent-soft);
    border-radius: 6px;
    padding: 0.4rem;
    font-weight: 600;
    text-align: center;
    font-size: 0.78rem;
}
.hh-help-flow__arrow { color: var(--hh-help-accent); }
.hh-help-arrow-svg { display: block; color: var(--hh-help-accent); }

/* Status stepper. */
.hh-help-stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0; margin: 0.25rem 0 0.5rem; }
.hh-help-step {
    border: 1px solid var(--hh-help-accent-strong);
    background: var(--hh-help-accent-soft);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: default;
}
.hh-help-step--current { background: var(--hh-help-accent); color: var(--hr-on-primary); border-color: var(--hh-help-accent); box-shadow: 0 0 0 3px var(--hh-help-accent-strong); }
.hh-help-step--terminal { border-style: dashed; }
.hh-help-arrow { display: inline-flex; flex-direction: column; align-items: center; padding: 0 0.15rem; min-width: 3.2rem; cursor: help; }
.hh-help-arrow__label { font-size: 0.62rem; color: var(--hh-help-accent); font-weight: 600; text-align: center; line-height: 1.1; }
.hh-help-gap { width: 1rem; }
.hh-help-transitions { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.hh-help-transitions td { border-top: 1px solid var(--hh-help-border); padding: 0.35rem 0.25rem; vertical-align: top; }
.hh-help-transitions td:first-child { white-space: nowrap; font-weight: 600; }

/* Fields table. */
.hh-help-fields { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.hh-help-fields th { text-align: left; font-size: 0.7rem; color: var(--hh-help-muted); text-transform: uppercase; padding: 0.25rem; border-bottom: 1px solid var(--hh-help-border); }
.hh-help-fields td { padding: 0.35rem 0.25rem; vertical-align: top; }
.hh-help-fields tr.hh-help-field { cursor: pointer; }
.hh-help-fields tr.hh-help-field td { border-top: 1px solid var(--hh-help-border); }
.hh-help-fields tr.hh-help-field:hover td, .hh-help-fields tr.hh-help-field:hover + tr td { background: var(--hr-hover); }
.hh-help-fields tr.hh-help-field--active td, .hh-help-fields tr.hh-help-field--active + tr td { background: var(--hh-help-accent-soft); }
.hh-help-fields td.hh-help-field__name { font-weight: 600; width: 26%; }
.hh-help-fields .hh-help-field__section { font-weight: 400; }
.hh-help-fields .hh-help-validation { color: color-mix(in srgb, var(--hr-warning) 55%, var(--hr-text)); margin: 0; padding-left: 1rem; }
.hh-help-section-chip { display: inline-flex; gap: 0.25rem; align-items: center; background: var(--hh-help-accent-soft); color: var(--hh-help-accent); border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.72rem; font-weight: 600; }
.hh-help-section-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; font-size: 0.9rem; line-height: 1; }

/* Dependencies & effects. */
.hh-help-effects { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.hh-help-effects td { border-top: 1px solid var(--hh-help-border); padding: 0.3rem 0.25rem; vertical-align: top; }
.hh-help-effects td:first-child { width: 7rem; }
.hh-help-effects tr.hh-help-effects__action td { background: var(--hr-surface-2); font-weight: 600; border-top: 2px solid var(--hh-help-border); }

/* Field highlight (help.js highlightField): 2-second pulse in the accent colour. */
@keyframes hhHelpPulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hr-primary) 75%, transparent); }
    50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--hr-primary) 25%, transparent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.hh-help-pulse {
    animation: hhHelpPulse 0.7s ease-out 3;
    outline: 2px solid var(--hh-help-accent) !important;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Wide screens: the page body (and centred dialogs) make room for the drawer so it never hides the form it explains. */
@media (min-width: 992px) {
    body.hh-help-open .rz-body { margin-right: var(--hh-help-width); }
    body.hh-help-open .rz-dialog-wrapper { padding-right: var(--hh-help-width); }
}

/* Phone width: full-width overlay. */
@media (max-width: 767px) {
    .hh-help-drawer { width: 100vw; left: 0; border-left: 0; }
    .hh-help-drawer__resize { display: none; }
    .hh-help-flow { grid-template-columns: 1fr; }
    .hh-help-flow__arrow { transform: rotate(90deg); justify-self: center; }
}

/* Four tabs in 440 px: compact labels so "Dependencies & effects" fits. */
.hh-help-drawer .rz-tabview-nav { flex-wrap: nowrap; }
.hh-help-drawer .rz-tabview-nav li > button,
.hh-help-drawer .rz-tabview-nav li > a { padding: 0.6rem 0.55rem; font-size: 0.72rem; white-space: nowrap; }
.hh-help-fields-btn .rz-button-icon-left { font-size: 1.1rem; }

/* Help search (above the tabs) and results. */
.hh-help-search { position: relative; display: flex; align-items: center; padding: 0.5rem 0.75rem 0.5rem 1rem; border-bottom: 1px solid var(--hh-help-border); }
.hh-help-search__icon { position: absolute; left: 1.45rem; font-size: 1.1rem; color: var(--hh-help-muted); pointer-events: none; }
.hh-help-search__input { width: 100%; padding-left: 2rem !important; padding-right: 1.8rem !important; }
.hh-help-search__clear { position: absolute; right: 1.2rem; border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--hh-help-muted); }
.hh-help-results { padding: 0.75rem 1rem 1.25rem; }
.hh-help-hit { display: flex; flex-direction: column; gap: 0.15rem; width: 100%; text-align: left; background: none; border: 1px solid var(--hh-help-border);
    border-radius: 6px; padding: 0.5rem 0.65rem; margin-bottom: 0.45rem; cursor: pointer; font: inherit; color: inherit; }
.hh-help-hit:hover, .hh-help-hit:focus-visible { border-color: var(--hh-help-accent); background: var(--hr-hover); outline: none; }
.hh-help-hit__title { font-weight: 600; }
.hh-help-hit__where { font-size: 0.75rem; color: var(--hh-help-accent); }
.hh-help-hit__snippet { font-size: 0.8rem; color: var(--hh-help-muted); }
.hh-help-guide { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; font-size: 0.85rem; }
.hh-help-guide .rzi { font-size: 1.1rem; color: var(--hh-help-accent); }

/* Per-field tooltip icon (Shared/HelpTip.razor) next to a label. */
.hh-help-tip { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 0.25rem; cursor: help; color: var(--hr-text-secondary); border-radius: 50%; }
.hh-help-tip .rzi { font-size: 16px; }
.hh-help-tip:hover, .hh-help-tip:focus-visible { color: var(--hh-help-accent); outline: none; }

/* Help Content page (Pages/Settings/ORG/HelpContent.razor) coverage marks. */
.hh-cov-yes { color: var(--hr-success); font-weight: 700; }
.hh-cov-no { color: var(--hr-danger); font-weight: 700; }
