/* BEX Express Frontend Styles - Checkout Autocomplete */

/* Dropdown positioning - relative to parent (form-row) */
.woocommerce-checkout .form-row {
    position: relative;
}

.bex-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: -1px;
}

.bex-list {
    list-style: none !important;
    margin: 0;
    padding: 0;
}

/* Helper messages (disabled items) */
.bex-helper {
    padding: 8px 15px;
    font-size: 12px;
    color: #666;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    font-style: italic;
    cursor: default;
}

/* Regular selectable items */
.bex-item {
    padding: 10px 15px !important;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    margin-left: 0 !important;
}

.bex-item:last-child {
    border-bottom: none;
}

.bex-item:hover {
    background-color: #f5f5f5;
}

.bex-item:active {
    background-color: #e8e8e8;
}

/* Hidden fields */
input[id^="bex_"][id$="_settlement_id"],
input[id^="bex_"][id$="_street_id"] {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .bex-dropdown {
        max-height: 200px;
    }
    
    .bex-item {
        padding: 12px 15px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .bex-helper {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* ============================================================
   BEX ENFORCE SELECTION - Readonly polja + inline search
   ============================================================ */

/* Readonly polje - vizualno jasno da je "klikni za odabir" */
.bex-readonly-field {
    background-color: #f9f9f9 !important;
    cursor: pointer !important;
    border-color: #b0c4de !important;
    caret-color: transparent;
    user-select: none;
}

.bex-readonly-field:hover {
    border-color: #2271b1 !important;
    background-color: #f0f5fb !important;
}

/* Strelica desno - signal da je select */
.bex-readonly-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 32px !important;
}

/* Dropdown kontejner */
.bex-dropdown {
    display: none;
    position: absolute;
    z-index: 99999;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    width: 100%;
    left: 0;
    top: calc(100% + 4px);
    overflow: hidden;
}

/* Search input unutar dropdowna */
.bex-search-wrap {
    padding: 10px 10px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.bex-search-input {
    width: 100% !important;
    padding: 8px 12px !important;
    border: 1px solid #d0d5dd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    outline: none !important;
    box-sizing: border-box !important;
    background: #f9f9f9 !important;
}

.bex-search-input:focus {
    border-color: #2271b1 !important;
    background: #fff !important;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.15) !important;
}

/* Lista rezultata */
.bex-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 6px 0 !important;
    max-height: 220px;
    overflow-y: auto;
}

.bex-list .bex-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.1s;
}

.bex-list .bex-item:hover {
    background-color: #eef4fb;
    color: #2271b1;
}

.bex-item-name {
    font-weight: 500;
}

.bex-item-zip {
    font-size: 12px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 8px;
}

.bex-list .bex-helper,
.bex-loading {
    padding: 8px 14px;
    color: #888;
    font-size: 13px;
    font-style: italic;
    list-style: none;
}

.bex-no-results {
    padding: 10px 14px;
    color: #999;
    font-size: 13px;
    text-align: center;
}

/* Error poruka */
.bex-field-error {
    color: #e2401c;
    font-size: 0.85em;
    display: block;
    margin-top: 4px;
}

