/* Select2 Custom phpBB Integration Styles */
.select2-container {
    box-sizing: border-box;
    display: inline-block;
    margin: 2px 0;
    vertical-align: middle;
    text-align: left;
    max-width: 100%;
}

.select2-container--default .select2-selection--single {
    height: 34px;
    padding: 3px 26px 3px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #333;
    line-height: 26px;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px;
    position: absolute;
    top: 1px;
    right: 1px;
    width: 24px;
}

/* Multi-select box styling */
.select2-container--multi,
.select2-container:has(.select2-selection--multiple) {
    min-width: 180px;
    max-width: 300px;
    width: auto !important;
}

.select2-container--default .select2-selection--multiple {
    min-height: 34px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    padding: 2px 6px;
    box-sizing: border-box;
    width: 100%;
    cursor: text;
    display: block;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    margin: 0;
    list-style: none;
    width: 100%;
    box-sizing: border-box;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 3px;
    padding: 2px 8px;
    margin: 1px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    background: transparent !important;
    border: none !important;
    font-size: 15px !important;
    font-weight: bold !important;
    color: #777 !important;
    cursor: pointer;
    margin-right: 5px !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: static !important;
    flex-shrink: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #d9534f !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline {
    display: inline-flex;
    flex-grow: 1;
    margin: 1px 0;
    padding: 0;
    float: none !important;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    height: 24px !important;
    font-size: 13px !important;
    min-width: 60px !important;
    width: 100% !important;
    padding: 0 4px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.select2-dropdown {
    z-index: 999999 !important;
    border: 1px solid #aaa;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    background-color: #fff;
}

.select2-search--dropdown {
    padding: 5px;
    box-sizing: border-box;
}

.select2-search--dropdown .select2-search__field {
    width: 100%;
    padding: 5px 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #5897fb;
    outline: none;
}

.select2-results__options {
    max-height: 240px;
    overflow-y: auto;
}

.select2-results__option {
    padding: 6px 10px;
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}

.select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #5897fb;
    color: #fff;
}

.select2-results__option--selected {
    background-color: #f0f0f0;
}

.select2-results__message {
    padding: 8px 10px;
    color: #888;
    font-style: italic;
}

/* Rank preview option styling */
.select2-rank-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.select2-rank-thumb {
    max-height: 28px;
    max-width: 45px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 2px;
    background: transparent;
}

.select2-rank-title {
    font-weight: 600;
    color: #222;
}

.select2-rank-imgname {
    font-size: 0.82em;
    color: #666;
    font-family: monospace;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
}

/* Live image preview block in ACP Manage Ranks */
.acp-rank-image-preview-wrapper {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.acp-rank-image-preview-img {
    max-height: 40px;
    max-width: 120px;
    object-fit: contain;
}
