/**
 * Tupwebs Koombiyo Checkout Styles
 */

/* Classic Select2 Styling for Town / City Input */
.tupwebs-koombiyo-city-field .select2-container {
    width: 100% !important;
}

.tupwebs-koombiyo-city-field .select2-container .select2-selection--single {
    height: 48px !important;
    min-height: 48px !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 4px !important;
    position: relative !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 46px 0 14px !important;
    background-color: #ffffff !important;
}

.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__rendered {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    line-height: normal !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #333333 !important;
    font-size: 14px !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__placeholder {
    color: #888888 !important;
    line-height: normal !important;
}

/* Clear button (x) vertically centered */
.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 32px !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
    -webkit-transform: none !important;
    margin: 0 !important;
    float: none !important;
    font-size: 18px !important;
    font-weight: normal !important;
    color: #999999 !important;
    line-height: 1 !important;
    padding: 0 4px !important;
    z-index: 2 !important;
    cursor: pointer !important;
}

.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__clear:hover {
    color: #333333 !important;
}

/* Dropdown arrow (▼) vertically centered in the exact middle */
.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 12px !important;
    width: 20px !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    -webkit-transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
}

.tupwebs-koombiyo-city-field .select2-container .select2-selection--single .select2-selection__arrow b {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: none !important;
    -webkit-transform: none !important;
    border-color: #666666 transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    width: 0 !important;
    display: inline-block !important;
}

.tupwebs-koombiyo-city-field .select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #666666 transparent !important;
    border-width: 0 4px 5px 4px !important;
}

/* Select2 Custom Option Row with Right-Aligned Price Badge */
.select2-results__option .tupwebs-select2-row,
.select2-results__option .tupwebs-select2-row * {
    pointer-events: none !important;
}

.select2-results__option .tupwebs-select2-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 3px 2px !important;
}

.tupwebs-select2-city {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    text-align: left !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.tupwebs-select2-city-name {
    font-weight: 500 !important;
    color: #1e293b !important;
}

.tupwebs-select2-district {
    font-size: 11px !important;
    color: #64748b !important;
    font-weight: normal !important;
}

.tupwebs-select2-price {
    flex: 0 0 auto !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    margin-left: 12px !important;
    white-space: nowrap !important;
    transition: all 0.15s ease !important;
}

/* Hover and Highlighted state in Select2 */
.select2-results__option--highlighted[aria-selected] .tupwebs-select2-row .tupwebs-select2-city-name,
.select2-results__option--highlighted[aria-selected] .tupwebs-select2-row .tupwebs-select2-district {
    color: #ffffff !important;
}

.select2-results__option--highlighted[aria-selected] .tupwebs-select2-row .tupwebs-select2-price {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    color: #ffffff !important;
}

/* Block Checkout Floating Autocomplete Dropdown */
.tupwebs-city-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 999999;
    margin-top: 4px;
}

.tupwebs-city-dropdown ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tupwebs-city-dropdown li {
    padding: 10px 14px !important;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.tupwebs-city-dropdown li:hover {
    background-color: #f7f9fa;
    color: #ff6b00;
}

.tupwebs-city-dropdown li strong {
    color: #222;
    font-weight: 600;
}

.tupwebs-city-dropdown .tupwebs-city-meta {
    font-size: 12px;
    color: #777;
    background: #f0f2f5;
    padding: 2px 8px;
    border-radius: 12px;
}

.tupwebs-city-loading,
.tupwebs-city-no-match {
    padding: 12px 16px;
    font-size: 13px;
    color: #666;
    text-align: center;
}

/* Hide Postal Code Rules */
.tupwebs-hide-postcode .wc-block-components-address-form__postcode,
.tupwebs-hide-postcode input#shipping-postcode,
.tupwebs-hide-postcode input#billing-postcode,
.tupwebs-hide-postcode .wc-block-components-text-input:has(#shipping-postcode),
.tupwebs-hide-postcode .wc-block-components-text-input:has(#billing-postcode),
.tupwebs-hide-postcode #billing_postcode_field,
.tupwebs-hide-postcode #shipping_postcode_field {
    display: none !important;
}
