/*
 * help_tags.css — styling for the shared UX help layer.
 *
 * Loaded globally via admin/base.html. Targets only the dedicated
 * help_tags classes so it can't collide with existing admin styles.
 */


/* ── {% help_tip %} info icon ────────────────────────────────────── */
.help-tip-icon {
    display: inline-block;
    margin-left: 4px;
    color: #5a8aa8;
    font-size: 12px;
    line-height: 1;
    cursor: help;
    transition: color 0.15s;
    vertical-align: middle;
    /* Defensive resets so the icon doesn't pick up styling from
       surrounding admin chrome (sortable-column links, header spans). */
    text-decoration: none !important;
    text-transform: none;
    font-weight: 400;
    border: 0;
}
.help-tip-icon:hover,
.help-tip-icon:focus {
    color: #2e6a8c;
    text-decoration: none !important;
}


/* ── CSS-only field/column tooltip ─────────────────────────────────
   ``_label_with_tip`` (utils/admin_glossary.py) wraps the icon in a
   ``.help-tip-host`` with a sibling ``.help-tip-popup`` that becomes
   visible on hover/focus. Pure CSS — no Bootstrap dependency. */

/* Keep label text + icon on the same line even when the column is
   narrow and the cell uses text-align: center. Without this, the
   icon wraps below the label. */
.help-label-wrap {
    display: inline-block !important;
    white-space: nowrap !important;
    vertical-align: middle;
}

.help-tip-host {
    position: relative;
    display: inline-block;
    margin-left: 3px;
    vertical-align: middle;
    line-height: 1;
    cursor: help;
    outline: none;
    /* Defeat sortable-column link styling on the icon inside. */
    text-decoration: none !important;
    border: 0 !important;
}
.help-tip-host .help-tip-icon { margin-left: 0; }

.help-tip-host .help-tip-popup {
    position: absolute;
    z-index: 2000;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    min-width: 200px;
    max-width: 300px;
    width: max-content;
    padding: 8px 10px;
    background: #2a3340;
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    /* Wrap properly — fights any inherited white-space: nowrap from
       a sortable-column link container. */
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: break-word;
    /* Hidden by default; revealed on hover/focus. */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
    /* Defensive resets — column-header context may bring in font-weight,
       text-transform, letter-spacing inherited from the <th>. */
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}
.help-tip-host:hover .help-tip-popup,
.help-tip-host:focus .help-tip-popup,
.help-tip-host:focus-within .help-tip-popup,
.help-tip-host .help-tip-popup:hover {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}
.help-tip-host .help-tip-popup::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-style: solid;
}
.help-tip-host .help-tip-popup::before {
    top: -7px;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #2a3340 transparent;
}

/* Column-header context — icon sits inside <a> for sortable cols or
   <span> for non-sortable. Without these, the icon inherits the
   header's underline / uppercase / sort-indicator behaviour. */
th .help-tip-icon,
.sortable .help-tip-icon,
.column-header .help-tip-icon {
    margin-left: 4px;
    font-size: 11px;
    vertical-align: middle;
}
th a .help-tip-icon,
th a:hover .help-tip-icon,
th a:focus .help-tip-icon {
    color: #5a8aa8;
    text-decoration: none !important;
    border-bottom: 0 !important;
}
th a:hover .help-tip-icon {
    color: #2e6a8c;
}

/* Bootstrap tooltip — widen and align so long help strings don't wrap
   into a confusingly narrow column of 1–2 word lines. !important is
   used selectively to defeat the admin theme's bootstrap.min.css which
   loads earlier but still wins on simple-selector ties in some builds. */
