/* Select2 com o aspeto dos campos do portal e do backoffice. */
.portal-body {
    --select-background: var(--ml-surface);
    --select-text: var(--ml-ink);
    --select-muted: var(--ml-soft);
    --select-border: var(--ml-border);
    --select-accent: var(--ml-gold);
    --select-highlight: var(--ml-pale);
    --select-radius: 5px;
    --select-font-size: 17px;
    --select-line-height: 1.55;
    --select-padding-y: 12px;
}

.admin-sidebar-only {
    --select-background: var(--bg-input, var(--bg-card));
    --select-text: var(--text-dark);
    --select-muted: var(--text-muted);
    --select-border: var(--border-color);
    --select-accent: var(--primary);
    --select-highlight: var(--primary-light);
    --select-radius: 7px;
    --select-font-size: 16px;
    --select-line-height: 1.5;
    --select-padding-y: 11px;
}

.select2-container--local {
    min-width: 0;
    max-width: 100%;
    color: var(--select-text);
    font-family: inherit;
    font-size: var(--select-font-size, 16px);
    font-weight: 400;
    line-height: var(--select-line-height, 1.5);
    text-transform: none;
    letter-spacing: normal;
}

.select2-container--local .select2-selection {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    height: auto;
    padding: var(--select-padding-y, 11px) 38px var(--select-padding-y, 11px) 13px;
    border: 1px solid var(--select-border);
    border-radius: var(--select-radius);
    background: var(--select-background);
    color: var(--select-text);
    font: inherit;
    cursor: pointer;
}

.select2-container--local .select2-selection--single .select2-selection__rendered {
    display: block;
    min-width: 0;
    width: 100%;
    padding: 0;
    color: inherit;
    line-height: inherit;
    white-space: normal;
    overflow-wrap: anywhere;
}

.select2-container--local .select2-selection__placeholder {
    color: var(--select-muted);
}

.select2-container--local .select2-selection__arrow {
    position: absolute;
    top: 50%;
    right: 15px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--select-muted);
    border-bottom: 2px solid var(--select-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.select2-container--local .select2-selection__arrow b {
    display: none;
}

.select2-container--local.select2-container--open .select2-selection__arrow {
    transform: translateY(-20%) rotate(225deg);
}

.select2-container--local.select2-container--focus .select2-selection,
.select2-container--local.select2-container--open .select2-selection,
.select2-container--local .select2-selection:focus-visible {
    border-color: var(--select-accent);
    outline: 2px solid var(--select-accent);
    outline-offset: 2px;
}

.select2-container--local.select2-container--disabled .select2-selection {
    opacity: .6;
    cursor: not-allowed;
}

.select2-container--local .select2-selection__clear {
    margin-right: 10px;
    border: 0;
    background: transparent;
    color: var(--select-muted);
    font: inherit;
    cursor: pointer;
}

.select2-container--local .select2-selection--multiple {
    display: block;
    padding: 6px 10px;
}

.select2-container--local .select2-selection--multiple .select2-selection__rendered {
    display: inline;
    padding: 0;
    margin: 0;
    list-style: none;
}

.select2-container--local .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin: 4px 6px 4px 0;
    padding: 3px 8px;
    border: 1px solid var(--select-border);
    border-radius: 4px;
    background: var(--select-highlight);
    color: var(--select-text);
    font-size: max(14px, 1em);
    white-space: normal;
    overflow-wrap: anywhere;
}

.select2-container--local .select2-selection__choice__remove {
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--select-text);
    font: inherit;
    cursor: pointer;
}

.select2-container--local .select2-search--inline .select2-search__field {
    min-height: 26px;
    max-width: 100%;
    padding: 0;
    margin: 5px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--select-text);
    font: inherit;
    font-size: max(14px, 1em);
    resize: none;
}

.select2-container--local .local-select-dropdown {
    border: 1px solid var(--select-border);
    border-radius: var(--select-radius);
    background: var(--select-background);
    color: var(--select-text);
    box-shadow: 0 12px 30px #0002;
    font: inherit;
}

.select2-container--local .select2-search--dropdown {
    padding: 10px;
}

.select2-container--local .select2-search--dropdown .select2-search__field {
    min-height: 40px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--select-border);
    border-radius: 4px;
    background: var(--select-background);
    color: var(--select-text);
    font: inherit;
    font-size: max(14px, 1em);
}

.select2-container--local .select2-results__options {
    max-height: 260px;
    overflow-y: auto;
}

.select2-container--local .select2-results__option {
    padding: 10px 13px;
    color: var(--select-text);
    font-size: max(14px, 1em);
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
}

.select2-container--local .select2-results__option--selected,
.select2-container--local .select2-results__option--highlighted {
    background: var(--select-highlight);
    color: var(--select-text);
}

.select2-container--local .select2-results__option--disabled {
    color: var(--select-muted);
    opacity: .6;
}

.select2-container--local .select2-results__group {
    padding: 8px 13px;
    color: var(--select-muted);
    font-size: 14px;
}

.select2-container--local.is-compact,
.select2-container--local .local-select-dropdown.is-compact {
    --select-font-size: 14px;
    font-size: 14px;
}

.select2-container--local.is-compact .select2-selection {
    min-height: 34px;
    padding: 5px 30px 5px 8px;
}

.admin-row-actions .select2-container {
    max-width: 160px;
    min-width: 130px;
}

.select2-container--local.has-error .select2-selection {
    border-color: #b64034;
}

.select-field-error {
    display: block;
    margin-top: 6px;
    color: #b64034;
    font-size: 14px;
    line-height: 1.5;
}

/* Pesquisa do hero: campos integrados no bloco, sem uma caixa interior. */
.hero-search .search-field {
    min-width: 0;
}

.hero-search .select2-container--local {
    --select-font-size: 16px;
    --select-background: transparent;
    --select-padding-y: 2px;
    --select-line-height: 1.5;
    display: block;
    width: 100%;
    font-size: 16px;
}

.hero-search .select2-container--local .select2-selection {
    min-height: 30px;
    padding: 2px 25px 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    outline: none;
    box-shadow: none;
}

.hero-search .select2-container--local .select2-selection__rendered {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-search .select2-container--local .select2-selection__arrow {
    right: 6px;
}

.hero-search .select2-container--local .select2-selection__clear {
    order: 2;
    flex-shrink: 0;
    padding: 0;
    margin-right: 8px;
}

.hero-search .search-field:focus-within {
    border-radius: 6px;
    background: #f0e4b83d;
}

.select2-container--local .local-select-dropdown.is-hero {
    --select-font-size: 16px;
    --select-background: #fff;
    font-size: 16px;
}

/* O filtro de localidade acompanha os restantes campos da listagem. */
.portal-filter .select2-container--local {
    --select-font-size: 16px;
    --select-line-height: 1.55;
    --select-padding-y: 11px;
    --select-background: var(--ml-bg);
    --select-radius: 4px;
}
