/* Custom Flag Dropdown Styles */
.stolik-custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.stolik-custom-select {
    position: relative;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    box-sizing: border-box;
}

.stolik-custom-select:hover {
    border-color: #999;
}

.stolik-custom-select-wrapper.open .stolik-custom-select {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.stolik-custom-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.stolik-custom-selected .fi {
    font-size: 16px;
    flex-shrink: 0;
}

.stolik-custom-selected .stolik-option-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stolik-custom-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.stolik-custom-select-wrapper.open .stolik-custom-arrow {
    transform: rotate(180deg);
}

.stolik-custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stolik-custom-option {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.stolik-custom-option:last-child {
    border-bottom: none;
}

.stolik-custom-option:hover {
    background: #f8f9fa;
}

.stolik-custom-option .fi {
    font-size: 16px;
    flex-shrink: 0;
}

.stolik-custom-option .stolik-option-text {
    flex: 1;
    min-width: 0;
}

/* Flag icons styling */
.fi {
    display: inline-block;
    width: 16px;
    height: 12px;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 1px;
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .stolik-custom-select-wrapper {
        max-width: 100%;
    }

    .stolik-custom-dropdown {
        max-height: 150px;
    }
}

/* Languages page: constrain Select2 width via wrapper instead of forcing global width overrides. */
.stolik-languages-page .stolik-locale-select-wrap {
    display: inline-block;
    width: min(460px, 100%);
    max-width: 100%;
    vertical-align: middle;
}

.stolik-languages-page .stolik-locale-select-wrap > .select2-container {
    width: 100%;
    max-width: 100%;
}

/* Match WP input height while keeping rich template on one line. */
.stolik-languages-page .stolik-locale-select-wrap > .select2-container.select2-container--default .select2-selection--single {
    min-height: 32px;
    height: 32px;
    padding: 0 34px 0 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.stolik-languages-page .stolik-locale-select-wrap > .select2-container.select2-container--default .select2-selection--single .select2-selection__rendered {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    line-height: 30px;
    padding: 0;
}

.stolik-languages-page .stolik-locale-select-wrap > .select2-container.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 4px;
    width: 28px;
    height: 30px;
}

.stolik-languages-page .stolik-locale-select-wrap .stolik-locale-selection {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.stolik-languages-page .stolik-locale-select-wrap .stolik-locale-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.stolik-languages-page .stolik-locale-select-wrap .stolik-locale-label-line {
    display: inline;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.stolik-languages-page .stolik-locale-select-wrap .stolik-locale-label-status::before {
    content: "- ";
}

.stolik-languages-page .stolik-extra-locale-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.stolik-languages-page .stolik-extra-locale-controls .stolik-locale-select-wrap {
    flex: 0 1 460px;
}

.stolik-languages-page .stolik-currency-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
}

.stolik-languages-page .stolik-currency-input {
    width: 80px;
}

@media (max-width: 782px) {
    .stolik-languages-page .stolik-extra-locale-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .stolik-languages-page .stolik-extra-locale-controls .stolik-locale-select-wrap {
        width: 100%;
        flex: 1 1 auto;
    }
}
