/*
 * تسک ۱۴۰۵/۰۸/۰۹ — باشگاه‌ها و کشورها: a club's logo before its name, a
 * country's flag before its name, and the «ویرایش: نام + تصویر» heading of
 * both edit pages. In Persian the picture comes first, so it stands to the
 * right of the name; the name stays text, so search and copy keep reading it.
 */

/* ── Flags: small, one height, at their own proportions ───────────────────── */
.pa-flag-label,
.pa-club-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    vertical-align: middle;
}

.pa-flag-label-text,
.pa-club-label-text {
    min-width: 0;
}

.pa-flag {
    flex: 0 0 auto;
    height: 0.875rem;
    width: auto;
    max-width: 1.75rem;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12);
}

.pa-flag-heading {
    height: 1.5rem;
    max-width: 2.75rem;
}

.pa-flag-preview {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
}

.pa-flag-preview-img {
    height: 1.75rem;
    max-width: 3.25rem;
}

.pa-flag-none {
    font-size: 0.8125rem;
    color: var(--gray-500, #6b7280);
}

/* «فعال» | پرچم فعلی | جایگزینی — one compact row, no large drop area. */
.pa-flag-row > .fi-grid {
    align-items: start;
}

.pa-flag-upload .filepond--root {
    max-height: 3rem;
    margin-bottom: 0;
}

/* ── Club logos ─────────────────────────────────────────────────────────── */
.pa-club-logo {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.pa-club-logo-heading {
    width: 2.5rem;
    height: 2.5rem;
}

/* ── «ویرایش: نام + تصویر» ─────────────────────────────────────────────── */
.pa-record-heading {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* The panel's standard yellow, one definition for every record heading's name
   and for the staff form's «نقش اصلی» (1405_08_09_05). */
:root {
    --pa-standard-yellow: #F59E0B;
}

.dark {
    --pa-standard-yellow: #FBBF24;
}

.pa-record-heading-name {
    color: var(--pa-standard-yellow);
}

/* An English name reads left to right, against the left edge. */
.pa-name-en {
    direction: ltr;
    text-align: left;
}

/* The teams window of a new club: the two lists scroll, the buttons stay. */
.pa-club-teams-others .fi-fo-checkbox-list-options {
    max-height: 18rem;
    overflow-y: auto;
}

/*
 * تسک ۱۴۰۵/۰۸/۰۹ — تیم‌ها و ستون «سازنده»: the team's edit heading, the
 * links of the teams list, and the creator's avatar in four lists.
 */

/* «ویرایش: [لوگو] نام | [پرچم] کشور | ۱۲ گالری» — wraps between parts, in order. */
/*
 * A part's «|» stands in the gap before it. When a narrow screen moves a part
 * to a new line, that gap lies outside the heading's start edge and is
 * clipped — so a bar is never left alone at the end (or the start) of a line,
 * and the parts keep their order without overlapping (۱۴۰۵/۰۸/۱۰، بند ۵).
 * `clip`, not `hidden`: only the sides are cut, the logo keeps its height.
 */
.pa-team-heading {
    --pa-team-heading-gap: 1.5rem;
    column-gap: var(--pa-team-heading-gap);
    row-gap: 0.25rem;
    overflow-x: clip;
    max-width: 100%;
}

.pa-team-heading-part {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    min-width: 0;
}

/* The team's name may itself wrap on a phone rather than run off the edge. */
.pa-team-heading-part .pa-record-heading-name {
    white-space: normal;
}

.pa-team-heading-sep {
    position: absolute;
    inset-inline-end: 100%;
    width: var(--pa-team-heading-gap);
    text-align: center;
    color: var(--gray-400, #9ca3af);
    font-weight: 400;
}

.pa-team-heading-galleries {
    color: #16A34A;
}

.dark .pa-team-heading-galleries {
    color: #4ADE80;
}

/* «گالری‌های قدیم» · «گالری‌های جدید» (تسک ۱۴۰۵/۰۸/۱۴/۱۰): two figures, each a link to its own list. */
a.pa-gallery-source {
    color: inherit;
    text-decoration: none;
}

a.pa-gallery-source:hover {
    text-decoration: underline;
}

.pa-gallery-source-sep {
    color: var(--gray-400, #9ca3af);
}

.pa-team-heading-none {
    color: var(--gray-500, #6b7280);
    font-weight: 400;
}

/* A name that opens its record: a hand, and an underline on hover or focus. */
.pa-link-cell a.fi-ta-col-has-column-url {
    cursor: pointer;
}

.pa-link-cell a.fi-ta-col-has-column-url:is(:hover, :focus-visible) :is(.fi-ta-text-item, .pa-club-label-text) {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* «سازنده»: one round avatar, one size, in all four lists. */
.pa-creator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pa-creator-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08);
}

.pa-creator-unknown .pa-creator-avatar {
    opacity: 0.45;
}

/* «فصل‌ها» (تسک ۱۴۰۵/۰۸/۱۱/۰۲): 40px, as Baligpa's list draws it beside the year's own 40px avatar. */
.pa-season-creator-cell .pa-creator-avatar {
    width: 2.5rem;
    height: 2.5rem;
}

/*
 * تسک ۱۴۰۵/۰۸/۰۹ — هیئت‌ها و فدراسیون‌ها: a board's or federation's logo
 * before its name, one size and gap in every row, at its own proportions.
 */
.pa-org-logo {
    flex: 0 0 auto;
    display: inline-block;
    position: relative;
    overflow: hidden;
    width: 2rem;
    height: 2rem;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    vertical-align: middle;
}

.pa-org-logo-heading {
    width: 2.5rem;
    height: 2.5rem;
}

/*
 * تسک ۱۴۰۵/۰۸/۱۰ — موارد باقی‌ماندهٔ هیئت‌ها و فدراسیون‌ها، بند ۱: the
 * emblem (the box's background) shows from the first moment; the logo sits
 * over it, invisible until it has loaded, and only then does the emblem go.
 * A logo that fails stays invisible — never the broken-image mark. The
 * picture fills the box exactly, so nothing around it moves.
 */
.pa-org-logo > .pa-org-logo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
}

.pa-org-logo[data-org-state="loaded"] {
    background-image: none !important;
}

.pa-org-logo[data-org-state="loaded"] > .pa-org-logo-img {
    opacity: 1;
}

.pa-org-logo[data-org-state="failed"] > .pa-org-logo-img {
    visibility: hidden;
}
