/*
 * «راهنمای جست‌وجو و فیلترها» — تسک ۱۴۰۵/۰۷/۲۸/۰۱، بخش دوم
 *
 * A plain yellow filter, inside the page's heading before its text — on its
 * first line, to its right in this right-to-left panel. Whatever follows the
 * title — a date, a count — comes after it and never moves the icon. Its
 * tooltip keeps its own small size against the heading's 18px rule.
 */

/* The icon on the heading's first line, the title beside it however long it
   is or however a page lays the title out (a page's own flex or grid rules
   apply to the title inside `.fi-header-heading-body`). */
.fi-header-heading.fi-header-heading-with-guide {
    display: flex !important;
    align-items: flex-start;
    column-gap: 0.375rem;
}

.fi-header-heading-with-guide > .fi-header-heading-body {
    min-width: 0;
    flex: 0 1 auto;
}

.agency-guide-trigger {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.125rem;
    border-radius: 0.375rem;
    color: var(--warning-400, #fbbf24);
    cursor: pointer;
}

.agency-guide-trigger svg {
    width: 1.125rem;
    height: 1.125rem;
}

.agency-guide-trigger:hover,
.agency-guide-trigger:focus-visible {
    background: color-mix(in oklab, var(--warning-400, #fbbf24) 18%, transparent);
    outline: none;
}

.agency-guide-trigger:focus-visible {
    box-shadow: 0 0 0 2px var(--warning-500, #f59e0b);
}

.fi-header-heading .agency-guide-tooltip,
.agency-guide-tooltip {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 1.25rem !important;
}

.agency-guide-tooltip {
    position: absolute;
    top: calc(100% + 0.375rem);
    inset-inline-start: 0;
    z-index: 50;
    display: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
    white-space: nowrap;
    color: #ffffff;
    background: #18181b;
    pointer-events: none;
}

.agency-guide-trigger:hover .agency-guide-tooltip,
.agency-guide-trigger:focus-visible .agency-guide-tooltip {
    display: block;
}

.agency-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    background: rgba(0, 0, 0, .5);
}

.agency-guide-window {
    width: 100%;
    max-width: 46rem;
    border-radius: 0.75rem;
    font-family: 'Vazirmatn', var(--font-family, sans-serif);
    color: var(--gray-800, #1f2937);
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}

.dark .agency-guide-window {
    color: var(--gray-100, #f3f4f6);
    background: var(--gray-900, #111827);
}

.agency-guide-window-head {
    position: relative;
    /* The same room on both sides — the close button's width and its offset —
       so the centred title is centred on the whole window, not on what is left
       beside the button (تسک ۰۳، بند ۹). */
    padding: 0.75rem 3rem;
    border-bottom: 1px solid color-mix(in oklab, var(--gray-950, #030712) 10%, transparent);
}

/*
 * تسک ۰۲ (بازطراحی هدر مدیریت‌ها، بند ۲.۳): «راهنمای جست‌وجو و فیلترهای
 * مدیریت …» in the panel's yellow, bold — the size it had. Since تسک ۰۳ (بند
 * ۹) it stands in the middle of the window; a long one wraps, still centred,
 * and never runs under the close button, which stays at the end of the row.
 */
.agency-guide-window-title {
    text-align: center;
    overflow-wrap: anywhere;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.5rem;
    color: var(--warning-600, #d97706);
}

.dark .agency-guide-window-title {
    color: var(--warning-400, #fbbf24);
}

.agency-guide-close {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--gray-500, #6b7280);
}

.agency-guide-close:hover,
.agency-guide-close:focus-visible {
    color: var(--gray-900, #111827);
    background: color-mix(in oklab, var(--gray-950, #030712) 8%, transparent);
}

/*
 * بند ۳: the first part starts at the top of the body — the repeated title
 * and the room it took are gone, and nothing stands in for them. Rows keep a
 * readable 1.75 line height; the step between parts is short and the same
 * everywhere.
 */
.agency-guide-window-body {
    padding: 0.75rem 1.25rem 1rem;
    font-size: 0.875rem;
    line-height: 1.75;
}

.agency-guide-table + .agency-guide-table {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed color-mix(in oklab, var(--gray-950, #030712) 15%, transparent);
}

.agency-guide-table-title {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
}

/* بند ۴ و ۵: the icon and the words on one line, the icon in the heading's
   own colour and the same size in both parts. */
.agency-guide-heading {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.625rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    line-height: 1.5rem;
    color: var(--warning-600, #d97706);
}

.dark .agency-guide-heading {
    color: var(--warning-500, #f59e0b);
}

.agency-guide-table > .agency-guide-heading:first-child,
.agency-guide-table > .agency-guide-table-title + .agency-guide-heading {
    margin-top: 0;
}

.agency-guide-heading-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: currentColor;
}

/* بند ۶: the numbers are written in the markup, in Persian digits; the list
   draws none of its own. Each number hangs before its row, which wraps under
   itself rather than under the number. */
.agency-guide-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.agency-guide-list > li {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
}

.agency-guide-list > li + li {
    margin-top: 0.125rem;
}

.agency-guide-num {
    flex-shrink: 0;
    min-width: 1.25rem;
    text-align: start;
    font-variant-numeric: tabular-nums;
}

.agency-guide-text {
    min-width: 0;
}

.agency-guide-list ul {
    margin: 0;
    padding-inline-start: 1rem;
    list-style: disc;
}

.agency-guide-filter {
    font-weight: 700;
}

.agency-guide-empty {
    text-align: center;
    color: var(--gray-500, #6b7280);
}

@media (max-width: 640px) {
    .agency-guide-overlay {
        padding: 1rem 0.5rem;
    }

    .agency-guide-window-head {
        padding-inline: 2.75rem;
    }

    .agency-guide-window-title {
        font-size: 1rem;
    }

    .agency-guide-window-body {
        padding-inline: 1rem;
    }
}
