/* Address Autocomplete Styles */
.address-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    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);
    z-index: 999999; /* Very high z-index to override browser autocomplete */
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

/* Disable browser autocomplete dropdown */
.address-dropdown-open {
    position: relative;
}

.address-dropdown-open::-webkit-calendar-picker-indicator,
.address-dropdown-open::-webkit-inner-spin-button,
.address-dropdown-open::-webkit-outer-spin-button {
    display: none;
    -webkit-appearance: none;
}

/* Override browser autocomplete styling */
.address-dropdown-open:-webkit-autofill,
.address-dropdown-open:-webkit-autofill:hover,
.address-dropdown-open:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px white inset;
    -webkit-text-fill-color: inherit;
    transition: background-color 5000s ease-in-out 0s;
}

.address-dropdown-open {
    border-radius: 4px 4px 0 0 !important;
    border-bottom-color: #ddd !important;
}

/* Address result items */
.address-result {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.address-result:hover,
.address-result.selected {
    background-color: #f8f9fa;
}

.address-result:last-child {
    border-bottom: none;
}

.address-display-name {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    margin: 0;
}

.address-display-name strong {
    font-weight: bold;
    color: #007cba;
    background-color: rgba(0, 123, 186, 0.1);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Loading, no results, and error states */
.address-loading,
.address-no-results,
.address-error {
    padding: 12px 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.address-loading {
    color: #007cba;
}

.address-no-results {
    color: #666;
}

.address-error {
    color: #dc3232;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .address-autocomplete-dropdown {
        max-height: 250px;
    }

    .address-result {
        padding: 10px 12px;
    }

    .address-display-name {
        font-size: 13px;
    }
}

/* WooCommerce form field adjustments */
.woocommerce-input-wrapper {
    position: relative;
}

/* Ensure dropdown appears above other elements */
.address-autocomplete-dropdown {
    z-index: 9999;
}

/* Focus states */
.address-dropdown-open:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 186, 0.25);
}

/* Loading animation */
.address-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