.tooltip { z-index: 2000 !important; }
.tooltip .tooltip-inner,
div.tooltip .tooltip-inner,
.tooltip-inner {
    max-width: 320px !important;
    min-width: 180px !important;
    width: auto !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    text-align: left !important;
    background-color: #2a3340 !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}
.bs-tooltip-top .arrow::before,
.bs-tooltip-auto[x-placement^="top"] .arrow::before { border-top-color: #2a3340 !important; }
.bs-tooltip-bottom .arrow::before,
.bs-tooltip-auto[x-placement^="bottom"] .arrow::before { border-bottom-color: #2a3340 !important; }
.bs-tooltip-left .arrow::before,
.bs-tooltip-auto[x-placement^="left"] .arrow::before { border-left-color: #2a3340 !important; }
.bs-tooltip-right .arrow::before,
.bs-tooltip-auto[x-placement^="right"] .arrow::before { border-right-color: #2a3340 !important; }


/* ── {% glossary_term %} dotted-underline term ───────────────────── */
.glossary-term {
    border-bottom: 1px dotted #6c757d;
    cursor: help;
    text-decoration: none;
    color: inherit;
}
.glossary-term:hover {
    border-bottom-color: #2e6a8c;
    color: #2e6a8c;
}


/* ── {% help_banner %} dismissable alert card ───────────────────── */
.help-banner {
    border-radius: 6px;
    padding: 14px 18px;
    margin: 0 0 18px 0;
    border-width: 1px;
    border-style: solid;
    font-size: 13.5px;
    line-height: 1.55;
}
.help-banner .help-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
}
.help-banner .help-banner-header strong { flex: 1; }
.help-banner .help-banner-header i { font-size: 16px; }
.help-banner .help-banner-body { color: #333; }
.help-banner .help-banner-body p:last-child { margin-bottom: 0; }
.help-banner .help-banner-body ul,
.help-banner .help-banner-body ol {
    margin: 6px 0 6px 22px;
    padding: 0;
}
.help-banner .help-banner-close {
    background: transparent;
    border: 0;
    font-size: 22px;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0 6px;
    margin-left: 10px;
    /* Ensure the click target wins over any sibling decorations */
    position: relative;
    z-index: 2;
    /* Reset Bootstrap .btn / .close base styles in case they leak in */
    text-shadow: none;
    font-weight: 700;
}
.help-banner .help-banner-close:hover,
.help-banner .help-banner-close:focus {
    opacity: 1;
    outline: none;
}

/* Variant colors — explicit so they don't depend on which Bootstrap
   build is loaded on a given admin page. */
.help-banner.alert-info {
    background: #eaf4fb;
    border-color: #b8d9ec;
    color: #1c4e6f;
}
.help-banner.alert-warning {
    background: #fdf4e0;
    border-color: #f0d7a3;
    color: #7a5215;
}
.help-banner.alert-danger {
    background: #fbeaea;
    border-color: #ecbbbb;
    color: #6f1c1c;
}
.help-banner.alert-success {
    background: #e9f6ec;
    border-color: #b9dfc1;
    color: #205f30;
}


/* ── Status pill (admin/_status_badge.html) ─────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 12px;
    white-space: nowrap;
    border: 1px solid transparent;
    text-transform: none;
    letter-spacing: 0.2px;
}
.status-pill i { font-size: 11px; line-height: 1; }

.status-pill--secondary { background: #eceff2; color: #4a5560; border-color: #d9dee3; }
.status-pill--info      { background: #e3f1fa; color: #1c5a82; border-color: #b8d9ec; }
.status-pill--primary   { background: #e1ecf5; color: #2e5c75; border-color: #c0d4e3; }
.status-pill--success   { background: #e3f4e7; color: #1e6b34; border-color: #b8dfc1; }
.status-pill--warning   { background: #fbecc8; color: #7a5215; border-color: #f0d7a3; }
.status-pill--danger    { background: #fbe2e2; color: #842323; border-color: #efbcbc; }
.status-pill--dark      { background: #3c4248; color: #fff;    border-color: #2b3035; }


/* ── Contract wizard progress bar + step status icons ───────────── */

.wizard_progress_bar {
    margin: 0 0 14px 0;
    padding: 8px 12px 10px;
    user-select: none;
    background: #fafbfd;
    border: 1px solid #e6e9ed;
    border-radius: 6px;
}
.wizard_progress_topline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #2a3340;
    flex-wrap: wrap;
}
.wizard_progress_topline strong { color: #1c2733; }
.wizard_progress_help {
    color: #6a737d;
    font-size: 11.5px;
    margin-left: 8px;
    cursor: help;
    white-space: nowrap;
}
.wizard_progress_help i { font-size: 11px; margin-right: 2px; }
.wizard_progress_help:hover { color: #2e6a8c; }

.wizard_progress_percent {
    font-size: 13px;
    font-weight: 600;
    color: #2e6a8c;
}
.wizard_progress_percent.is-done {
    color: #1e8d4f;
}

.wizard_progress_track {
    height: 8px;
    border-radius: 4px;
    background: #e6eaef;
    overflow: hidden;
    position: relative;
}
.wizard_progress_fill {
    height: 100%;
    background: linear-gradient(90deg, #4f8ec0, #2e6a8c);
    border-radius: 4px;
    transition: width 0.35s ease;
}
.wizard_progress_fill--done {
    background: linear-gradient(90deg, #4caf72, #1e8d4f);
}

/* Status indicator pinned to the step circle. Uses a small badge ring
   over the existing wizard step number so the established layout from
   `.wizard_layout_list ul li span` keeps working untouched. */
.wizard_step .wizard_step_num {
    position: relative;
}
.wizard_step .wizard_step_icon {
    position: absolute;
    top: 50%;
    right: 0%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid currentColor;
    color: #b3bac1;
    font-size: 9px;
    line-height: 12px;
    text-align: center;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    font-style: normal;
}
.wizard_step.wizard_step--complete .wizard_step_icon { color: #1e8d4f; }
.wizard_step.wizard_step--complete .wizard_step_icon::before {
    content: "\2713"; /* ✓ */
    font-weight: 700;
}
.wizard_step.wizard_step--partial .wizard_step_icon { color: #c97a14; }
.wizard_step.wizard_step--partial .wizard_step_icon::before {
    content: "!";
    font-weight: 700;
}
.wizard_step.wizard_step--pending .wizard_step_icon { color: #b3bac1; }
.wizard_step.wizard_step--pending .wizard_step_icon::before {
    content: "";
}
.wizard_step.is_current .wizard_step_icon { color: #2e6a8c; border-color: #2e6a8c; }
.wizard_step.is_current .wizard_step_icon::before {
    content: "\270E"; /* ✎ pencil */
    font-size: 9px;
}

/* Hover popover content can be a touch wider than Bootstrap's default
   for the per-step summary text. */
.popover { max-width: 320px; font-size: 12.5px; }

/* "What counts?" — pure CSS hover popup. No JS dependency so it never
   silently fails when Bootstrap's popover plugin isn't initialized. */
.wizard_progress_help {
    position: relative;
    display: inline-block;
    color: #5a8aa8;
    font-size: 11.5px;
    margin-left: 8px;
    cursor: help;
    border-bottom: 1px dotted #b3bac1;
    padding-bottom: 1px;
    line-height: 1.4;
    outline: none;
    user-select: none;
}
.wizard_progress_help:hover,
.wizard_progress_help:focus {
    color: #2e6a8c;
    border-bottom-color: #2e6a8c;
}
.wizard_progress_help i { font-size: 11px; margin-right: 2px; }

.wizard_progress_help .wp-popup {
    position: absolute;
    z-index: 1080;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    max-width: 360px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d6dde2;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    font-size: 12.5px;
    color: #2a3340;
    line-height: 1.5;
    cursor: default;
    /* Hidden by default; revealed on hover / focus / focus-within. */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
    pointer-events: none;
    text-align: left;
}
.wizard_progress_help:hover .wp-popup,
.wizard_progress_help:focus .wp-popup,
.wizard_progress_help:focus-within .wp-popup,
.wizard_progress_help .wp-popup:hover {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}

/* Little arrow above the popup pointing back at the link. */
.wizard_progress_help .wp-popup::before,
.wizard_progress_help .wp-popup::after {
    content: "";
    position: absolute;
    left: 14px;
    width: 0;
    height: 0;
    border-style: solid;
}
.wizard_progress_help .wp-popup::before {
    top: -7px;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #d6dde2 transparent;
}
.wizard_progress_help .wp-popup::after {
    top: -6px;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #fff transparent;
}

.wp-popup-title {
    display: block;
    font-weight: 600;
    color: #1c2733;
    font-size: 13px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eef0f3;
}
.wp-popup-section {
    display: block;
    margin-top: 8px;
}
.wp-popup-section:first-of-type { margin-top: 0; }
.wp-popup-section strong {
    display: block;
    color: #1c2733;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.wp-popup-list {
    display: block;
    padding-left: 4px;
}
.wp-popup-list > span {
    display: block;
    padding: 1px 0;
    color: #2a3340;
}
